【问题标题】:Cannot convert value of type 'SecTrustResultType' to expected argument type 'UInt32'无法将“SecTrustResultType”类型的值转换为预期的参数类型“UInt32”
【发布时间】:2016-10-20 06:41:44
【问题描述】:

尝试在 Xcode 8.0 中运行 Swift 2.3 代码

var result = SecTrustResultType(rawValue: SecTrustResultType.Invalid)

【问题讨论】:

    标签: iphone swift swift2 swift3


    【解决方案1】:

    Invalidenum SecTrustResultType 的一种情况,但是 SecTrustResultType(rawValue:) 期望底层证券的价值 “原始类型”,在本例中为 UInt32

    这样就可以编译了

    var result = SecTrustResultType(rawValue: SecTrustResultType.Invalid.rawValue)
    

    但只是等效的混淆版本

    // Swift 2.x
    var result = SecTrustResultType.Invalid
    // Swift 3
    var result = SecTrustResultType.invalid
    

    【讨论】:

      猜你喜欢
      • 2016-06-04
      • 1970-01-01
      • 2016-07-27
      • 2016-07-02
      • 2016-03-21
      • 1970-01-01
      • 2020-03-01
      • 2016-08-01
      • 2017-02-07
      相关资源
      最近更新 更多