問題:在調用pushViewController的時候程序崩潰
應用有這樣一個功能,點擊推送通知可以跳轉到對應的一個消息界面,
但這個界面是從另一個Controller Push進來的,所以,問題來了,當我已經在APP中手動打開了這個消息界面時,我再去點擊通知欄的消息,這時會再次調用這個push方法,于是程序就會崩潰,
報錯:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Pushing the same view controller instance more than once is not supported 。。。。'
所以在push之前先做個判斷:
if(![self.navigationController.topViewController isKindOfClass:[_pageController class]]) {
[self.navigationController pushViewController:_pageController animated:YES];
}
問題解決??????