Ghost Rider
Ghost Rider

Reputation: 57

How to Share image on any facebook account?

I am using latest version of facebook sdk in my ios app. I want to share an image on facebook with some initial text.I add my facebook account as a developer in my app on facebook developer account. Currently image is sharing only my account not any other account. Someone tell me please how can i share image by login any facebook account.

Thanks,

Upvotes: 0

Views: 789

Answers (3)

technerd
technerd

Reputation: 14514

For publish any content from another account other than your developer account, you have to submit your application to Facebook Review Process.

If Facebook find your request to use publish action appropriate then they grant this feature for public use. Now, at time of login , If user give permission for publish_action then he/she will be able to post content in respective Facebook Account.

Here I posting code for Login with publish_action permission.

    -(void)loginWithPublishActionPermission{

FBSDKLoginManager *loginManager = [[FBSDKLoginManager alloc] init];
[loginManager logInWithPublishPermissions:@[@"publish_actions"] handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) {

    [SVProgressHUD dismiss];
    if (error) {

        [[[UIAlertView alloc] initWithTitle:kApp_Name message:error.localizedDescription delegate:nil cancelButtonTitle:kAlert_Ok_Button otherButtonTitles:nil, nil] show];

    } else if (result.isCancelled) {

        //User Canceled Login
        [[[UIAlertView alloc] initWithTitle:kApp_Name message:kAlert_FaceBook_Cancel_Message delegate:nil cancelButtonTitle:kAlert_Ok_Button otherButtonTitles:nil, nil] show];

    } else {

        // If you ask for multiple permissions at once, you
        // should check if specific permissions missing
        if ([result.grantedPermissions containsObject:@"publish_actions"]) {

            NSLog(@"Result : %@",result);
        }
        [self performSegueWithIdentifier:kPush_To_Detail_Segue sender:nil];
    }
}];
}

To submit your application to Facebook for permission review.

Go to Dashboard of your application in Facebook developer portal.

Then follow below steps for app submission :

1) Dashboard --> Status&Review --> Item in Review --> Start a new submission

2) Select publish_action checkmark --> Add Item

enter image description here

3) Upload your simulator build , Screenshots of application which shows use of publish action feature.

4) Add Step by step instruction to check your flow of application.(How you are using publish_action in your app ?)

5) Submit your app.

Upvotes: 1

Rahul Patel
Rahul Patel

Reputation: 1832

In develepors.facebook.com select your app, in that there is an option of "Status & review". In that turn on the switch which says "Do you want to make this app and all its live features available to the general public?" This will allow other users also to login into your app with their facebook account

check below link

https://i.sstatic.net/CW1mu.png

Upvotes: 1

Mohit Mathur
Mohit Mathur

Reputation: 62

-(void)FbShare
{
    FBSDKShareLinkContent *content = [[FBSDKShareLinkContent alloc] init];
    content.contentURL = [NSURL URLWithString:@"https://developers.facebook.com"];
    content.contentTitle=@“Initial Text”;
    FBSDKSharePhoto *photo = [[FBSDKSharePhoto alloc] init];
    FBSDKSharePhotoContent *content1 = [[FBSDKSharePhotoContent alloc] init];
    UIImage *image=[UIImage imageNamed:[NSString stringWithFormat:@"[email protected]"]];
        photo.image = image;
        photo.userGenerated = YES;

        content1.photos = @[photo];

        [FBSDKShareDialog showFromViewController:self
                                     withContent:content1
                                        delegate:nil];


}

Upvotes: 0

Related Questions