Xcode 7:'supportedInterfaceOrientations'实现中的返回types冲突:'UIInterfaceOrientationMask'vs'NSUInteger'
我只是更新了我的Xcode到版本7.0(7A220),不幸的是,我有几个问题。 让我列出这些:
- 现在这些images.xcassets 仅支持1x,2x,3x。 视网膜4 2x盒子仍然存在现有的图像,但你不能添加视网膜支持新的设置。 我该如何处理?
- 我的应用程序不再适用于iPhone 4 *和5 *。 图像消失:我只能看到文字(实际上只有启动屏幕图像的作品)。 我猜想,我可能有问题的iPhone 5 *(不再支持Retina 4),但我很惊讶iPhone 4 *(我曾经创build每个图像-480版本,并放在2x框内)。 这里同样的问题:我该如何处理?
- 我有几个警告:第一个是关于“更新到推荐的项目设置”(完成,但没有改变)。
第二个是在运行期间:
../ViewController.m:41:1: Conflicting return type in implementation of 'supportedInterfaceOrientations': 'UIInterfaceOrientationMask' (aka 'enum UIInterfaceOrientationMask') vs 'NSUInteger' (aka 'unsigned int')
第三个也在运行时:
(null): Directory not found for option '-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.0.sdk/Developer/Library/Frameworks'
有人能帮我吗 ? 我使用Xcode 7.0(7A220)和SpriteKit来开发我的应用程序。
这就是我解决这些问题的方法:
1)苹果似乎不支持Retina 4.这意味着iPhone 4 *,iPhone 5 *和iPhone 6需要放置在@ 2x盒子里。 处理全屏图像肯定是比较棘手的,因此你必须通过编程来处理所有的图像。
2)我解决了这个问题,将所有的图像设置为“ 通用 ”,而不是特定的设备(iPhone 4S和5)。不知道为什么,但iPhone 6即使使用特定的设备)。 无论如何,错误与否我已经通知苹果。
3a)方法UIInterfaceOrientationMask
的返回types已经改变,所以如果你得到警告例如../ViewController.m:41:1: Conflicting return type in implementation of 'supportedInterfaceOrientations': 'UIInterfaceOrientationMask' (aka 'enum UIInterfaceOrientationMask') vs 'NSUInteger' (aka 'unsigned int')
你需要replace返回types。
// Before upgrading - (NSUInteger)supportedInterfaceOrientations { ... } // After upgrading - (UIInterfaceOrientationMask)supportedInterfaceOrientations { ... }
(感谢Rainer Schwarze )
3b)看起来升级在自定义框架上下文中创build了问题(纠正我,如果我错了),这可以通过从生成设置中删除引用来解决。
希望这可能会有所帮助!
尝试这个界面方向警告:
#if __IPHONE_OS_VERSION_MAX_ALLOWED < 90000 - (NSUInteger)supportedInterfaceOrientations #else - (UIInterfaceOrientationMask)supportedInterfaceOrientations #endif { return UIInterfaceOrientationMaskPortrait; }
我可以给出这个警告的提示:
在'supportedInterfaceOrientations'的实现中有冲突的返回types:'UIInterfaceOrientationMask'(aka'enum UIInterfaceOrientationMask')vs'NSUInteger'(aka'unsigned int')
您需要用方法supportedInterfaceOrientations
UIInterfaceOrientationMask
replace返回typesNSUInteger
。 返回types已从iOS8更改为iOS9:
- (UIInterfaceOrientationMask) supportedInterfaceOrientations { ... }
编辑:
最后,我最终使用这之前,使用types的.m
文件的实现部分:
// Make compilable on iOS8: #if __IPHONE_OS_VERSION_MAX_ALLOWED < 90000 #define UIInterfaceOrientationMask NSUInteger #endif
这将条件保留在一个位置,并且一旦丢弃iOS8支持,则可以轻松地移除片段。