【问题标题】:Alamofire Swift-2.0 branch fails with several errorsAlamofire Swift-2.0 分支失败并出现多个错误
【发布时间】:2015-07-30 18:35:33
【问题描述】:

我有 Xcode7-beta4,这是我的 Podfile 的相关部分:

pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git', :branch => 'swift-2.0'

我的构建失败并出现以下错误:

/Users/Teja/Projects/Work/CareNarrative/Pods/Alamofire/Source/ServerTrustPolicy.swift:125:30: Cannot invoke 'append' with an argument list of type '(Unmanaged<SecCertificate>)'
/Users/Teja/Projects/Work/CareNarrative/Pods/Alamofire/Source/ServerTrustPolicy.swift:167:13: Cannot invoke 'SecTrustSetPolicies' with an argument list of type '(SecTrust, [Unmanaged<SecPolicy>!])'
/Users/Teja/Projects/Work/CareNarrative/Pods/Alamofire/Source/ServerTrustPolicy.swift:173:17: Cannot invoke 'SecTrustSetPolicies' with an argument list of type '(SecTrust, [Unmanaged<SecPolicy>!])'
/Users/Teja/Projects/Work/CareNarrative/Pods/Alamofire/Source/ServerTrustPolicy.swift:204:17: Cannot invoke 'SecTrustSetPolicies' with an argument list of type '(SecTrust, [Unmanaged<SecPolicy>!])'
/Users/Teja/Projects/Work/CareNarrative/Pods/Alamofire/Source/ServerTrustPolicy.swift:253:30: Cannot invoke 'append' with an argument list of type '(Unmanaged<SecCertificate>)'
/Users/Teja/Projects/Work/CareNarrative/Pods/Alamofire/Source/ServerTrustPolicy.swift:261:62: 'Unmanaged<CFData>!' is not convertible to 'NSData'
/Users/Teja/Projects/Work/CareNarrative/Pods/Alamofire/Source/ServerTrustPolicy.swift:272:29: Cannot invoke 'publicKeyForCertificate' with an argument list of type '(Unmanaged<SecCertificate>)'
/Users/Teja/Projects/Work/CareNarrative/Pods/Alamofire/Source/ServerTrustPolicy.swift:286:35: Cannot invoke 'SecTrustCreateWithCertificates' with an argument list of type '(SecCertificate, Unmanaged<SecPolicy>!, inout SecTrust?)'
/Users/Teja/Projects/Work/CareNarrative/Pods/Alamofire/Source/ServerTrustPolicy.swift:289:25: Cannot assign a value of type 'Unmanaged<SecKey>!' to a value of type 'SecKey?'

有什么想法吗?

编辑:如果更易于阅读,则添加屏幕截图。

【问题讨论】:

    标签: swift2 alamofire


    【解决方案1】:

    我们已经有很多人报告了这个问题,这一直是由于配置问题或过时的分支造成的。 Alamofire 本身已经解决了根本问题,现在我们只需要找出“你的”问题所在。以下是您需要正确设置的所有内容的列表。

    将 CocoaPods 更新到最新版本

    cnoon:~$ sudo gem install cocoapods
    cnoon:~$ pod --version
    0.38.2
    

    将 xcodebuild 指向最新版本

    cnoon:~$ xcodebuild -version
    Xcode 7.0
    Build version 7A165t
    

    如果这不是指向 Xcode 7 beta 4 版本,您可以在 Xcode 7 首选项中的Preferences => Locations => Command Line Tools 下进行设置。

    重新运行 CocoaPods

    swift-2.0 分支上的一些提交可能已过期。再次运行 pod update 以确保从该分支中​​提取任何新提交。


    通过正确设置所有这些设置,您应该能够解决您的问题。如果您仍然有问题,请再次发表评论,我会相应地调整我的答案。

    【讨论】:

    • 谢谢,我的xcodebuild 偏好不正确。修复它可以解决问题!
    • 我已按照这些步骤操作,但不幸的是我仍然遇到相同的错误。我需要额外的步骤吗?
    • 升级到 Build:7A176x 后,重复这个过程就可以了。
    猜你喜欢
    • 1970-01-01
    • 2018-09-04
    • 2021-09-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-01-10
    • 1970-01-01
    相关资源
    最近更新 更多