Ios 警告:调用通知时尝试显示模式

Ios 警告:调用通知时尝试显示模式,ios,iphone,Ios,Iphone,我正在使用以下命令调用viewDidAppear上的presentModal方法: 当picker出现时,它给了我设备和模拟器上的警告 警告:在演示过程中,尝试在UINavigationController:0x90ad610上演示PickerModalViewController:0x10ec7280 警告告诉你,出了什么问题。 要避免此警告,您可以使用UINavigationController的委托属性并实现 -voidnavigationController:UINavigationCo

我正在使用以下命令调用viewDidAppear上的presentModal方法:

当picker出现时,它给了我设备和模拟器上的警告


警告:在演示过程中,尝试在UINavigationController:0x90ad610上演示PickerModalViewController:0x10ec7280

警告告诉你,出了什么问题。 要避免此警告,您可以使用UINavigationController的委托属性并实现

-voidnavigationController:UINavigationController*navigationController didShowViewController:UIViewController*viewController 动画:BOOLanimated

[[NSNotificationCenter defaultCenter] addObserver:self         
                                             selector:@selector(presentModal)         
                                                 name:@"xxxxxxx"         
                                               object:nil];

-(void)presentModal 
{
    PickerModalViewController *pickerModalViewController = [Appdelegate.window.rootViewController.storyboard instantiateViewControllerWithIdentifier:@"PickerModalViewController"];

    pickerType = 2;
    pickerModalViewController.choices = self.localArray;
    pickerModalViewController.buttonTag = pickerType;

    pickerModalViewController.delegate = self;
    self.pickerPresenter = self;

    if (self.pickerPresenter) {
        [self.pickerPresenter presentViewController:pickerModalViewController animated:YES completion:nil];
    }
}