Skip to content

Instantly share code, notes, and snippets.

@rock88
Created February 10, 2015 13:48
Show Gist options
  • Save rock88/ef9ee1936ac47c4b223c to your computer and use it in GitHub Desktop.
Save rock88/ef9ee1936ac47c4b223c to your computer and use it in GitHub Desktop.
- (void)share:(UIImage *)immagine completion:(void(^)(NSError* error))completion
{
[FBRequestConnection startWithGraphPath:@"/me/albums" parameters:nil HTTPMethod:@"GET" completionHandler:^(FBRequestConnection *connection,i d result, NSError *error)
{
if (!error)
{
NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
[params setObject:UIImagePNGRepresentation(immagine) forKey:@"picture"];
[FBRequestConnection startWithGraphPath:[NSString stringWithFormat:@"/%@/photos", result] parameters:params HTTPMethod:@"POST" completionHandler:^(FBRequestConnection *connection,result,NSError *error)
{
if (!error)
{
// no error - do some...
}
completion(error);
}];
}
completion(error);
}];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment