2012-07-18 26 views
2

前幾天我有這個工作,你登錄到Facebook後,你可以點擊一個按鈕,FBFriendPickerViewController會出現一個所有Facebook朋友的列表。然而,突然間它開始崩潰,出現了一些奇怪的錯誤。這裏是我的代碼:FBFriendPickerViewController崩潰

- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url { 
    return [FBSession.activeSession handleOpenURL:url]; 
} 

- (BOOL)application:(UIApplication *)application 
     openURL:(NSURL *)url 
    sourceApplication:(NSString *)sourceApplication 
    annotation:(id)annotation { 
// attempt to extract a token from the url 
return [FBSession.activeSession handleOpenURL:url]; 
} 

在我家viewcontroller.m

// Pick Friends button handler 
- (IBAction)pickFriendsClick:(UIButton *)sender { 
// Create friend picker, and get data loaded into it. 
FBFriendPickerViewController *friendPicker = [[FBFriendPickerViewController alloc] init]; 
self.friendPickerController = friendPicker; 

[friendPicker loadData]; 

// Create navigation controller related UI for the friend picker. 
friendPicker.navigationItem.title = @"Pick Friends"; 

friendPicker.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] 
                initWithTitle:@"Done" 
                style:UIBarButtonItemStyleBordered 
                target:self 
                action:@selector(friendPickerDoneButtonWasPressed:)]; 
friendPicker.navigationItem.hidesBackButton = YES; 

// Make current. 
[self.navigationController pushViewController:friendPicker animated:YES]; 
} 


// Handler for when friend picker is dismissed 
- (void)friendPickerDoneButtonWasPressed:(id)sender { 

[self.navigationController popViewControllerAnimated:YES]; 

NSString *message; 

if (self.friendPickerController.selection.count == 0) { 
    message = @"<No Friends Selected>"; 
} else { 

    NSMutableString *text = [[NSMutableString alloc] init]; 

    // we pick up the users from the selection, and create a string that we use to update the text view 
    // at the bottom of the display; note that self.selection is a property inherited from our base class 
    for (id<FBGraphUser> user in self.friendPickerController.selection) { 
     if ([text length]) { 
      [text appendString:@", "]; 
     } 
     [text appendString:user.name]; 
    } 
    message = text; 
} 

[[[UIAlertView alloc] initWithTitle:@"You Picked:" 
          message:message 
          delegate:nil 
        cancelButtonTitle:@"OK" 
        otherButtonTitles:nil] 
show]; 
} 

最後這裏是錯誤消息時設置的pickFriendsClick方法按鈕被擊中我越來越:

2012-07-18 19:22:14.978 MeetUp [7213:1dc03] - [__ NSDictionaryI長度]:無法識別的選擇器發送到實例0xa9b7c70 2012-07-18 19:22:14.980 MeetUp [7213:1dc03] *終止應用程序由於未捕獲異常'NSInvalidArgumen tException」,原因: ' - [__ NSDictionaryI長度]:無法識別的選擇發送到實例0xa9b7c70' *第一擲調用堆棧: (0x1f626a2 0x13ede7e 0x1feda3d 0x1f522bc 0x1f5204e 0x1edd7d0 0x1ef5c98 0x1fcff7b 0x1ef5b42 0xde4d5a 0xe3ace8 0xe3ac93 0x20138 0x20718 0x410ffb 0x4110cf 0x3f9e1d 0x40a4db 0x3a79ba 0x14016be 0x25a53a6 0x259973c 0x2599550 0x2517690 0x25187fb 0x2518eb6 0x1f2b27e 0x1f2b1bd 0x1f08f22 0x1f086a4 0x1f0857b 0x1a7a913 0x1a7a798 0x358e7c 0x205d 0x1f85) 的libC++ abi.dylib:終止叫做拋出異常

再次,登錄和註銷的功能我已經實現是偉大的工作,這是現在工作不久,但現在給我帶來了麻煩。任何幫助將不勝感激。謝謝!

編輯: 好吧,我添加了這行代碼: [friendPicker setItemPicturesEnabled:NO]; 它現在可以工作,但顯然我沒有得到tableview單元格中的小縮略圖配置文件圖片。

我猜錯誤是因爲某種原因崩潰(SIGABRT),當它試圖加載配置文件圖片。如果有人知道爲什麼這會很好,特別是幾天前看到它的工作和加載圖片。

+0

我面臨同樣的問題,但我解決了這個問題。看到我的回答:http://stackoverflow.com/a/12257643/1553533 – 2012-09-04 06:07:56

+0

發給Facebook的錯誤,他們試圖關閉它,聲稱球沒有在他們的法院。請通過評論錯誤頁面來提供幫助: https://developers.facebook.com/bugs/340523759367074 – 2012-08-19 13:53:44

回答

-1

當我遇到相同的問題和tldr並且錯過了破解解決方案時,將您的內容添加到答案中。

堆棧跟蹤顯示在一行被拋出的異常:

[FBGraphObjectTableDataSource tableView:imageForItem:] 

人機工程學設置:

self.friendPickerController.itemPicturesEnabled = NO; 

似乎解決的問題,因爲它不會加載圖像。