首页 文章

为什么requestAccessToAccountsWithType facebook失败并显示“无效权限:photo_upload”

提问于
浏览
1

我正试图访问Facebook以将图像发布到iOS应用程序的页面 . 但到目前为止,我甚至不能让它给我我需要的权限 .

我已经做了很多搜索,包括iOS 6 Facebook posting procedure ends up with "remote_app_id does not match stored id" errorFacebook Graph Api Fan page photo upload (IOS),但这些或其他帖子中没有任何内容可以解决这个问题 .

这是代码的auth位:

ACAccountType *accountType = [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook];

NSDictionary *options = @{
                          ACFacebookAppIdKey: @"xxxxxxxxxxxxxx",
                         ACFacebookPermissionsKey: @[@"manage_pages"],
                          ACFacebookAudienceKey: ACFacebookAudienceEveryone
                          };

[accountStore requestAccessToAccountsWithType:accountType options:options completion:^(BOOL granted, NSError *error)
 {
     if (granted)
     {
         NSDictionary *options = @{
                                   ACFacebookAppIdKey: @"xxxxxxxxxxxxxx",
                                   ACFacebookPermissionsKey: @[@"photo_upload"],
                                   ACFacebookAudienceKey: ACFacebookAudienceEveryone
                                   };

         [accountStore requestAccessToAccountsWithType:accountType options:options completion:^(BOOL granted, NSError *error)
          {
              if (granted)
              {
                   // then do the upload - but it never gets here
              }
              else
              {
                   // handle error - this is where it ends up
              }
          }];
     }
     else
     {
          // handle error
     }
 }];

正如在其他一些帖子上建议的那样,我在写入之前首先请求读取权限 . 它获得了manage_pages权限 .

当我要求获得photo_upload权限时,会弹出Facebook权限提醒,要求我确认它可以代表我发布,然后单击“确定” - 但该权限请求块返回时将授予的设置设置为FALSE .

我在那时得到的完整错误消息是“Facebook服务器无法满足此访问请求:无效权限:photo_upload”

在Facebook应用程序网站上,我认为我已经做了我需要做的一切:我创建了我的应用程序并获得了一个AppId,添加了iOS作为平台并将BundleId设置为iOS应用程序使用的相同,并在高级选项卡上将它设置为Native应用程序 .

有没有人有任何想法我做错了什么?

1 回答

  • 0

    使用 publish_actions 作为您的许可 . 新的Facebook API建议在适用时使用 publish_actions 代替 publish_stream . 如果要将以下功能发布到朋友的订阅源,发布问题,创建备注以及将内容发布到事件或组,则应包括 publish_stream .

相关问题