iphone facebook集成应用程序响应错误

时间:2011-11-24 05:40:32

标签: iphone facebook

当我试图在我的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];

你能帮我吗?

2 个答案:

答案 0 :(得分:1)

我找到了答案dialog.attachment是一个字符串,应该是一个正确的格式,包含所有必要的字段,如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\"}}}"]; 

现在工作正常。

答案 1 :(得分:0)

我认为以下代码存在问题

[NSDictionary dictionaryWithObjectsAndKeys:@"AppName",@"caption",nil]

你应该像这样输入值和键

[NSDictionary dictionaryWithObjectsAndKeys:value1,key1,value2,key2,...,nil]