We have:
(1) Facebook API Web Application with Facebook OAuth (“FB Web Application”)
(2) UIWebView based browser on iPad ("Browser")
Our goal is to open the Facebook login page in order to enter the FB (1) web application in a browser based on UIWebView (2) on the iPad.
There is a somewhat similar problem here:
http://facebook.stackoverflow.com/questions/11337285/no-longer-able-to-login-to-ios-app-via-oauth-the-page-requested-was-not-found
However, the question about this arises after the user enters the username and password into the Facebook form. Our problem is that we cannot get the Facebook login form displayed first. Changing the type of application from "Web" to "Home / Desktop", as suggested in this matter, did not help.
Steps:
1. Open our web page (simple HTML page) using this UIWebView browser
2. Press the start button "FB web app" on this page
3. OnClick JavaScript is trying to initiate OAuth, which should open the Facebook login screen to enter the FB web application.
Current Result (Release):
On iOS 5. + and iOS 6. + devices
- Our web page remains unchanged
- Facebook login page is NOT displayed (our web page is still displayed)
On iOS 4.3 (works as expected):
- the Facebook login page opens in the same UIWebView browser object (replaces our web page)
Expected Result:
- A Facebook login page is displayed, and the user can enter the Facebook login and password
- Works on iOS 5. + and iOS 6. + if running in Safari on iPad. The Facebook login page opens on a separate tab (on the contrary, there are no separate tabs in UIWebView )
Question: How can I get a UIWebView to open the Facebook login page in response to an OAuth request on iOS 5+ and iOS 6+?
Additional technical details:
We write different NSURLRequest fields from
-(BOOL)webView(UIWebView*)webView shouldStartLoadWithRequest(NSURLREquest*)request navigationType:…
And we notice some difference in the logs for the “right” and “wrong” behavior. Here's how the execution processes change:
Firstly, I press the “FB Web App” launch button to initiate OAuth, then some cases go
iOS 4.3, "correct"
request at www.facebook.com/dialog/oauth? ... request at fbwebapp.com
request m.facebook.com/login.php? ....
- A personal facebook login will appear
iOS 5.0, "correct1"
request at www.facebook.com/dialog/oauth? ... request at fbwebapp.com
request m.facebook.com/login.php? ...
Then it can be - a lot of m.facebook.com/login.php?...with next ... in the parameters
followed by sqlite error
- Now I see that the page “Sorry, something went wrong” from facebook (this is the first time I come across it)
iOS 6.0 "wrong2"
request at www.facebook.com/dialog/oauth? ... request at fbwebapp.com
- (void) webView: (UIWebView *) webView error didFailLoadWithError: (NSError *) is called with error code -999
You can see that this definitely depends on the version of iOS. But a common case is that the error occurs at the stage of obtaining m.facebook.com/login.php .. URL. But that’s all we can find.
All day we hit our head against this wall in search of solutions. Hopelessly.
Can you help us open the Facebook login page in UIWebView in response to OAuth?