我尝试使用以下代码发布带有iOS应用中图片的留言信息:
- (void) putOnFacebookWall:(UIImage *) screenShot{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSString *filePath = [NSTemporaryDirectory() stringByAppendingPathComponent:@"temp.png"];
[UIImagePNGRepresentation(screenShot) writeToFile:filePath options:NSAtomicWrite error:nil];
NSData *imageData = UIImagePNGRepresentation([UIImage imageNamed:@"ironman.jpg"]);
NSURL *url = [NSURL URLWithString:@"https://graph.facebook.com/me/feed"];
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
//
[request setPostValue:imageData forKey:@"picture"];
[request setPostValue:@"http://apps.facebook.com/mobie-hair-wizz" forKey:@"link"];
[request setPostValue:@"test" forKey:@"message"];
[request setPostValue:[defaults objectForKey:@"FBAccessTokenKey"] forKey:@"access_token"];
[request setDidFinishSelector:@selector(sendToPhotosFinished:)];
[request setDelegate:self];
[request startAsynchronous];
}
我得到的是:
https://www.dropbox.com/s/z5nzm271zkadq4j/wall.png?m
图像不显示的原因是什么?
我在FB的iOS代码中也得到了积极的回应,说上传成功了。