当我替换完这俩个操作后尝试运行app,发现会报如下的异常: Terminating app due to uncaught exception ‘UIApplicationInvalidInterfaceOrientation’, reason: ‘Supported orientations has no common orientation with the application, and shouldAutorotate is returning YES’
经查发现导致此异常的原因是app再info.plist中指定的屏幕朝向没有portrait,也就是只支持landscape横屏,但是app集成了 Game Center应用,而Game Center触发的登录界面只支持竖屏显示(这点有开发帐号的朋友可以到苹果官方开发论坛上看下,有个苹果官方人员发的证实贴,由于现阶段的NDA就不转 了),解决这个问题的方法就是再应用的delegate中加入如下回调: