Marc Matteo
Marc Matteo

Reputation: 93

Facebook publish_actions deprecated

What can I do to use as an alternative to publish_actions? I have a photo app that lets users share their photos to their profile. Currently it uses logInWithPublishPermissions:@[@"publish_actions"] and then shares the files through FBSDKSharePhoto. But after August 1 this will be removed. Any thoughts? This is my current code but soon it won't work.

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


}
}

Upvotes: 3

Views: 846

Answers (1)

Perry
Perry

Reputation: 1150

You'll need to switch to using Facebook's iOS sharing APIs which require that the Facebook Messenger app is installed. See their documentation on sharing.

You might also want to investigate the use of the iOS share sheet but that also requires the Facebook Messenger app to be installed to enable sharing to Facebook.

Upvotes: 1

Related Questions