Just-in-time invocation of Facebook login window from UIWebView
- by Chris Garrett
I have an app that presents a UIWebView pointing to my own server. I have a Facebook Like button on some pages inside the UIWebView.
I have it working now, but the login screen is way too big for the phone screen. I would like to present a nicer login dialog such as the one in the Facebook iPhone API, and then continue back to the web view.
The Facebook iPhone SDK has support for a login button and iPhone-friendly login screen, but it assumes that a user will click a login button before doing anything Facebook related. I would like the Like button to just appear, and to bring up the iPhone login screen only when necessary.
I have monitored HTTP requests from my web view, and it looks like I could intercept the login request there, and present the login dialog. However, it seems that this would be fragile, because if Facebook changes those calls then my app will no longer work. Is there a more elegant way to do this?