我试图上传文字与图像使用FBRequestConnection
像如下,但我只能够上传文字,而不是图像。 但是,当我给任何图像链接代替img1(图片),然后我能够在Facebook墙上看到图像。如何使用FBRequestConnection将文本上传到Facebook的图片?
UIImage *img1 = [UIImage imageNamed:@"[email protected]"];
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”
请让我知道我错了,在此代码。
目前需要使用“caption”而不是“message” – AlexeyVMP