I understand that iOS 6 requires a double login to support ACAccountStore , so the Facebook login tutorial implies that you must do this for all cases. Switching the application twice is a bad user interface, and I think I came up with a job.
First, for older iOS (e.g. iOS 5.0), you can simply use openActiveSessionWithPublishPermissions: and execute read and publish permissions in one fell swoop. Secondly, the same call works if the user has never accessed Facebook from the deviceโs settings. Therefore, the following code works as follows:
- If the user has registered on Facebook from the device settings: one dialogue for read and one dialogue for publication.
- If the user has the Facebook application installed: switch to the FB application once and get 2 tips in a row.
- Otherwise: switch for Safari once and get 2 prompts per line
I tested this code on iOS6 and iOS5 device using Facebook SDK 3.2.1
- (BOOL)hasFacebookInDeviceSettings { ACAccountStore *accountStore = [[ACAccountStore alloc] init]; ACAccountType *accountTypeFB = [accountStore accountTypeWithAccountTypeIdentifier:@"com.apple.facebook"]; BOOL hasFacebookBuiltinAccount = (accountTypeFB != nil); return hasFacebookBuiltinAccount; } - (BOOL)hasLoggedInToFacebookInDeviceSettings { if (![self hasFacebookInDeviceSettings]) { return NO; } BOOL result = [SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]; return result; } - (void)openFacebookSessionWithAllowLoginUI:(BOOL)allowLoginUI { if (![self hasLoggedInToFacebookInDeviceSettings]) {
hasFacebookInDeviceSettings reports whether this device even supports Facebook features (for example, this is iOS6 +).
hasLoggedInToFacebookInDeviceSettings reports that the user has signed a contract with Facebook using the iOS6 Facebook device settings.
You will need to create your own facebookSessionStateChanged: and another code as described in the login tutorial
source share