开发者

Returning to main view from UIWeb view after HTTP call

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 UIW开发者_如何学CebView 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 :)


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜