【问题标题】:Enum case 'fromPost' not found in type 'Destiny?' in Travis, but the type is declared in File在“命运”类型中找不到枚举案例“fromPost”?在 Travis 中,但类型在 File 中声明
【发布时间】:2019-10-29 00:29:16
【问题描述】:

我声明枚举类型

public enum Destiny {
    case fromTrail
    case fromPost
}

并在代码的另一部分使用,像这样:

 convenience init(withDestinySearch from: Destiny) {
        self.init(collectionViewLayout: UICollectionViewFlowLayout())
        destinySearch = from
    }

但此错误出现在 Travis 的构建中,并且仅出现在 Travis CI 中:Sigma/Sigma/App/Features/Search/Controller/SearchController.swift:92:15: enum case 'fromPost' not found in type 'Destiny? '

这是构建:https://travis-ci.org/ViniciusDeep/Sigma/builds/604199159?utm_source=github_status&utm_medium=notification

【问题讨论】:

    标签: swift xcode travis-ci fastlane pbxproj


    【解决方案1】:

    嗯,问题是destinySearch 是一个可选的,所以它实际上是期待的:

    case .fromPost?:
    

    代替:

    case .fromPost:
    

    或者你可以在之前解包它,或者你可以将destinySearch声明为隐式解包值。

    关于特拉维斯;可能是因为它使用的是 Xcode 10.3,因为我可以在我自己的 Xcode (11.0) 中成功编译/运行它。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-09-22
      相关资源
      最近更新 更多