2011-01-27 5 views
0

に私がABPeoplePickerを使用していると私は奇妙なクラッシュを取得しています。ユーザーが結果の候補を選び、検索フィールドを使用した後奇妙なクラッシュがABPeoplePicker

Assertion failure in -[UISearchDisplayController setActive:animated:], 
/SourceCache/UIKit/UIKit-1447.6.4/UISearchDisplayController.m:589 
2011-01-26 22:30:37.041 Watches[3784:307] 
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', 
reason: 'search contents navigation controller must not change between -setActive:YES and -setActive:NO 

クラッシュが発生しています。代理人のpeoplePickerNavigationController:shouldContinueAfterSelectingPerson:メソッド が、適切な情報と共に呼び出されます。デリゲート自体はモーダルコントローラなので、情報とコールは親に戻され、[self dismissModalViewControllerAnimated:NO]がコールされ、スタックをABPeoplePickerに戻してshouldContinueにNOを返します。親ルーチン(HIGHWATERマーク)にViewWillAppearにブレークポイントを設定

、私がどのように見えるのスタックを参照してください。

#0 -[RunnerListTableViewController viewWillAppear:] (self=0x1cc650, _cmd=0x33bc6b5a, animated=1 '\001') at /Users/hughmackworth/develop/Watches/RunnerListTableViewController.m:61 
#1 0x338e4fe4 in -[UINavigationController viewWillAppear:]() 
#2 0x3391a1e2 in -[UITabBarController viewWillAppear:]() 
#3 0x3396e280 in -[UIWindowController transition:fromViewController:toViewController:target:didEndSelector:]() 
#4 0x339dd36e in -[UIViewController _dismissModalViewControllerWithTransition:from:]() 
#5 0x339dc86e in -[UIViewController dismissModalViewControllerWithTransition:]() 
#6 0x339dc734 in -[UIViewController dismissModalViewControllerWithTransition:]() 
#7 0x339dc734 in -[UIViewController dismissModalViewControllerWithTransition:]() 
#8 0x339da668 in -[UIViewController dismissModalViewControllerAnimated:]() 
#9 0x000098c2 in -[RunnerListTableViewController runnerAddViewController:didAddRunners:] (self=0x1cc650, _cmd=0x29a86, runnerAddViewController=0x1dbf50, runners=0x45cb860) at /Users/hughmackworth/develop/Watches/RunnerListTableViewController.m:147 
#10 0x0000d4a8 in -[RunnerAddNewViewController save:] (self=0x1dbf50, _cmd=0x3530e35b, runner=0x45c8c20) at /Users/hughmackworth/develop/Watches/RunnerAddNewViewController.m:174 
#11 0x0000ce6c in -[RunnerAddNewViewController peoplePickerNavigationController:shouldContinueAfterSelectingPerson:] (self=0x1dbf50, _cmd=0x30549382, peoplePicker=0x35c87e0, person=0x455f2c0) at /Users/hughmackworth/develop/Watches/RunnerAddNewViewController.m:105 
#12 0x35eabaea in -[ABPeoplePickerNavigationController showCardForPerson:withMemberCell:animate:forceDisableEditing:personViewController:]() 
#13 0x35eab978 in -[ABMembersViewController showCardForPerson:withMemberCell:animate:]() 
#14 0x35eab826 in -[ABMembersController showCardForPerson:withMemberCell:animate:]() 
#15 0x35eab76a in -[ABMembersController abDataSource:selectedPerson:atIndexPath:withMemberCell:animate:]() 
#16 0x35eab70e in -[ABMembersFilteredDataSource tableView:didSelectRowAtIndexPath:]() 
#17 0x3390483a in -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:]() 
#18 0x339c4612 in -[UITableView _userSelectRowAtPendingSelectionIndexPath:]() 

私は、スタックがあるときに、それがクラッシュするまで、様々なルーチンは、ダウンウィンドウォッチ

// removed assertion handling routines>> 
4 UIKit    0x3394192b -[UISearchDisplayController setActive:animated:] + 986 
5 AddressBookUI  0x35ee65d7 -[ABMembersController cancelSearchingAnimated:] + 26 
6 AddressBookUI  0x35eab789 -[ABMembersController abDataSource:selectedPerson:atIndexPath:withMemberCell:animate:] + 80 
7 AddressBookUI  0x35eab70f -[ABMembersFilteredDataSource tableView:didSelectRowAtIndexPath:] + 82 
8 UIKit    0x3390483b -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 662 

アサーションクラッシュのマイナーな例外を除いて、すべて私にとって完全に正しいと思われます。

ABPeoplePicker内の検索コントローラとは関係がありませんし、アクティブになっている間に変更することもできません。これをどのように修正できるかわかりません。

補足として、時折エラーが発生します。CPSqliteStatementSendResults:中断されました検索ボックスに入力中です。これが何を意味するのか?

- (BOOL)peoplePickerNavigationController: (ABPeoplePickerNavigationController *)peoplePicker 
     shouldContinueAfterSelectingPerson:(ABRecordRef)person { 
    NSLog(@"got one from peoplepicker"); 
    if (ABRecordGetRecordType (person) == kABPersonType{ 

    Runner * newRunner = [Runner createRunnerFromAddrBookPerson: person]; 
    if (newRunner) { 
      self.nameTextView.text = newRunner.Name; 
      [self save:newRunner]; 
    } 
    return NO; //EDIT: MUST return YES or this will crash 
} 

- (void)save: (Runner *) runner { //send back last one added 
    [self.delegate runnerAddViewController:self 
          didAddRunners:[NSArray arrayWithObject:runner]]; 
} 

と親のデリゲートのコードは次のとおりです:

デリゲートのコードがあり、実験上の

- (void)runnerAddViewController:(RunnerAddNewViewController *)runnerAddViewController 
        didAddRunners:(NSArray *)runners { 
    if (runners) { 
      //stuff interacting with my model 
    } 
    // Dismiss the modal addRunner view controller 
    [self dismissModalViewControllerAnimated:YES]; 
} 

任意の手がかりや提案を実行するか、どこ見て? dismissModalVCは適切な場所から呼び出されていますか(2つのレベルを解除する)?

+0

peoplePickerNavigationControllerからBOOLを返さない理由はありますか:shouldContinueAfterSelectingPerson? –

+0

いいえ、それはありませんでしたが、それを短縮しようとすると削除されました。同じ問題のもっとクリーンなバージョンについては、http://stackoverflow.com/questions/4856728/を参照してください。アップルと一緒に作業しています。報告する。 – mackworth

答えて

2

これは実際のバグです。ユーザーが検索中の人物をクリックしたときに、ModalVCを二重にしてABPeoplePickerを閉じると、このクラッシュが発生します。幸いにも、単純な回避策があります:あなたの代理人のshouldContinueAfterSelectingPersonにYESを返します。あなたが同時にピッカーを却下すると、YESまたはNOを返すかどうかは重要ではありませんが、それは続行されませんが、NOはクラッシュする可能性があります。

-1

NSZombieEnabledを実行すると、アサーションの失敗が、リリースされた後にアクセスされているオブジェクトのエラーで置き換えられると思われます。

+0

残念ながら。私は以前に少し慣れていたので、私は通常これを有効にして実行しました(あなたの提案の後、私はNSZombieEnabledが正しく機能していることを確認するためにいくつかのテストを試みました)。その他の提案はありますか? – mackworth