[英]Facebook iOS SDK Dialog parameters
這可能是一個n00b問題,但是……我在iPad應用程序中使用Facebook SDK時遇到了一個問題:當我使用[facebook dialog:@"feed" andDelegate:self];
顯示對話框時[facebook dialog:@"feed" andDelegate:self];
我看不到可以更改標題,內容或要共享內容的URL的任何方法。
在其演示應用程序中,Facebook具有以下代碼:
- (IBAction)publishStream:(id)sender {
SBJSON *jsonWriter = [[SBJSON new] autorelease];
NSDictionary* actionLinks = [NSArray arrayWithObjects:[NSDictionary
dictionaryWithObjectsAndKeys: @"Always Running",@"text",@"http://itsti.me/",
@"href", nil], nil];
NSString *actionLinksStr = [jsonWriter stringWithObject:actionLinks];
NSDictionary* attachment = [NSDictionary dictionaryWithObjectsAndKeys:
@"a long run", @"name",
@"The Facebook Running app", @"caption",
@"it is fun", @"description",
@"http://itsti.me/", @"href", nil];
NSString *attachmentStr = [jsonWriter stringWithObject:attachment];
NSMutableDictionary* params = [NSMutableDictionary
dictionaryWithObjectsAndKeys:
@"Share on Facebook", @"user_message_prompt",
actionLinksStr, @"action_links",
attachmentStr, @"attachment",
nil];
[_facebook dialog:@"feed"
andParams:params
andDelegate:self];
}
但是,當我按下publishStream按鈕時,這些字符串都不會顯示在對話框中! :S
有什么我做不對的事情嗎? 我在該演示應用程序中所做的更改只是Facebook kAppId和URL Scheme。
我意識到這已經得到了答案,但是我發現這是正確的答案。 它遵循FB在這里的功能 。 圖像和/或鏈接實際上顯示在對話框中。 stream.publish
並沒有對我進行更改。 此外, 對話框頁面還說stream.publish
是舊的。
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
@"http://developers.facebook.com/docs/reference/dialogs/", @"link",
@"http://fbrell.com/f8.jpg", @"picture",
@"Facebook Dialogs", @"name",
@"Reference Documentation", @"caption",
@"Dialogs provide a simple, consistent interface for apps to interact with users.", @"description",
@"Facebook Dialogs are so easy!", @"message",
nil];
[_facebook dialog:@"feed"
andParams:params
andDelegate:self];
我有同樣的問題。 這是我找到的解決方案:以這種方式更改代碼:
[_facebook dialog:@"stream.publish"
andParams:params
andDelegate:self];
使用stream.publish而不是feed。
嗯..我還沒有使用示例應用程序,但是我想如果您想在牆上貼東西,則需要進行POST。 在此處查看該問題和我的答案: 使用最新的FBConnect SDK將發布到iPhone的用戶的Facebook牆上
總結一下,這是我使用的方法:
- (void)requestWithGraphPath:(NSString *)graphPath
andParams:(NSMutableDictionary *)params
andHttpMethod:(NSString *)httpMethod
andDelegate:(id <FBRequestDelegate>)delegate;
像這樣:
[_facebook requestWithGraphPath:@"[user_id]/feed"
andParams:[NSMutableDictionary dictionaryWithObject:@"test wall post" forKey:@"message"]
andHttpMethod:@"POST"
andDelegate:self];
在[user_id]
的牆上發表評論。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.