[英]How to upload a status with a image using facebook sdk?
我用它来上传带有消息的图像:
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];
}];
它可以正常工作,并且可以在相册中看到该图像,但是在主视图中没有显示上传状态。如何上传带有消息的图像,并可以在主视图中显示该图像?
你的代码是完全没问题,我觉得现在的问题是,你有你的FB的故事, 最近从最新新闻进行排序。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.