数日前、Facebook にログインした後、ボタンをクリックすると FBFriendPickerViewController が表示され、Facebook のすべての友達のリストが表示されます。しかし、突然、いくつかの奇妙なエラーでクラッシュし始めました。これが私のコードです:
- (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 に送信されましたexception 'NSInvalidArgumentException', reason: '-[__NSDictionaryI length]: unrecognized selector sent to instance 0xa9b7c70' * First throw call stack: (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 0x208d++ lib1a7a913 0x1a7a798 0x358e7c 0x208d++ をスローする lib1abdy++ 0 をスローします。
繰り返しますが、私が実装したログインおよびログアウト機能はうまく機能しています。これは少し前までは機能していましたが、今では問題が発生しています。どんな助けでも大歓迎です。ありがとう!
編集: わかりましたので、次のコード行を追加しました: [friendPicker setItemPicturesEnabled:NO]; 現在は機能していますが、明らかに、テーブルビューのセルに小さなサムネイルのプロフィール写真が表示されません。
エラーは、プロファイル画像を読み込もうとしているときに、何らかの理由でクラッシュ (SIGABRT) することだと思います。特に、数日前に機能して写真をロードしたことを見て、これが素晴らしい理由を誰かが知っていれば.