All the magic is in
- (void)authorize:(NSArray *)permissions delegate:(id<FBSessionDelegate>)delegate
which call [self authorizeWithFBAppAuth:YES safariAuth:YES] :
FBAppAuth:YES will attempt to authenticate using the Facebook application if installedsafariAuth:YES will attempt to authenticate with Safari if the device supports multitasking
So you want [self authorizeWithFBAppAuth:NO safariAuth:NO]
If you want to leave the unmodified Facebook SDK, you can simply βexposeβ their private api:
@interface Facebook (Private) - (void)authorizeWithFBAppAuth:(BOOL)tryFBAppAuth safariAuth:(BOOL)trySafariAuth; @end
And then continue if with a category:
@interface Facebook (MyApp) - (void)myAuthorize:(id<FBSessionDelegate>)delegate; @end @implementation Facebook (MyApp) - (void)myAuthorize:(id<FBSessionDelegate>)delegate { _permissions = [[NSArray arrayWithObjects:@"email", *(whatever you need)*, nil] retain]; _sessionDelegate = delegate; [self authorizeWithFBAppAuth:NO safariAuth:NO];
Then use it almost normally:
Facebook *facebook = [[Facebook alloc] initWithAppId:MY_APP_FB_ID]; [facebook myAuthorize:self];
What they didnβt implement the popular request, there is even pull requests using solutions ...
Vincent guerci
source share