在搜索了2天后,我终于发布了我的代码。
应用程序说明:我通过imagePicker选择图像,编辑后我想在Facebook上分享。
问题:我可以在墙上发布文字而不是图片,因为我没有任何网址,我无法找到另一种方式在我的墙上发布图片。
这是我PostToWall的代码(我从另一个应用程序中窃取)
FBStreamDialog* dialog = [[[FBStreamDialog alloc] init] autorelease];
dialog.userMessagePrompt = @"Enter your message:";
dialog.actionLinks = @"[{\"Get DowntownLA!\",\"href\":\"http://www.facebook.com/DowntownLA.com/\"}]";
dialog.attachment = [NSString stringWithFormat:
@"{ \"name\":\"%@\","
"\"href\":\"%@\","
"\"caption\":\"%@\",\"description\":\"%@\","
"\"media\":[{\"type\":\"image\","
"\"src\":\"%@\","
"\"href\":\"%@\"}],"
"\"properties\":{\"%@\":{\"text\":\"%@\",\"href\":\"%@\"}}}", @"name: priya",@"href nothing",@"cation nothing",@"description nothin", @"imageSource nothing ", @"imageHref nothing", @"linkTitle nothing", @"linkText nothing", @"linkHref nothing"];
[dialog show];
请告诉我我的错误!!!!!
进入模拟器的错误是:应用程序响应错误 - 后置操作链接必须是有效的URls。你可以看到这个,因为你是该应用程序的开发人员之一。
答案 0 :(得分:0)
我以这种方式上传图片
- (void) postOnFBWall
{
NSMutableDictionary *variables = [NSMutableDictionary dictionaryWithCapacity:2];
//create a UIImage (you could use the picture album or camera too)
UIImage *picture = imgUploadPhoto.image;
//create a FbGraphFile object insance and set the picture we wish to publish on it
FbGraphFile *graph_file = [[FbGraphFile alloc] initWithImage:picture];
//finally, set the FbGraphFileobject onto our variables dictionary....
[variables setObject:graph_file forKey:@"file"];
NSString * messageValue = [NSString stringWithFormat:@"Menu Name: %@, Restaurant: %@, Category: %@, Comment: %@",txtNameofMenu.text,txtRestaurant.text,categoryLbl.text,txtViewComment.text];
[variables setObject:[NSString stringWithFormat:@"%@",messageValue] forKey:@"message"];
//the fbGraph object is smart enough to recognize the binary image data inside the FbGraphFile
//object and treat that is such.....
FbGraphResponse *fb_graph_response = [[FBRequestWrapper defaultManager] doGraphPost:@"me/photos" withPostVars:variables];
NSLog(@"postPictureButtonPressed: %@", fb_graph_response.htmlResponse);
}