javascript - Facebook login works in Safari but not in UIWebView -
i have app uiwebview
displays web page has facebook login. i'm using facebook's javascript sdk (i cannot use ios sdk).
the login works when open site in mobile safari not in web view. login dialog opens, enter user credentials , redirects blank white page. know causes this. ina normal browser, login dialog opens in new window. since uiwebview
not support multiple windows, login replaces webpage , once logged in, can't redirect original web page.
i've searched on solutions of them outdated. don't think there straight forward fix if has workaround/hack, please me out.
thank you.
check if added facebook application id (your app id) xcode project - app's url schema. make sure redirect user page after fb login.
- (void)webviewdidfinishload:(uiwebview *)webview { nsstring *url = [[webview.request url] absolutestring]; // if([url hasprefix:@"https://m.facebook.com/dialog/oauth"]) if([url hasprefix:@"https://m.facebook.com/home.php?"]) { /* here must implement method send user page */ [self backtomypage]; } } }
Comments
Post a Comment