Trong một trong các ứng dụng của tôi, tôi đang gọi chế độ xemController từ phương thức application didReceiveLocalNotification
. Trang tải thành công, nhưng nó cho thấy một cảnh báo như:Cảnh báo: cố gắng trình bày ViewController mà chế độ xem không nằm trong hệ thống phân cấp cửa sổ
Warning: Attempt to present <blankPageViewController: 0x1fda5190> on
<ViewController: 0x1fd85330> whose view is not in the window hierarchy!
Mã của tôi là như sau:
-(void) application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {
blankPageViewController *myView = [[blankPageViewController alloc]
initWithNibName:@"blankPageViewController" bundle: nil];
myView.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self.viewController presentViewController:myView animated:NO completion:nil];
}
Khi bạn đang gọi didReceiveLocalNotification? –
@Bhargavi: nó là một deligate được gọi khi nhận được thông báo địa phương. –