我想询问用户是否愿意启用 FB 集成并为他们提供 UISwitch 以表明他们的偏好。但是,我只想在用户实际在 iPhone 设置中设置其 FB 帐户的情况下启用/取消隐藏该选项。一个人如何去检查他们是否做了那么多?
问问题
655 次
2 回答
2
give it a try this will help you .....
if(iOSVersion >= 6.0)
{
if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook])
{
NSLog(@"user have filled fb acount details");
}
else
{
NSLog(@"settings is empty");
}
}
于 2013-04-19T04:04:47.343 回答
1
我想到了。这是对我有用的代码块。我欢迎改进建议:)
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-19T03:56:02.517 回答