我用它来上传带有消息的图像:
NSMutableDictionary *dic=[NSMutableDictionary dictionaryWithCapacity:2];
[dic setObject:@"a message" forKey:@"message"];
[dic setObject:UIImagePNGRepresentation([UIImage imageNamed:@"1.png"]) forKey:@"source"];
[FBRequestConnection startWithGraphPath:@"me/photos" parameters:dic HTTPMethod:@"POST"
completionHandler:^(FBRequestConnection *connection,id result,NSError *error) {
NSString *alertText;
if (error) {
alertText = [NSString stringWithFormat:
@"error: domain = %@, code = %d",
error.domain, error.code];
NSLog(@"%@",error);
} else {
alertText = [NSString stringWithFormat:
@"Posted action, id: %@",
[result objectForKey:@"id"]];
}
// Show the result in an alert
[[[UIAlertView alloc] initWithTitle:@"Result"
message:alertText
delegate:self
cancelButtonTitle:@"OK!"
otherButtonTitles:nil]
show];
}];
它工作正常,我可以在我的相册中看到图像,但我的主页视图中没有显示上传状态。如何上传带有消息的图像,并且可以在我的主页视图中显示?