Skip to content

Instantly share code, notes, and snippets.

@pizthewiz
Last active December 11, 2015 02:39
Show Gist options
  • Save pizthewiz/4532416 to your computer and use it in GitHub Desktop.
Save pizthewiz/4532416 to your computer and use it in GitHub Desktop.
starting with version 3.1 (possibly 3.0, but i've only tested on 3.1.1) the iOS Facebook SDK disables the in-app UIWebView modal dialog (FBDialog) to authenticate the user and instead only enables iOS 6 system, Facebook.app and Mobile Safari. this hack was found and tested by stepping through the Facebook SDK source and building it manually into…
// GRITTY - force Facebook SDK 3.1+ to use in-app modal UIWebView for user authentication
@implementation FBSession (CLUAdditions)
- (void)HACKEDauthorizeWithPermissions:(NSArray*)permissions behavior:(FBSessionLoginBehavior)behavior defaultAudience:(FBSessionDefaultAudience)audience isReauthorize:(BOOL)isReauthorize {
objc_msgSend(self, @selector(authorizeWithPermissions:defaultAudience:integratedAuth:FBAppAuth:safariAuth:fallback:isReauthorize:), permissions, audience, NO, NO, NO, YES, isReauthorize);
}
+ (void)load {
method_exchangeImplementations(class_getInstanceMethod(self, @selector(authorizeWithPermissions:behavior:defaultAudience:isReauthorize:)), class_getInstanceMethod(self, @selector(HACKEDauthorizeWithPermissions:behavior:defaultAudience:isReauthorize:)));
}
@end
@pizthewiz
Copy link
Author

using the objective-c runtime to swap implementations instead of just a category leaves things less ambiguous.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment