【问题标题】:How to fix "error: expected ']' [UIScreenmainScreen].applicationFrame];"?如何修复“错误:预期的']' [UIScreenmainScreen].applicationFrame];”?
【发布时间】:2018-07-13 18:15:26
【问题描述】:
       UIView *view = [[UIView alloc] initWithFrame
        [UIScreenmainScreen].applicationFrame];

        Compiling XXRootViewController.m (arm64)…
        XXRootViewController.m:9:1: error: expected ']'
        [UIScreenmainScreen].applicationFrame];
        ^
         1 error generated.

有人知道如何解决这个问题吗?我尝试了许多不同的方法来创建它,并且我已经导入了成功创建所需的所有文件。

【问题讨论】:

    标签: ios objective-c theos


    【解决方案1】:

    如果有人想知道,这就是我修复以下错误的方法。

    UIView *view = [[[UIView alloc] initWithFrame:[[UIScreen mainScreen]applicationFrame]] autorelease];
    

    【讨论】:

    • autorelease?请帮自己一个大忙,改用 ARC。
    • 我正在使用theos(一个用于越狱设备的命令行工具,允许您在没有xcode的情况下制作应用程序)。在 github.com/theos 上查看
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-02-04
    • 2020-02-16
    • 1970-01-01
    相关资源
    最近更新 更多