Skip to content

Instantly share code, notes, and snippets.

@vincent-efwuhn
Created September 26, 2013 07:54
Show Gist options
  • Select an option

  • Save vincent-efwuhn/6711103 to your computer and use it in GitHub Desktop.

Select an option

Save vincent-efwuhn/6711103 to your computer and use it in GitHub Desktop.
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;
}];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment