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

独自空忆成欢 提交于 2019-12-12 09:10:34

问题


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!


回答1:


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
}



回答2:


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.



来源:https://stackoverflow.com/questions/15465602/get-if-my-app-is-authorized-to-use-facebook-ios-6-fb-sdk-3-2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!