繁体   English   中英

需要user_photos吗?

[英]Is user_photos needed?

请原谅基本问题,但我对为我的应用请求Facebook权限感到非常困惑。 我的应用程序允许用户选择照片,然后登录到他们的Facebook页面,这些照片会发布在他们的时间轴上。 我正在请求manage_pages,publish_pages和publish_actions。 在我的开发人员帐户中,我添加了两个测试人员,他们是我的朋友,我们对过程进行了彻底的测试。 一切正常。 但是,当我创建一个测试用户(facebook在其中创建普通帐户的用户)时,我的应用程序不会将照片发布到他们的墙上。 我授予测试用户相同的权限。 我现在想知道是否需要将user_photos称为另一个请求的权限。 我不这样做,因为我不要求访问用户的照片或相册。 我只是将照片发布到他们的时间轴上,我认为这就是publish_pages和publish_actions的作用。 您可以看一下代码,看看是否能找到我做错的事情?

  - (IBAction)facebookButtonClicked1:(id)sender
{


   if ([self.selectedImages count] > 0)
   {


  FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init];
    login.loginBehavior = FBSDKLoginBehaviorWeb;
   [login logInWithPublishPermissions:@[@"publish_actions"]
    fromViewController:self
    handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) {
        if (error) {
            NSLog(@"Process error");
        } else if (result.isCancelled) {
            NSLog(@"Cancelled");
        } else {
            NSLog(@"Logged in");

             [self shareSegmentWithFacebookComposer];


        }
    }];

   }
  else
  {
   UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"No Photos"    message:@"You have not selected any photo." delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
   [alert show];
  }


 }

-(void)shareSegmentWithFacebookComposer{
if ([[FBSDKAccessToken currentAccessToken]   hasGranted:@"publish_actions"]) {
    [self publishFBPost]; //publish
} else {
    NSLog(@"no publish permissions");
  }
  }

  -(void) publishFBPost{
 NSMutableArray* photos = [[NSMutableArray alloc] init];

for (NSString* imageFile in self.selectedImages) {
    UIImage *image = [UIImage imageWithContentsOfFile:[dataPath stringByAppendingPathComponent:imageFile]];
    FBSDKSharePhoto *photo = [[FBSDKSharePhoto alloc] init];
    photo.image = image;
    photo.userGenerated = YES;

    [photos addObject:photo];

}

FBSDKSharePhotoContent *content = [[FBSDKSharePhotoContent alloc] init];
content.photos = [photos copy];

[FBSDKShareDialog showFromViewController:self
  withContent:content
        delegate:nil];
  [FBSDKShareAPI shareWithContent:content delegate:nil];

viewThanks.hidden = NO;
   [NSTimer scheduledTimerWithTimeInterval:4.5 target:self selector:@selector(start) userInfo:nil repeats:NO];

FBSDKShareDialog *shareDialog = [FBSDKShareDialog new];

[shareDialog setMode:FBSDKShareDialogModeAutomatic];
  [shareDialog setShareContent:content];
 [shareDialog show];
}

拥有上传照片的publish_stream权限,但是在最新的SDK中, publish_actions取代了publish_actions,因此您只需要publish_actions。 而且,如果您想查看用户的照片,则需要user_photos权限。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM