如何在Facebook墙上发布而无需打开Dialog? [英] How to post on Facebook wall without opening Dialog?
问题描述
我正在尝试将facebook整合到我的应用中。我已经完成了登录代码并尝试在我的墙上发帖但我不需要facebook对话框。我想要自己的。谷歌搜索后我发现了一些代码,但它没有用。它没有给出任何错误但没有发布任何东西...
I am trying to integrate facebook in my app. I had done code for login and trying to post on my wall but I don't need the facebook dialog. I want my own. after googling I found some code but its not working. It is not giving any error but not posting any thing...
我在这里使用的是:
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];
这会打开一个对话框并要求我输入消息,当我点击它时,我会在墙上发布数据。
This opens a dialog and ask me to type message and when I clicks It post the Data on my wall.
我已经反馈了以下链接
http://forum.developers.facebook.net/viewtopic.php?id=79466
请告诉我我在哪里做错了。
Please tell me where I am doing mistake.
谢谢
推荐答案
我想你可以做到这一点,可以解决你的问题
hi i think you can do this and can solve your problem
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];
这篇关于如何在Facebook墙上发布而无需打开Dialog?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!