UIScreen mainScreen in Xcode 8

坚强是说给别人听的谎言 提交于 2019-12-04 16:52:35

Class properties are an Objective-C feature available in Xcode 8 and it looks like mainScreen has been refactored in the API to be one. The error of mainScreen being non-public seems like a misleading error/bug on Apple's end, but if you use the class property accessor the error might go away.

The good news is, since it is a language feature, not iOS version specific, you should be able to adopt class property syntax, i.e. UIScreen.mainScreen, and continue to support iOS 8-9.

p.s. mainBundle is also now a class property, so if you use that, it's possible it would trigger the same error.

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