开发者

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"];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜