[英]Facebook permission - com.apple.accounts error 8
I need to publish status on Facebook timeline. 我需要在Facebook时间线上发布状态。 My code consists 2 request.
我的代码包含2个请求。 First for verifying email permission, second for verifying publish permission.
首先用于验证电子邮件权限,第二个用于验证发布权限。 I get successful response with permission "email" request but I get error "Publish permission error: The operation couldn't be completed. (com.apple.accounts error 8.)" in second case.
我通过权限“电子邮件”请求获得成功响应但我收到错误“发布权限错误:操作无法完成。(com.apple.accounts错误8.)”在第二种情况下。 Do you have any ideas where could be error?
你有什么想法可能会出错吗? Thanks for help.
感谢帮助。
- (void)facebookStatus:(NSString *)identifier {
ACAccountStore *accountStore = [[ACAccountStore alloc]init];
ACAccountType *FBaccountType= [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook];
NSString *key = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"FacebookAppID"];
NSDictionary *options = @{
ACFacebookAppIdKey : key,
ACFacebookPermissionsKey : @[@"email"]
};
[accountStore requestAccessToAccountsWithType:FBaccountType options:options completion:^(BOOL granted, NSError *error) {
if (granted) {
NSArray *accounts = [accountStore accountsWithAccountType:FBaccountType];
if ([accounts count] > 0) {
ACAccountStore *accountStore = [[ACAccountStore alloc]init];
ACAccountType *FBaccountType= [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook];
NSString *key = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"FacebookAppID"];
NSDictionary *options = @{
ACFacebookAppIdKey : key,
ACFacebookPermissionsKey : @[@"publish_stream"]
};
[accountStore requestAccessToAccountsWithType:FBaccountType options:options completion:^(BOOL granted2, NSError *error) {
if (granted2) {
NSLog(@"Publish")
;
}
else {
NSLog(@"Publish permission error: %@", [error localizedDescription]);
//_publishPermissionsGranted = NO;
}
}];
}
}
else NSLog(@"Nope");
if (error) {
if (error.code == 6) {
NSLog(@"FB Account doesn't exist");
}
NSLog(@"Error: %@", error.localizedDescription);
}
}];
}
Okey, I've got it! 哦,我知道了! Options dictionary has to look like this:
选项字典必须如下所示:
NSDictionary *options = @{
ACFacebookAppIdKey : key,
ACFacebookPermissionsKey : @[@"publish_stream", @"publish_actions"],
ACFacebookAudienceKey: ACFacebookAudienceEveryone
};
Instead of this: 而不是这个:
NSDictionary *options = @{
ACFacebookAppIdKey : key,
ACFacebookPermissionsKey : @[@"publish_stream"]
};
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.