我想在我的应用程序中集成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];
Run Code Online (Sandbox Code Playgroud)
它无法正常工作..
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];
Run Code Online (Sandbox Code Playgroud)
这会打开一个对话框并要求我输入消息,当我点击它时,我会在墙上发布数据.
我已经反馈了以下链接
http://forum.developers.facebook.net/viewtopic.php?id=79466
请告诉我我在哪里做错了.
谢谢
嗨,我认为你可以做到这一点,可以解决你的问题
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];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2853 次 |
| 最近记录: |