我用它来上传带有消息的图片:
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];
}];
它工作正常,我可以看到我的相册中的图像,但我没有在我的主视图中显示上传状态。如何上传带有消息的图像,它可以在我的主视图中显示?
答案 0 :(得分:0)
您的代码完全没问题,我认为问题在于您必须将您的FB故事排序为最新 热门故事。