简体   繁体   中英

Get if my app is authorized to use facebook [iOS 6, FB SDK 3.2]

how can i know is my app is authorized by user to use Facebook?

You can enable or disable it in "Settings -> Privacy -> Facebook". I have to get this state.

I'm using Facebook 3.2

Thank you all!

You can use the ACAccountStore to get the Facebook account(if it is available) and check if the access is granted:

ACAccountStore *accountStore = [[ACAccountStore alloc] init];

ACAccountType *accountType = [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook];

if(accountType.accessGranted){
    //app has permissions
}else{
    //no permissions
}

If you are looking for a line of code that checks, it's this one right here:

if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook])
{

//code goes here

}

NOTE

This code will help only if you are using the Social Framework.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM