Iphone facebook connect example calls safari. I don't want to use safari. How to fix this problem.
9 Answers
Donkim's suggestion above worked well for me using the 1/31/2011 commit of the SDK. Another option is to look for each call to "authorizeWithFBAppAuth:safariAuth:" in Facebook.m. You can change the second argument from YES to NO on lines 221, 267, and 274.
Despite the fact that it open safari and that's ugly, you benefit from the SSO which is a great feature. If any other app is using FBConnect, you user will be automatically connected to yours. And if the facebook app is present, its even better, the login is done through the facebook app and no longer in safari.
So I suggest you keep it that way !
I agree that the whole process should be a bit improved and at least not open a new safari tab every time you connect ! Patience...
For anyone using a newer Facebook iOS SDK (not sure which version added it), you can use the dialog:@"oauth" ...
method (doc). As others have said, you give up SSO, but for use cases like mine (an OpenGL game), I find the overlay preferable to switching to a different app.
File: Facebook.m | Starts at: line #220 authorizeWithFBAppAuth:safariAuth:
| Add boolean trySafariAuth = NO;
to line #223
/**
* A private function for opening the authorization dialog.
*/
- (void)authorizeWithFBAppAuth:(BOOL)tryFBAppAuth
safariAuth:(BOOL)trySafariAuth {
trySafariAuth = NO;
// more code allow blow this, but im too lazy to show it
// so please just change the boolean...
}
Change following method as follows in facebook.m
- (void)authorize:(NSArray *)permissions
delegate:(id<FBSessionDelegate>)delegate {
[_permissions release];
_permissions = [permissions retain];
_sessionDelegate = delegate;
[self authorizeWithFBAppAuth:NO safariAuth:NO];
// [self authorizeWithFBAppAuth:NO safariAuth:YES];
}