[英]How to post on Facebook wall without opening Dialog?
我正在嘗試將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
請告訴我我在哪里做錯了。
謝謝
嗨,我認為您可以做到,並且可以解決您的問題
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];
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.