2011-10-24 2 views
0

私は私のアプリにいくつかのアドレス帳機能を追加しようと、私は、このエラーメッセージが表示されます、ボタンの既存に追加」をタップした後二回目です。iOS AddressBookUI - '既存の連絡先のユーザーピッカーに複数のアドレスを追加しようとしていません。'

で*アサーション障害 - [ABPersonViewControllerHelper presentPeoplePickerNavigationControllerForAddToContacts:]、/SourceCache/AddressBookUI_Sim/AddressBookUI-1118/ABPersonViewControllerHelper.m:2574 2011-10-24 20:41:11.960 locato [4576:11603] キャッチされない例外により「NSInternalInconsistencyException」にアプリを終了が、その理由は:「1は、既存の連絡先の人々ピッカーに追加する以上のことを示そうとすべきではありません。」

私はViewControllerをして​​持っている例外をスロー (0x152e052 0x16bfd0a 0x14d6a78 0xefd2db 0x9d674 0x152fe72 0xd0eb8 0xc8141 0xb9e2f 0x60471d 0x604952 0xe8c86d 0x1502966 0x1502407 0x14657c0 0x1464db4 0x1464ccb 0x17eb879 0x17eb93e 0x574a9b 0x22d9 0x2255) と呼ばTERMINATE: まずスローコールスタックメインビューコントローラ上でアドレス帳の「モーダル」ビューを表示する。 (そうでなければ、スライディングトランジションが得られず、このエラーが発生します)。右行っていない何イムにいくつかの明確化を得ることを望ん

@implementation UIViewController (cancelButton) 
- (void)peoplePickerNavigationControllerDidCancel:(ABPeoplePickerNavigationController *)peoplePicker; 
{ 
    UIResponder *responder = self; 
    while (responder && ![responder isKindOfClass:[mainViewController class]]) { 
     responder = [responder nextResponder]; 
    } 

    [(UIViewController *)responder dismissModalViewControllerAnimated:YES]; 

} 
@end 

@implementation UINavigationController (modal) 
- (void) presentModalViewController:(UIViewController *)screen animated:(BOOL)animated 
{ 
    UIResponder *responder = self; 
    while (responder && ![responder isKindOfClass:[mainViewController class]]) { 
     responder = [responder nextResponder]; 
    } 
    if ([screen isKindOfClass:[ABPeoplePickerNavigationController class]]) { 
     ABPeoplePickerNavigationController *scr = screen; 
     scr.peoplePickerDelegate = self; 
     [scr release]; 
    } 
    [(UIViewController *)responder presentModalViewController:screen animated:YES]; 
} 

イム:私はこれらのメソッドをオーバーライドしています!

おかげで、あなたは再び試みる前に変更される可能性が デビッド

答えて

0

2つのこと:両方whileループの後

  • は、その応答を確認するのViewController

  • を却下または提示行う前にnilではありません

    このscrを使用する代わりにscreen.peoplePickerDelegate = self;を割り当てることはできませんか?

+0

レスポンダーは役に立たなかったので、主なviewcontrollerです。イムは、「SCR」オブジェクトを使用していないときには、画面ではなくABPeoplePickerNavigationControllerののUIViewControllerであると考えているため、コンパイラは私にエラーを与える..私はこの問題は、イムはABPeoplePickerNavigationControllerを却下するとき何かが欠落していることだと思います..しかし、私は数字をカントそれは何ですか.. – david

+0

2574行にABPersonViewControllerHelper.mを表示できますか?もう一つは、 '[screen setPeoplePickerDelegate:self];'は動作しますか? –

+0

私はABPersonViewControllerHelper.mをAddressBookUIフレームワーク内に表示していません。そして、残念ながら '[screen setPeoplePickerDelegate:self];は、コンパイラがまだその画面がuiviewcontrollerだと思っているために動作しません。 :( – david

関連する問題