我正在使用以下代码(显示在 WWDC 2012 视频中):
self.accountStore = [[ACAccountStore alloc] init];
ACAccountType *facebookAccountType = [self.accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook];
[self.accountStore requestAccessToAccountsWithType:facebookAccountType
withCompletionHandler:^(BOOL granted, NSError *e) {
if (granted)
{
NSArray *accounts = [self.accountStore
accountsWithAccountType:facebookAccountType];
self.facebookAccount = [accounts lastObject];
} else {
// Fail gracefully...
}
}];
我还添加了NSDictionary
到我的.plist
文件中:
所以,我的问题是我收到以下异常:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Access options are required for this account type.'
我已经尝试过这个ACAccountTypeIdentifierTwitter
和ACAccountTypeIdentifierSinaWeibo
. 尽管他们总是返回,但我没有收到任何异常granted == NO