ios - iOS 中 @available 命令的 Travis 错误

标签 ios travis-ci fastlane fastlane-gym

我在使用 Travis 和 FaSTLane(健身房)时遇到问题,但尚未找到解决方法。

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

选择器“labelColor”没有已知的类方法 选择器“systemBackgroundColor”没有已知的类方法 选择器“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

谢谢!

最佳答案

您的 yaml 文件中似乎存在拼写错误。

Per the travis documentation for Xcode 11 :

os_image: xcode11.1

从您发布的值中删除x

关于ios - iOS 中 @available 命令的 Travis 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59179723/

相关文章:

ios - 为什么我需要添加 use_legacy_build_api : true when use gym build project?

ios - FaSTLane 注释掉字符串中的引号

xcode - faSTLane 创建的 .cer 和 .mobileprovision 文件应该存储在 git 中吗?

jquery - 我正在构建的 Wordpress 页面正在使我的 iPhone 崩溃

ios - 我需要一个可变数组,它在 IOS 中有 8 个内插字符串

android - 将 flutter android 项目导入 iOS

Travis-CI 徽章未更新

travis-ci - Travis 手动确认下一阶段

ios - 如何将MKMapPoint值数组转换为MKPolygon覆盖

build - 仅在部署时在 Travis 中使用矩阵构建