這可能是一個n00b的問題,但毫無疑問...我在我的iPad應用中使用Facebook SDK有點問題:當我使用[facebook dialog:@"feed" andDelegate:self];
顯示對話框時,我沒有看到任何方式我可以更改標題,內容或我想分享的網址。Facebook的iOS SDK對話框參數
在他們的演示應用,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
有什麼我不是做對了嗎?所有我在那個Demo App中改變了Facebook的kAppId和URL Scheme。
真棒,謝謝!你是如何發現你需要stream.publish而不是feed的? – 2011-02-17 17:14:03
嗯。當我嘗試這個時,Facebook對話框返回並聲明「h」是不允許的......無論h是什麼。 :( – 2011-03-18 21:55:29
正如@MrRogers所述,stream.publish API已被棄用,您應該按照他的[正確答案](http://stackoverflow.com/questions/4610153/facebook-ios-sdk-dialog-parameters/6739887#6739887 ) – 2011-08-12 07:35:59