【发布时间】:2025-11-23 11:55:02
【问题描述】:
我正在开发一个在 Facebook 上发布状态的应用,但我收到以下错误: 操作无法完成(com.facebook.sdk 错误 2) 尽管当被问及是否可以在 Facebook 上发布帖子时,我按下了确定。 在 iPhone 设置上,我已经重置了隐私和位置,虽然我允许发布,但在“隐私”->“Facebook”下找不到我的应用
这是我获取权限的代码:
-(void)postOnFacebook
{
if (FBSession.activeSession.isOpen)
[self postOnWall];
else
{
[FBSession openActiveSessionWithPublishPermissions:[NSArray arrayWithObjects:@"publish_actions", nil]
defaultAudience:FBSessionDefaultAudienceEveryone
allowLoginUI:YES
completionHandler:^(FBSession *session,
FBSessionState status,
NSError *error)
{
if (error)
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error"
message:error.localizedDescription
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
}
else if (FB_ISSESSIONOPENWITHSTATE(status))
{
NSLog(@"Sending post on wall request...");
[self postOnWall];
}
}];
};
}
【问题讨论】: