gpt4 book ai didi

ios - Facebook 权限 - com.apple.accounts 错误 8

转载 作者:行者123 更新时间:2023-11-28 22:26:36 26 4
gpt4 key购买 nike

我需要在 Facebook 时间线上发布状态。我的代码包含 2 个请求。首先用于验证电子邮件权限,其次用于验证发布权限。我得到了权限“电子邮件”请求的成功响应,但在第二种情况下出现错误“发布权限错误:操作无法完成。(com.apple.accounts 错误 8.)”。你有什么想法可能会出错吗?感谢您的帮助。

- (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);
}
}];
}

最佳答案

好的,我知道了!选项字典必须如下所示:

NSDictionary *options = @{
ACFacebookAppIdKey : key,
ACFacebookPermissionsKey : @[@"publish_stream", @"publish_actions"],
ACFacebookAudienceKey: ACFacebookAudienceEveryone
};

取而代之的是:

NSDictionary *options = @{
ACFacebookAppIdKey : key,
ACFacebookPermissionsKey : @[@"publish_stream"]
};

关于ios - Facebook 权限 - com.apple.accounts 错误 8,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18782361/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com