Xcode 7:"supportedInterfaceOrientations"的实现中返回类型冲突:"UIInterfaceOrientationMask"与"NSUInteger" [英] Xcode 7: Conflicting return type in implementation of 'supportedInterfaceOrientations': 'UIInterfaceOrientationMask' vs 'NSUInteger'

查看:65
本文介绍了Xcode 7:"supportedInterfaceOrientations"的实现中返回类型冲突:"UIInterfaceOrientationMask"与"NSUInteger"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I just updated my Xcode to version 7.0 (7A220) and, unfortunately, I got several problems. Let me list those:

  1. 现在images.xcassets仅对1x,2x,3x提供支持.Retina 4 2x框对于现有图像仍然存在,但是您无法添加具有Retina支持的新图像集.我该如何处理?
  2. 我的应用不再适用,适用于iPhone 4 *和5 *.图像消失了:我只能看到文本(实际上只有启动屏幕图像有效).我猜想我可能对iPhone 5 *有问题(不再支持Retina 4),但是我对iPhone 4 *感到惊讶(我曾经为每个图像创建-480版本并放在2x盒子内).同样的问题:我该如何处理?
  3. 我收到了几条警告:第一个警告是关于更新为推荐的项目设置"(完成但未更改).
  1. Now the images.xcassets provides support only for 1x, 2x, 3x. The Retina 4 2x box still exists for existing images but you cannot add new sets with Retina support. How can I handle that ?
  2. My app doesn't work anymore for iPhone 4* and 5*. Images are disappeared: I can see only text (actually only launchscreen image works). I guessed that I might have had problem with iPhone 5* (No longer support for Retina 4) but I'm surprised about iPhone 4* (I used to create a -480 version of each image and put inside the 2x box). Here the same question: how can I handle that ?
  3. I got several warnings: the first one was about "Update to recommended project settings" (Done but nothing changed).

第二个是在运行时:

../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'

有人可以帮助我吗?我正在使用带有SpriteKit的Xcode 7.0(7A220)开发我的应用.

Can someone help me ? I'm using Xcode 7.0 (7A220) with SpriteKit for develop my app.

推荐答案

这是我解决这些问题的方法:

This is how I solved those problems:

1)苹果似乎不再支持Retina4.这意味着需要将iPhone 4 *,iPhone 5 *和iPhone 6放在@ 2x框内.处理全屏图像肯定比较棘手,因此您必须以编程方式处理所有图像.

1) Apple seems doesn't support anymore Retina 4. This means that iPhone 4*, iPhone 5* and iPhone 6 need to be placed inside the @2x box. Surely it's trickier to handle fullscreen images, therefore you have to handle all programmatically.

2)我通过将所有图像设置为"通用"而不是特定设备(iPhone 4S和5)解决了此问题.iPhone6S不知道为什么,但即使特定设备也可以使用iPhone 6.无论如何,我是否已经通知Apple了.

2) I fixed this issue by setting all of the images to "Universal" instead of specific device (iPhone 4S and 5. Don't know why but iPhone 6 worked even with specific device). Anyways, bug or not I've notified Apple.

3a)方法 UIInterfaceOrientationMask 的返回类型已更改,因此,如果收到诸如 ../ViewController.m:41:1的警告:冲突的返回类型在实现中'supportedInterfaceOrientations':'UIInterfaceOrientationMask'(aka'enum UIInterfaceOrientationMask')vs'NSUInteger'(aka'unsigned int'),您需要替换返回类型.

3a) The return type of the method UIInterfaceOrientationMask has changed, so if you get a warning such as ../ViewController.m:41:1: Conflicting return type in implementation of 'supportedInterfaceOrientations': 'UIInterfaceOrientationMask' (aka 'enum UIInterfaceOrientationMask') vs 'NSUInteger' (aka 'unsigned int') you need to replace the return type.

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

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

(感谢 Rainer Schwarze )

3b)升级似乎在自定义框架上下文中造成了问题(如果我错了,请纠正我),可以通过从构建设置中删除引用来解决.

3b) It seems the upgrade created issues in custom framework contexts (correct me if I'm wrong), this can be solved by removing the references from Build Settings.

希望这会有所帮助!

这篇关于Xcode 7:"supportedInterfaceOrientations"的实现中返回类型冲突:"UIInterfaceOrientationMask"与"NSUInteger"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆