当我尝试在iphone应用程序的facebook墙上发布时,我在消息对话框中收到以下消息:
Application response error.
The attachment was either missing or its improperly formatted. you can see this because you are one of the developers of the app.
这是我用来在facebook墙上张贴的代码
FBStreamDialog *dialog = [[[FBStreamDialog alloc] init] autorelease];
dialog.userMessagePrompt=@"Enter your message:";
dialog.attachment = [NSString stringWithFormat:@"Testing"];
[[FBRequest requestWithDelegate:self] call:@"facebook.photos.upload" params:[NSDictionary dictionaryWithObjectsAndKeys:@"AppName",@"caption",nil] dataParam:UIImageJPEGRepresentation([UIImage imageNamed:@"AppImage.png"],1.0)];
[dialog show];
我找到了答案对话框。附件是字符串,应该在一个适当的格式有所有必要的字段,如appname,超链接,描述,媒体的图像等和属性。如果它只是一个简单的字符串,这是不够的。
dialog.attachment = [NSString stringWithFormat:@"{"name":"AppName","""href":"Hyperlink","description" :"DescriptionOfApp","""media":[{"type":"image","""src":"HyperlinkOfApp Image","""href":"Hyperlink"}],"""properties":{"PropertiesIfAny":{"text" :"Property","href":"Hyperlink"}}}"];
我认为下面的代码有问题
[NSDictionary dictionaryWithObjectsAndKeys:@"AppName",@"caption",nil]
你应该像这样输入值和键
[NSDictionary dictionaryWithObjectsAndKeys:value1,key1,value2,key2,...,nil]