【问题标题】:Blank screen when I build my app on XCode 7.1 for iOS 9.1当我在 XCode 7.1 for iOS 9.1 上构建我的应用程序时出现空白屏幕
【发布时间】:2015-10-28 08:53:55
【问题描述】:

我有用于构建应用程序的应用程序压缩包,但它们的文件非常过时。我已经修复了应用程序中的大部分问题,但有一个问题我不明白。问题在于以下代码:

- (NSUInteger)application:(UIApplication*)application supportedInterfaceOrientationsForWindow:(UIWindow*)window
{
    // iPhone doesn't support upside down by default, while the iPad does.  
    // Override to allow all orientations always, and let the root view     
    // controller decide what's allowed 
    //(the supported orientations mask gets intersected).
    NSUInteger supportedInterfaceOrientations = 
        (1 << UIInterfaceOrientationPortrait) | 
        (1 << UIInterfaceOrientationLandscapeLeft) | 
        (1 << UIInterfaceOrientationLandscapeRight) | 
        (1 << UIInterfaceOrientationPortraitUpsideDown);

    return supportedInterfaceOrientations;
}

我在构建它时遇到的错误是:

/Users/username/Desktop/Appfolder/platforms/ios/Appname/Classes/AppDelegate.m:138:1:'application:supportedInterfaceOrientationsForWindow:'的实现中的返回类型冲突:'UIInterfaceOrientationMask'(又名'enum UIInterfaceOrientationMask' ) vs 'NSUInteger' (又名'unsigned long')

【问题讨论】:

    标签: ios objective-c iphone xcode


    【解决方案1】:

    尝试将第一行更改为:

    - (UIInterfaceOrientationMask)application:(UIApplication*)application supportedInterfaceOrientationsForWindow:(UIWindow*)window
    

    并查看是否可以修复警告。基本上唯一的改变是将返回值的类型从NSUInteger更改为UIInterfaceOrientationMask

    事实上,如果这样写,这个方法可能看起来更整洁:

    - (UIInterfaceOrientationMask)application:(UIApplication*)application supportedInterfaceOrientationsForWindow:(UIWindow*)window
    {
        // iPhone doesn't support upside down by default, while the iPad does.
        // Override to allow all orientations always, and let the root view
        // controller decide what's allowed
        //(the supported orientations mask gets intersected).
        NSUInteger supportedInterfaceOrientations =
            UIInterfaceOrientationMaskPortrait |
            UIInterfaceOrientationMaskLandscapeLeft |
            UIInterfaceOrientationMaskLandscapeRight |
            UIInterfaceOrientationMaskPortraitUpsideDown;
    
        return supportedInterfaceOrientations;
    }
    

    【讨论】:

    • 您好,感谢您的帮助,错误已消除,但仍有白色空白屏幕,我认为应用程序上还有其他问题。
    • 您在原始问题中收到的警告不会导致空白屏幕。
    • 主要问题是插件似乎已经过时了。我现在正在更新科尔多瓦插件。再次感谢。
    猜你喜欢
    • 2018-08-25
    • 2020-11-16
    • 1970-01-01
    • 2018-07-16
    • 1970-01-01
    • 1970-01-01
    • 2021-10-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多