我正在尝试使用以下代码发布带有来自 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代码中得到了肯定的回应,说上传成功。