Ios Xcode 7:在';的实现中存在冲突的返回类型;支持接口方向';:';UIInterfaceOrientationTask';vs';整数';

Ios Xcode 7:在';的实现中存在冲突的返回类型;支持接口方向';:';UIInterfaceOrientationTask';vs';整数';,ios,iphone,sprite-kit,xcode7,Ios,Iphone,Sprite Kit,Xcode7,我刚刚将Xcode更新到7.0版(7A220),不幸的是,我遇到了几个问题。让我列出: 现在images.xcsets仅为1x、2x、3x提供支持。对于现有图像,Retina 4 2x框仍然存在,但您无法添加具有Retina支持的新集。我怎么办 我的应用程序不再适用于iPhone 4*和5*。图像消失:我只能看到文本(实际上只有launchscreen图像工作)。我猜我可能对iPhone5*(不再支持Retina 4)有问题,但我对iPhone4*感到惊讶(我曾为每张图像创建-480版本,并将其

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

  • 现在images.xcsets仅为1x、2x、3x提供支持。对于现有图像,Retina 4 2x框仍然存在,但您无法添加具有Retina支持的新集。我怎么办
  • 我的应用程序不再适用于iPhone 4*和5*。图像消失:我只能看到文本(实际上只有launchscreen图像工作)。我猜我可能对iPhone5*(不再支持Retina 4)有问题,但我对iPhone4*感到惊讶(我曾为每张图像创建-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'
    
    第三个也在运行时:

    ../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一起用于开发我的应用程序。

    我可以给出以下警告提示:

    的实现中存在冲突的返回类型 “支持的接口方向”:“UIInterfaceOrientationTask”(又名 “enum UIInterfaceOrientationMask”)与“NSUInteger”(又名“unsigned” int')

    对于方法
    支持的接口方向
    ,需要将返回类型
    NSUInteger
    替换为
    UIInterfaceOrientationMask
    。返回类型已从iOS8更改为iOS9:

    - (UIInterfaceOrientationMask) supportedInterfaceOrientations
    {
        ...
    }
    
    编辑:

    最后,我在使用类型的
    .m
    文件的实现部分之前使用了这个:

    // Make compilable on iOS8:
    #if __IPHONE_OS_VERSION_MAX_ALLOWED < 90000
    #define UIInterfaceOrientationMask NSUInteger
    #endif
    
    //使其在iOS8上可编译:
    #如果IPHONE操作系统版本最大允许值<90000
    #定义UIInterfaceOrientationTaskInteger
    #恩迪夫
    

    这将使条件保留在一个位置,一旦iOS8支持被删除,代码段就可以轻松删除。

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

    1) 苹果似乎不再支持视网膜4了。这意味着iphone4*、iphone5*和iphone6需要放在@2x框中。当然,处理全屏图像更为棘手,因此您必须以编程方式处理所有图像

    2) 我通过将所有图像设置为“Universal”而不是特定设备(iPhone4S和5。不知道为什么,但iPhone6即使在特定设备上也能工作)解决了这个问题。不管怎样,不管有没有bug,我已经通知苹果了

    3a)方法
    UIInterfaceOrientationTask
    的返回类型已更改,因此如果您收到诸如
    。/ViewController.m:41:1:在实现“supportedInterfaceOrientations”时返回类型冲突:“UIInterfaceOrientationTask”(又名“enum UIInterfaceOrientationTask”)与“NSInteger”(又名“unsigned int”)的比较
    您需要更换退货类型

    // Before upgrading
    - (NSUInteger)supportedInterfaceOrientations
    {
        ...
    }
    
    // After upgrading
    - (UIInterfaceOrientationMask)supportedInterfaceOrientations
    {
        ...
    }
    
    (感谢Rainer Schwarze

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


    希望这能有所帮助

    请尝试以下界面方向警告:

    #if __IPHONE_OS_VERSION_MAX_ALLOWED < 90000  
    - (NSUInteger)supportedInterfaceOrientations  
    #else  
    - (UIInterfaceOrientationMask)supportedInterfaceOrientations  
    #endif  
    {
        return UIInterfaceOrientationMaskPortrait;
    }
    
    #如果允许的IPHONE操作系统版本最大值<90000
    -(整数)支持的接口方向
    #否则
    -(UIInterfaceOrientationTask)支持接口方向
    #恩迪夫
    {
    返回UIInterfaceOrientationMaskPortrait;
    }
    
    一个问题中包含的问题太多。这应该是三个问题,;没有有效的方法来回答这个问题。(2)中的信息太模糊:“不再工作”是没有意义的。第(1)号的问题也是一样,图像资产!非常感谢你的回答,我被这些问题困住了,这真的很有帮助。但我不确定你是如何做到第二点的。如何将图像设置为通用?你能更详细地解释一下吗?对不起,我的英语不好,提前谢谢!谢谢分享:)应该被接受,因为它允许向后编译兼容性。