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... } }];
我还在我的.pList文件中添加了NSDictionary:
所以,我的问题是我收到以下异常:
*** Terminating app due to uncaught exception 'NSinvalidargumentexception',reason: 'Access options are required for this account type.'
我尝试过这个ACAccountTypeIDentifIErTwitter和ACAccountTypeIDentifIErSinaWeibo.我没有收到任何例外,虽然他们总是返回授予==否
解决方法 好吧,WWDC 2012显示了一件事,但 documentation显示了另一个……他们正在使用的方法现在已被弃用:– requestAccesstoAccountsWithType:withCompletionHandler: Deprecated in iOS 6.0
你应该做什么:
ACAccountType *facebookAccountType = [self.accountStore accountTypeWithAccountTypeIDentifIEr:ACAccountTypeIDentifIErFacebook]; NSDictionary *options = @{ @"ACFacebookAppIDKey" : @"123456789",@"ACFacebookPermissionsKey" : @[@"publish_stream"],@"ACFacebookAudIEnceKey" : ACFacebookAudIEnceEveryone}; // Needed only when write permissions are requested [self.accountStore requestAccesstoAccountsWithType:facebookAccountType options:options completion:^(BOol granted,NSError *error) { if (granted) { NSArray *accounts = [self.accountStore accountsWithAccountType:facebookAccountType]; self.facebookAccount = [accounts lastObject]; } else { NSLog(@"%@",error); // Fail gracefully... } }];总结
以上是内存溢出为你收集整理的iOS6中的Facebook集成错误(Accounts.framework)全部内容,希望文章能够帮你解决iOS6中的Facebook集成错误(Accounts.framework)所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)