2013-06-04 36 views
1

我試圖使用Facebook的SDK從IOS發送好友請求從IOS發送好友請求,使用Facebook SDK

這裏是我的代碼

NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys: 
            @"My Title", @"title", 
            @"Come check out my app.", @"message", 
            FrienduserId, @"id", 
            nil]; 


    [FBWebDialogs presentDialogModallyWithSession:appDelegate.session dialog:@"friends" parameters:[params mutableCopy] handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error) { 
     if (error) { 
      NSLog(@"%@",error); 
     } 
     else 
     { 
      NSLog(@"done"); 
     } 
    }]; 

其要價確認的消息(參見friendrequest.png) ,點擊確認按鈕後,它會顯示錯誤

enter image description here

「對不起,出事了,我們在得到這個固定的,只要我們能工作「(請參閱error.png)

enter image description here

任何一個可以幫助我,請

Facebook的SDK版本3.5.1和版本的Xcode 4.6

+0

嘗試在參數show_error中添加值爲true的參數,如下所示:https://developers.facebook.com/docs/reference/dialogs/#common(我認爲它應該在iOS下工作) ) – CBroe

回答

0

試着改變你的代碼如下:

NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys: 
            @"My Title", @"title", 
            @"Come check out my app.", @"message", 
            FrienduserId, @"id", 
            nil];  
[FBWebDialogs presentDialogModallyWithSession:appDelegate.session dialog:@"friends" parameters:[params mutableCopy] handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error)]; 
      if (error) { 
       NSLog(@"%@",error); 
      } 
      else 
      { 
       NSLog(@"done"); 
      } 

這應該至少解決您的部分問題。可能還有其他問題,我只是修正了你的語法。

+0

嗨,它提供錯誤附近「如果(錯誤){」作爲「使用未聲明的標識符錯誤'」。 – Ramesh

+0

我不知道。截圖併發佈一個鏈接 –

+0

@SantaClaus:appdelegate.sessiion意味着什麼 – Seeker