I am using the following code to upload an image to Facebook wall :
UIImage *img = [UIImage imageNamed:@\"logoits.png\"];
[FBRequestConnection startForUploa
In the Facebook SDK 3.0 only a image can be post using the given methods, and for other actions you need to use graph a pi's.
So for post a image with message you need to use graph-api. Here is the line of codes which lets you to post a image with message on users timeline.
NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
[params setObject:@"your custom message" forKey:@"message"];
[params setObject:UIImagePNGRepresentation(_image) forKey:@"picture"];
_shareToFbBtn.enabled = NO; //for not allowing multiple hits
[FBRequestConnection startWithGraphPath:@"me/photos"
parameters:params
HTTPMethod:@"POST"
completionHandler:^(FBRequestConnection *connection,
id result,
NSError *error)
{
if (error)
{
//showing an alert for failure
[self alertWithTitle:@"Facebook" message:@"Unable to share the photo please try later."];
}
else
{
//showing an alert for success
[UIUtils alertWithTitle:@"Facebook" message:@"Shared the photo successfully"];
}
_shareToFbBtn.enabled = YES;
}];
and also make sure _shareToFbBtn is enabled only after login is success.