Post a picture on facebook
I want to publish a picture with a title (@n开发者_JAVA百科ame) and a texte (@caption) on facebook when my quiz is over. I try to put my picture in an UIImage then i called her with @picture int the attachment but it doesn't work at all.
Have you a piece of code to show me how i can do this?
Thank you
Flo
This works for me :
- (void) uploadPhoto:(UIImage *) img caption:(NSString *) caption delegate:(NSObject<FBRequestDelegate> *) delegate{
NSMutableDictionary * params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
img, @"picture",
nil];
if (caption != nil) {
[params setObject:params forKey:@"message"];
}
[self requestWithGraphPath:@"me/photos"
andParams:params
andHttpMethod:@"POST"
andDelegate:delegate];
}
I think you have a typo in your method. I believe:
[params setObject:params forKey:@"message"];
should read:
[params setObject: caption forKey:@"message"];
精彩评论