我正在尝试使用FBRequestConnection
如下方式上传带有图像的文本,但我只能上传文本,而不是图像。但是,当我提供任何图像链接代替 img1(image) 时,我就可以在 facebook 墙上看到图像。
UIImage *img1 = [UIImage imageNamed:@"Default@2x.png"];
NSMutableDictionary *params = [[NSMutableDictionary alloc] initWithObjectsAndKeys:
@"https://developers.facebook.com/ios", @"link",
img1, @"picture",
@"Facebook SDK for iOS", @"name",
@"build apps.", @"caption",
@"imagae description.", @"description",
nil];
[params setObject:@"post message" forKey:@"message"];
[FBRequestConnection
startWithGraphPath:@"me/feed"
parameters:params
HTTPMethod:@"POST"
completionHandler:^(FBRequestConnection *connection,
id result,
NSError *error) {
NSString *alertText;
if (error) {
alertText = [NSString stringWithFormat:
@"error: domain = %@, code = %d",
error.domain, error.code];
} else {
alertText = @"Posted successfully.";
}
// Show the result in an alert
[[[UIAlertView alloc] initWithTitle:@"Result"
message:alertText
delegate:self
cancelButtonTitle:@"OK!"
otherButtonTitles:nil]
show];
}];
我已经获得了两个权限@"publish_actions",@"user_photos"
请让我知道我在这段代码中哪里错了。