2011-01-27 3 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를 반환합니다. 이 충돌 할 때까지 스택이 때

#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:]() 

그때, 다양한 루틴이 아래로 바람 시계 :

합니다 (highwater 마크), I 모습 스택을 참조 부모 루틴에 ViewWillAppear에 중단 점을 설정 아래 :

// 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가 올바른 위치에서 호출되는 것입니까 (두 단계를 닫으려고합니까?)?

+0

peoplePickerNavigationController에서 BOOL을 반환하지 않는 이유가 있습니까? shouldContinueAfterSelectingPerson? –

+0

아니, 아니,하지만 방금 그것을 단축하려고 삭제되었습니다. 같은 문제에 대해 훨씬 더 깨끗한 버전을 보려면 http://stackoverflow.com/questions/4856728/을 참조하십시오. 지금 애플과 함께 일하기; 다시보고 할 것입니다. – mackworth

답변

2

이것은 실제 버그입니다. 사용자가 검색중인 사용자를 클릭 할 때 ABPeoplePicker로 두 번 ModalVC를 닫으면이 충돌이 발생합니다. 다행히도 간단한 해결 방법이 있습니다. 대리인의 shouldContinueAfterSelectingPerson에 YES를 반환합니다. 피커를 동시에 닫을 때 YES 또는 NO를 반환하는지 여부는 중요하지 않지만 계속하지는 않지만 NO는 중단되고 YES는 그렇지 않습니다.

-1

NSZombieEnabled를 실행하면 어설 션 오류가 해제 된 후 일부 개체에 액세스 중이라는 오류가 발생합니다.

+0

불행히도. 조금 전에, 내가 정상적으로 그걸로 실행 (그리고 당신의 제안 후, NSZombieEnabled 제대로 작동하는지 확인하기 위해 몇 가지 테스트를 시도). 다른 제안? – mackworth