如何在ios 6中编写SLComposeViewController之前检查用户是否在iphone设置中输入了他的facebook详细信息

时间:2013-03-28 11:07:08

标签: ios facebook facebook-login slcomposeviewcontroller

我想在我的应用程序中编写SLComposeViewController之前显示警告消息,如何在ios 6中编写SLComposeViewController之前检查用户是否在iphone设置中输入了他的facebook详细信息。

2 个答案:

答案 0 :(得分:4)

if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]

返回一个布尔值,指示服务是否可访问且至少设置了一个帐户

答案 1 :(得分:3)

i have figured this out . . . 

self.myStore = [[ACAccountStore alloc] init];
    ACAccountType *acct = [self.myStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook];
    NSArray *fbAccounts = [self.myStore accountsWithAccountType:acct];

    // Check to make sure the user has a FB account setup, or bail:
    if ([fbAccounts count] == 0) {
        userDoesNotHaveFBAccountSetup = YES;
        self.fbSwitch.enabled = NO;
        [[self fbSwitch] setOn:NO];
        [self viewDidLoad];
    } else {
        userDoesNotHaveFBAccountSetup = NO;
        self.fbSwitch.enabled = YES;
    }