0

I'm trying to post Photo, URL, message and name to Facebook from my iOS application to user's wall. I'm using latest Facebook framework 3.1
I'm using following code:

    NSDictionary* dict = @{
    @"link" : @"https://www.yahoo.com",
    @"picture" : UIImagePNGRepresentation([UIImage imageNamed:@"Default.png"]),
    @"message":@"Your message here",
    @"name" : prodName,
    @"caption" : [NSString stringWithFormat:@"Try the app: %@", prodName],
    @"description" : @"Integrating Facebook in ios"
};

[FBRequestConnection startWithGraphPath:@"me/photos" parameters:dict HTTPMethod:@"POST" completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
    NSString *alertText;
    if (error)
    {
        NSLog(@"%@",[NSString stringWithFormat: @"error: domain = %@, code = %d", error.domain, error.code]);
        alertText = @"Failed to post to Facebook, try again";
    } else
    {
        alertText = @"Posted successfully to Facebook";
    }

    [[[UIAlertView alloc] initWithTitle:@"Facebook Result" message:alertText delegate:nil cancelButtonTitle:@"OK!" otherButtonTitles:nil] show];
}];    

I'm able to post successfully. But I'm seeing in Facebook that, its posting only photo and message and not other details. If I'm using @"me/feed", I'm not even able to post successfully. Facebook is giving error code=5.
How can I post all the details?

Satyam
  • 15,493
  • 31
  • 131
  • 244

1 Answers1

0

"me/feed" requires a url for the "picture" parameter. Please take a look at this link: a previous post on posting a photo on user's wall

Looks like you have to decide whether to use "me/photos" or "me/feed". This link will give you more information and may be a possible way around it.

Community
  • 1
  • 1
aobs
  • 1,063
  • 1
  • 11
  • 23