ios - Xcode 7 : Conflicting return type in implementation of 'supportedInterfaceOrientations' : 'UIInterfaceOrientationMask' vs 'NSUInteger'

标签 ios iphone sprite-kit xcode7

我刚刚将我的 Xcode 更新到版本 7.0 (7A220),不幸的是,我遇到了几个问题。让我列出这些:

  1. 现在 images.xcassets 支持 1x、2x、3x。现有图像的 Retina 4 2x 框仍然存在,但您无法添加具有 Retina 支持的新集。我该如何处理?
  2. 我的应用不再适用于 iPhone 4* 和 5*。图像消失了:我只能看到文本(实际上只有启动屏幕图像有效)。我猜我可能在使用 iPhone 5*(不再支持 Retina 4)时遇到问题,但我对 iPhone 4* 感到惊讶(我曾经为每个图像创建一个 -480 版本并放入 2x 框内)。同样的问题:我该如何处理?
  3. 我收到了几个警告:第一个是关于“更新到推荐的项目设置”(完成但没有任何改变)。

第二个是在运行时:

../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) Apple 似乎不再支持 Retina 4。这意味着 iPhone 4*、iPhone 5* 和 iPhone 6 需要放在 @2x 框内。处理全屏图像当然更棘手,因此您必须以编程方式处理所有图像。

2) 我通过将所有图像设置为“通用”而不是特定设备解决了这个问题(iPhone 4S 和 5。不知道为什么,但 iPhone 6 即使在特定设备上也能正常工作) .无论如何,无论是否有错误,我已经通知了 Apple。

3a) UIInterfaceOrientationMask 方法的返回类型已更改,因此如果您收到诸如 ../ViewController.m:41:1: Conflicting return type in implementation of 的警告'supportedInterfaceOrientations':'UIInterfaceOrientationMask'(又名'enum UIInterfaceOrientationMask')与'NSUInteger'(又名'unsigned int')您需要替换返回类型。

// Before upgrading
- (NSUInteger)supportedInterfaceOrientations
{
    ...
}

// After upgrading
- (UIInterfaceOrientationMask)supportedInterfaceOrientations
{
    ...
}

(感谢 Rainer Schwarze)

3b) 升级似乎在自定义框架上下文中产生了问题(如果我错了请纠正我),这可以通过删除build设置中的引用来解决。

Items to remove

希望这对您有所帮助!

关于ios - Xcode 7 : Conflicting return type in implementation of 'supportedInterfaceOrientations' : 'UIInterfaceOrientationMask' vs 'NSUInteger' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32671436/

相关文章:

swift - 检查 SKSpriteNode 何时经过某个点或线

ios - 在 xCode 中解析嵌套的 NSDictionary 和 NSArray 数据

iphone - 在 Objective-C 中取消 UILocalnotification 的步骤

swift - 在节点的右边缘而不是中心旋转 SKSpriteNode

iphone - 应用程式无法使用行动网路连线(3G)

iphone - Xcode 4.2。运行时卡住 "Attaching to myapp"

objective-c - 除了我的玩家以外的物理实体在碰撞时不会调用 didBeginContact

iOS:如何从 CoreLocation 坐标设置 GMSCoordinateBounds?

ios - 如何在不指定 UUID 的情况下扫描 iBeacon 信号?

ios - 获取表格 View 中点击的单元格(附件按钮)的位置