Facebook publish_actions已弃用

时间:2018-05-10 18:32:44

标签: xcode facebook

我可以做些什么来替代publish_actions?我有一个照片应用程序,可让用户将照片分享到他们的个人资料。目前它使用logInWithPublishPermissions:@ [@“publish_actions”],然后通过FBSDKSharePhoto共享文件。但在8月1日之后,这将被删除。有什么想法吗?这是我目前的代码,但很快就无法使用。

-(IBAction)loginToFacebook:(id)sender
{
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");
                                       nonpressTimer = [NSTimer scheduledTimerWithTimeInterval:15.0 target:self selector:@selector(timeout) userInfo:nil repeats:NO];
                                   } else {
                                       NSLog(@"Logged in");

                                       [self shareSegmentWithFacebookComposer];
                                   }

                               }];
}

- (void)shareBoothOnFacebook {
NSUserDefaults *defaults2 = [NSUserDefaults standardUserDefaults];
NSData *data6 = [defaults2 objectForKey:@"layoutphoto"];
UIImage *myImage = [NSKeyedUnarchiver unarchiveObjectWithData:data6];


NSMutableArray *photos = [[NSMutableArray alloc] init];


    for (int i = 0; i < [self.arrSlidshowImg count]; i++) {

        UIImage *image = [UIImage imageWithData:[_arrSlidshowImg objectAtIndex:i]];
        FBSDKSharePhoto *photo = [[FBSDKSharePhoto alloc] init];
        photo.image = image;
        photo.userGenerated = YES;
        [photos addObject:photo];


    }

 FBSDKSharePhotoContent *content = [[FBSDKSharePhotoContent alloc] init];
content.photos = [photos copy];
[FBSDKShareAPI shareWithContent:content delegate:nil];


}
}

1 个答案:

答案 0 :(得分:0)

您需要切换到使用必须安装Facebook Messenger应用程序的Facebook iOS共享API。查看他们的documentation on sharing

您可能还想调查iOS share sheet的使用,但这还需要安装Facebook Messenger应用程序才能与Facebook分享。