【发布时间】:2023-03-30 00:15:01
【问题描述】:
我想在 facebook 墙上发布一些带有图像的文本。我有这个来自 graph api 的代码,但我想从 bundle 发布我的图像,而不是像这个 api 那样从链接发布。谁能告诉我如何发布您自己的图片,而不是链接“[variables setObject:@"http://bit.ly/bFTnqd" forKey:@"link"];"在脸书墙上。
NSMutableDictionary *variables = [NSMutableDictionary dictionaryWithCapacity:4];
[variables setObject:@"this is a test message: postMeFeedButtonPressed" forKey:@"message"];
UIImage *picture = [UIImage imageNamed:@"forest fog.jpg"];
[variables setObject:@"http://bit.ly/bFTnqd" forKey:@"link"];
[variables setObject:@"This is the bolded copy next to the image" forKey:@"name"];
[variables setObject:@"This is the plain text copy next to the image. All work and no play makes Jack a dull boy." forKey:@"description"];
FbGraphResponse *fb_graph_response = [fbGraph doGraphPost:@"me/feed" withPostVars:variables];
NSLog(@"postMeFeedButtonPressed: %@", fb_graph_response.htmlResponse);
//parse our json
SBJSON *parser = [[SBJSON alloc] init];
NSDictionary *facebook_response = [parser objectWithString:fb_graph_response.htmlResponse error:nil];
[parser release];
//let's save the 'id' Facebook gives us so we can delete it if the user presses the 'delete /me/feed button'
self.feedPostId = (NSString *)[facebook_response objectForKey:@"id"];
NSLog(@"feedPostId, %@", feedPostId);
NSLog(@"Now log into Facebook and look at your profile...");
【问题讨论】:
标签: iphone api facebook-graph-api http-post