Error when using [FBSession openActiveSessionWithPublishPermissions: ..]

后端 未结 4 790
轮回少年
轮回少年 2020-12-14 13:30

I\'m updating an app to use the latest Facebook SDK in order to gain access to the iOS6 native Facebook support. It currently uses a pretty old version of the Facebook SDK.

4条回答
  •  南笙
    南笙 (楼主)
    2020-12-14 14:11

    ACAccountStore *store = [[ACAccountStore alloc] init];
    
    ACAccountType *accountType  = [store accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook];
    NSArray *accounts = [store accountsWithAccountType:accountType];
    NSLog(@"accounts:%@", accounts);
    

    if accounts is nil (or maybe it returns an empty array, I'm not sure), then the user has not configured Facebook in iOS6. You can test for that and if the value indicates that Facebook has not been configured for iOS6, you can call your fallback mechanism.

提交回复
热议问题