UIViewController presentViewController crashing on ios 8

折月煮酒 提交于 2019-12-24 03:42:58

问题


Just got this error in our error logging system, been searching hi and low and can't seem to find any solution. Any help is appreciated. Here is the stacktrace.


回答1:


May be in your XCODE log you might have encountered this message

"Presenting view controllers on detached view controllers is discouraged ".

If yes then then try

[self.view.window.rootViewController presentViewController:myVC];

if this fails then make sure you call presentViewController:myVC on immediate presenting ViewController i.e. in your case what I see from trace - CalendarEventDetailViewController.

If that too fail then go backward - from where you are invoking VC which in turn use presentViewController, in iOS8 presentation layer has changed specially WRT UIAlert/UIActionSheet, and UIPopovers, if you are using any of these, create UIAlertController as a separate code track for iOS8 and use presentViewController:myVC on presenting ViewController.

I was facing similar issue where presentViewController: not working at all or disrupting presenting VC contents, in some situations dismissViewController was crashing. Using this approach I could fix it.



来源:https://stackoverflow.com/questions/25985313/uiviewcontroller-presentviewcontroller-crashing-on-ios-8

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!