次のように画像付きのテキストをアップロードしようとしています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"という2つの許可を取得しました
このコードのどこが間違っているか教えてください。