简体   繁体   English

需要user_photos吗?

[英]Is user_photos needed?

Please excuse the elementary question but I am pretty confused on requesting Facebook permissions for my app. 请原谅基本问题,但我对为我的应用请求Facebook权限感到非常困惑。 My app allows users to select photos then login to their facebook page and those photos are posted on their timeline. 我的应用程序允许用户选择照片,然后登录到他们的Facebook页面,这些照片会发布在他们的时间轴上。 I am requesting manage_pages, publish_pages, and publish_actions. 我正在请求manage_pages,publish_pages和publish_actions。 In my developer account I added two testers who are friends of mine and we thoroughly tested the process. 在我的开发人员帐户中,我添加了两个测试人员,他们是我的朋友,我们对过程进行了彻底的测试。 Everything works perfectly. 一切正常。 But when I created a Test User (the one where facebook creates a generic account) my app doesn't post photos to their wall. 但是,当我创建一个测试用户(facebook在其中创建普通帐户的用户)时,我的应用程序不会将照片发布到他们的墙上。 I granted the test user the same permissions. 我授予测试用户相同的权限。 I am now wondering if I need to call user_photos as another requested permission. 我现在想知道是否需要将user_photos称为另一个请求的权限。 I don't think I do since I am not requesting access to the users photos or albums. 我不这样做,因为我不要求访问用户的照片或相册。 I am simply posting photos to their timeline which I thought is what publish_pages and publish_actions does. 我只是将照片发布到他们的时间轴上,我认为这就是publish_pages和publish_actions的作用。 Can you look at the code and see if you can find what I am doing wrong? 您可以看一下代码,看看是否能找到我做错的事情?

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

There were publish_stream permission to upload photos but in the latest SDK publish_actions have replaced publish_actions so you only need publish_actions. 拥有上传照片的publish_stream权限,但是在最新的SDK中, publish_actions取代了publish_actions,因此您只需要publish_actions。 And if you want to see the user's photos then you need the user_photos permission. 而且,如果您想查看用户的照片,则需要user_photos权限。

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

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