使用iOS SDK在朋友的Facebook墙上发表评论

时间:2013-04-15 12:12:22

标签: iphone ios facebook facebook-graph-api facebook-ios-sdk

我是ios开发的新手,我很震惊,只在ios应用程序上对ios应用程序facebook帐户发表评论。你能指导我如何实施。提前谢谢。

1 个答案:

答案 0 :(得分:1)

NSString * urlString = [NSString stringWithFormat:@“https://graph.facebook.com/YOUR_FRIEND_FB_ID/photos?access_token=%@”,self.accessToken];

UIImage * pic = [UIImage imageNamed:@"green-background.png"];
NSData *picData = UIImageJPEGRepresentation(pic, 1);
NSURL *url = [NSURL URLWithString:urlString];
ASIFormDataRequest *newRequest = [ASIFormDataRequest requestWithURL:url];
[newRequest setPostValue:@"This is Sample Text" forKey:@"message"];
[newRequest setData:picData forKey:@"data"];
[newRequest setPostValue:self.accessToken forKey:@"access_token"];
[newRequest setDelegate:self];
[newRequest setDidFinishSelector:@selector(postToWallFinished:)];
[newRequest startAsynchronous];