我正在尝试将Facebook整合到我的应用中。我已经完成了登录代码并尝试在我的墙上发帖但我不需要facebook对话框。我想要自己的。谷歌搜索后,我发现了一些代码,但它不起作用。它没有给出任何错误,但没有发布任何东西......
我在这里使用的是:
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
@"Facebook developer Test Message",@"message",
@"Test it!",@"name",
nil];
Facebook *fb = [[Facebook alloc] init];
[fb requestWithGraphPath:@"me/feed" // or use page ID instead of 'me'
andParams:params
andHttpMethod:@"POST"
andDelegate:self];
它不起作用..
FBStreamDialog *dialog = [[[FBStreamDialog alloc] init]
autorelease];
dialog.userMessagePrompt = @"Enter your message:";
dialog.attachment = [NSString
stringWithFormat:@"{\"name\":\"Facebook Connect for iPhone\",\"href\":\"http://developers.facebook.com/connect.phptab=iphone\",\"caption\":\"Caption\", \"description\":\"Description\",\"media\":[{\"type\":\"image\",\"src\":\"http://img40.yfrog.com/img40/5914/iphoneconnectbtn.jpg\",\"href\":\"http://developers.facebook.com/connect.php?tab=iphone/\"}],\"properties\":{\"another link\":{\"text\":\"Facebook home page\",\"href\":\"http://www.facebook.com\"}}}"];
[dialog show];
这会打开一个对话框并要求我输入消息,当我点击它时,我会在墙上发布数据。
我已经参考了这个
的链接http://forum.developers.facebook.net/viewtopic.php?id=79466
请告诉我我在哪里做错了。
谢谢
答案 0 :(得分:7)
嗨,我认为你可以做到这一点,可以解决你的问题
NSString *str=@"Your String to post";
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
str,@"message",
@"Test it!",@"name",
nil];
Facebook *fb = [[Facebook alloc] init];
[fb requestWithGraphPath:@"me/feed" // or use page ID instead of 'me'
andParams:params
andHttpMethod:@"POST"
andDelegate:self];