【问题标题】:Travis error for @available command in iOSiOS 中 @available 命令的 Travis 错误
【发布时间】:2019-12-04 15:44:03
【问题描述】:

我遇到了 Travis 和 Fastlane(健身房)的问题,但我还没有找到解决方法。

我通过 Cocoapods 添加了一个新的依赖项,并且在我的设备上一切正常,但是当我通过 Travis 运行它时遇到以下错误:

no known class method for selector 'labelColor' no known class method for selector 'systemBackgroundColor' no known class method for selector 'secondarySystemBackgroundColor'

在这些地方,有一个 @available 宏,因为它们在 13 以下的 iOS 版本中不存在。

if (@available(iOS 13.0, *)) {
        return [UIColor labelColor];
    } else if ([self isDarkColor:[self getBackgroundColor:config]]) {
        return [UIColor whiteColor];
    }

那么为什么它在 Travis 中失败了?又该如何避免呢?

我现在所做的是在yaml 文件中定义Xcode11.1,但这还没有解决问题。有没有办法可以指定只为 iOS 13 运行它?

我添加了以下内容,但仍然失败:

osx_image: xcode11.1
language: objective-c
xcode_destination: platform=iOS Simulator,OS=13,name=iPhone X

谢谢!

【问题讨论】:

    标签: ios travis-ci fastlane fastlane-gym


    【解决方案1】:

    您的yaml 文件中似乎有错字。

    Per the travis documentation for Xcode 11:

    os_image: xcode11.1
    

    从您发布的值中删除 x

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-02-17
    • 1970-01-01
    • 1970-01-01
    • 2015-04-22
    • 2015-07-19
    • 1970-01-01
    • 2011-07-05
    • 1970-01-01
    相关资源
    最近更新 更多