1

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

4

2 回答 2

4
if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]

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

于 2013-03-28T11:09:09.410 回答
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;
    }
于 2013-04-19T07:26:46.250 回答