0

私はIOSでFacebookSDK3.0に取り組んでおり、developers.facebook.comを使用してFacebookキーを生成しました

my App ID/API Key 
165158463618789

ログインは正常に機能しますが、使用中FBFriendPickerViewControllerにクラッシュが発生します。

私は次のコードを使用しました:

   FBFriendPickerViewController *friendPicker = [[FBFriendPickerViewController alloc]     init];
   self.friendPickerController = friendPicker;

   [friendPicker loadData];
   friendPicker.navigationItem.title = @"Pick Friends";
   friendPicker.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] 
                                                  initWithTitle:@"Done" 
                                                  style:UIBarButtonItemStyleBordered 
                                                  target:self 
                                                                 action:@selector(doneButtonWasPressed:)];
    friendPicker.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] 
                                                 initWithTitle:@"Cancel" 
                                                 style:UIBarButtonItemStyleBordered 
                                                 target:self 
                                                 action:@selector(cancelButtonWasPressed:)];
 [self.navigationController pushViewController:friendPicker animated:YES];

そして、私はクラッシュの理由を得ています

-[__ NSCFDictionary length]:認識されないセレクターがインスタンス0x3024d0に送信されました2012-08-07 11:13:12.430 IndusPatient [784:707] *キャッチされない例外'NSInvalidArgumentException'によるアプリの終了、理由:'-[__NSCFDictionary length]:認識されないセレクターインスタンス0x3024d0' *に送らまずスローコールスタック:(0x321a888f 0x341fe259 0x321aba9b 0x321aa915 0x32105650 0x320f1f19 0x3210e2cd 0x3210d1ad 0x3210e279 0x37a73fb1 0x37a73e8b 0x1a9735 0x1a9bbf 0x31c2fefb 0x31c2efd9 0x31c2e763 0x31bd2f37 0x321071fb 0x33e6baa5 0x33e6b6bd 0x33e6f843 0x33e6f57f 0x33e674b9 0x3217cb1b 0x3217ad57 0x3217b0b1 0x320fe4a5
0x320fe36d 0x31255439 0x31bfdcd5 0xcdd2b 0xcdccc)例外をスロー呼ばTERMINATE

4

1 に答える 1

0

私もこの問題に直面していましたが、今では解決しました。

次の方法/コードを使用して、問題を解決しました

AppDelegate で

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

この行を追加

[FBFriendPickerViewController class];

viewController ヘッダー ファイルに追加します

@property (retain, nonatomic) FBFriendPickerViewController *friendPickerController;

viewController 実装ファイルに関数を追加します

if (self.friendPickerController == nil) {
    // Create friend picker, and get data loaded into it.
    self.friendPickerController = [[FBFriendPickerViewController alloc] init];
    self.friendPickerController.title = @"Pick Friends";
    self.friendPickerController.delegate = self;
}

[self.friendPickerController loadData];
[self.friendPickerController clearSelection];

[self presentModalViewController:self.friendPickerController animated:YES];

だから私はナビゲーションコントローラースタイルのプログラミングを使用していません。

于 2012-09-04T06:04:52.547 に答える