2011-04-08 93 views
1

我試圖利用Facebook發佈API鏈接以此爲這裏給出http://developers.facebook.com/docs/reference/api/post/的Facebook上發佈後iPhone API:不發佈正確

NSDictionary *privacyDict = [[[NSDictionary alloc] initWithObjectsAndKeys:@"SELF",@"value",nil] autorelease]; 
SBJSON *jsonWriter = [[SBJSON new] autorelease]; 
NSString *privacyJSONStr = [jsonWriter stringWithObject:privacyDict]; 
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys: 
            @"Test test", @"message", 
            privacyJSONStr, @"privacy", 
            @"http://www.facebook.com/", @"link", 
            @"This name check where it will show", @"name", 
            @"Caption for the link", @"caption", 
            @"Longer description of the link", @"description", 
            nil]; 
[facebookObj requestWithMethodName:@"facebook.Stream.publish" andParams:params andHttpMethod:@"POST" andDelegate:self]; 

其發佈成功,但並不像我想象的
沒有標題,名稱,描述,鏈接等
它顯示爲

enter image description here

這種類型的結果,我可以由此p得到arameter

NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys: 
             @"Test test", @"message", 
             privacyJSONStr, @"privacy", 
             nil]; 

什麼是錯誤的,我們怎樣才能發佈所有參數

阿米特Battan

+0

仍沒有回覆。 。 。 – 2011-04-19 04:30:49

+0

你確定privacyJSONStr!= nil? – 2011-05-04 07:40:19

+0

privacyJSONStr具有非空值。它在第二種情況下工作正常 – 2011-05-04 13:06:08

回答

0

試試這個..其作品對我來說

- (IBAction)publishStream{ 

    SBJSON *jsonWriter = [[SBJSON new] autorelease]; 

    NSDictionary* actionLinks = [NSArray arrayWithObjects:[NSDictionary dictionaryWithObjectsAndKeys: 
                  @"Posting From",@"text",@"http://www.google.com/",@"href", nil], nil]; 

    NSString *actionLinksStr = [jsonWriter stringWithObject:actionLinks]; 

    NSLog(@"Action Link String : %@", actionLinksStr); 

    NSDictionary* attachment = [NSDictionary dictionaryWithObjectsAndKeys: 
           @"Feed Name", @"name", 
           @"Feed Caption is here", @"caption", 
           @"Feed Description is here", @"description", 
           @"http://www.google.com/", @"href", nil]; 


    NSString *attachmentStr = [jsonWriter stringWithObject:attachment]; 

    NSLog(@"Attachment String : %@", attachmentStr); 

    NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys: 
            @"Share on Facebook", @"user_message_prompt", 
            actionLinksStr, @"action_links", 
            attachmentStr, @"attachment", 
            nil]; 


    [facebook dialog:@"facebook.Stream.publish" 
      andParams:params 
      andDelegate:self]; 

} 
+0

好吧,我會嘗試....爲什麼我們必須給它鏈接兩次.. http://www.google.com作爲href在actionLinks和附件中 – 2011-05-10 13:43:25