HTTP 调用后从 UIWeb 视图返回主视图

发布于 2024-11-26 18:21:20 字数 1102 浏览 3 评论 0原文

我正在使用 SoundCloud Cocoa Wrapper API。要将用户的 SoundCloud 帐户连接到他们的 Facebook 帐户,我使用以下方法:

[scAPI performMethod:@"POST"
        onResource:@"connections"
    withParameters:[NSDictionary dictionaryWithObjectsAndKeys:
                    @"facebook_profile", @"service",
                    @"http://imc", @"redirect_uri",
                    @"touch", @"display", //optional, forces services to use the mobile auth page if available
                    nil]
           context:@"newConnection"
          userInfo:nil];

效果非常好: 我可以看到连接是在我的 SoundCloud 连接设置页面上建立的。问题是,一旦 Facebook UIWebView 页面完成其工作,屏幕就会变白,并且不会返回到我的应用程序的视图。换句话说,UIWebView 没有收到“离开”的消息。我如何向它发送此消息?

有什么想法吗?

编辑1

其他一些可能有帮助的信息:

#define kCallbackURL              @"imc://oauth"      //remember that the 
myapp protocol also is set in the info.plist 
PLIST URL identifier                    com.imc 
PLIST URL Scheme Item 0          imc 

谢谢:)

I'm using the SoundCloud Cocoa Wrapper API. To connect the users SoundCloud account to their Facebook account I use this:

[scAPI performMethod:@"POST"
        onResource:@"connections"
    withParameters:[NSDictionary dictionaryWithObjectsAndKeys:
                    @"facebook_profile", @"service",
                    @"http://imc", @"redirect_uri",
                    @"touch", @"display", //optional, forces services to use the mobile auth page if available
                    nil]
           context:@"newConnection"
          userInfo:nil];

which works perfectly fine: I can see that the connection is made on my SoundCloud connections settings page. The thing is once the Facebook UIWebView page does it's job the screen goes white and it doesn't return to the view of my application. In other words the UIWebView doesn't get the message to 'go away'. How do I send it this message?

Any ideas?

EDIT 1

Some other info that might help:

#define kCallbackURL              @"imc://oauth"      //remember that the 
myapp protocol also is set in the info.plist 
PLIST URL identifier                    com.imc 
PLIST URL Scheme Item 0          imc 

Thanks :)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

深海蓝天 2024-12-03 18:21:20

在 Twitter OAuth 中,它是通过以下方式完成的。用户按下 UIWevView 上的授权按钮后,将调用 DismissModalViewControllerAnimated 来关闭该视图:

if ([_delegate respondsToSelector: @selector(OAuthTwitterController:authenticatedWithUsername:)]) [_delegate OAuthTwitterController: self authenticatedWithUsername: _engine.username];
[self performSelector: @selector(dismissModalViewControllerAnimated:) withObject: (id) kCFBooleanTrue afterDelay: 1.0];

所以我想你应该写这样的内容:

[self performSelector: @selector(dismissModalViewControllerAnimated:) withObject: (id) kCFBooleanTrue afterDelay: 1.0];

在 Web 视图完成工作后调用

In Twitter OAuth it is done in the following way. After user presses authorize button on UIWevView, the dismissModalViewControllerAnimated is called to close that view:

if ([_delegate respondsToSelector: @selector(OAuthTwitterController:authenticatedWithUsername:)]) [_delegate OAuthTwitterController: self authenticatedWithUsername: _engine.username];
[self performSelector: @selector(dismissModalViewControllerAnimated:) withObject: (id) kCFBooleanTrue afterDelay: 1.0];

So I guess you should write something like this:

[self performSelector: @selector(dismissModalViewControllerAnimated:) withObject: (id) kCFBooleanTrue afterDelay: 1.0];

to be called after your job is done with web view

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文