无法使用 Xcode 8.0 和 Swift 3 构建子项目

Cannot build a subproject using Xcode 8.0 and Swift 3

我是 运行 Xcode 8.0 构建版本 8S174q 和 Apple Swift 版本 3.0 (swiftlang-800.0.34.6 clang-800.0.33)。

Pauls-Mac-mini:~ paul$ xcrun xcodebuild -version
Xcode 8.0
Build version 8S174q
Pauls-Mac-mini:~ paul$ xcrun swift -version
Apple Swift version 3.0 (swiftlang-800.0.34.6 clang-800.0.33)
Target: x86_64-apple-macosx10.9
Pauls-Mac-mini:~ paul$ xcrun --find swift
/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift

https://github.com/stephencelis/SQLite.swift我安装了0.11.0版本(注意它写在Swift 3)。我在该网页上尝试了三种安装方法,经过一天的折腾仍然无法让 sqlite.swift 编译。通过 Xcode 报告导航器 (CMD-8),我看到了数百个编译错误,其中一些我已粘贴在下面。

/Users/paul/Documents/MySandbox/TestThreeSqlite/SQLite.swift/SQLite/Core/Connection.swift:69:9: error: expected declaration
        fileprivate init(rawValue:Int32) {
        ^
/Users/paul/Documents/MySandbox/TestThreeSqlite/SQLite.swift/SQLite/Core/Connection.swift:58:17: note: in declaration of 'Operation'
    public enum Operation {
                ^
/Users/paul/Documents/MySandbox/TestThreeSqlite/SQLite.swift/SQLite/Core/Connection.swift:69:20: error: consecutive declarations on a line must be separated by ';'
        fileprivate init(rawValue:Int32) {
                   ^

我最初怀疑 swift 3.0 编译器没有被使用,但从查看编译命令(如下)看来情况并非如此。

我尝试了 3 种安装 SQLite.swift 的方法 - 使用 Carthage、cocoapods 并将 SQLite.swift 安装为 Xcode 子项目。我无法构建 SQlite.swift.

请帮忙!我是 iOS 开发、Xcode 和工具的新手,所以被这个难住了。下面我添加了一些更详细的信息,例如生成错误的编译命令。你能建议一个可能的解决方案,或者我可以尝试构建这个子项目的东西吗?

CompileSwift normal x86_64 /Users/paul/Documents/MySandbox/TestThreeSqlite/SQLite.swift/SQLite/Typed/CoreFunctions.swift
    cd /Users/paul/Documents/MySandbox/TestThreeSqlite/SQLite.swift
    /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c -primary-file /Users/paul/Documents/MySandbox/TestThreeSqlite/SQLite.swift/SQLite/Typed/CoreFunctions.swift /Users/paul/Documents/MySandbox/TestThreeSqlite/SQLite.swift/SQLite/Extensions/RTree.swift /Users/paul/Documents/MySandbox/TestThreeSqlite/SQLite.swift/SQLite/Core/Blob.swift /Users/paul/Documents/MySandbox/TestThreeSqlite/SQLite.swift/SQLite/Foundation.swift /Users/paul/Documents/MySandbox/TestThreeSqlite/SQLite.swift/SQLite/Core/Connection.swift /Users/paul/Documents/MySandbox/TestThreeSqlite/SQLite.swift/SQLite/Typed/Expression.swift /Users/paul/Documents/MySandbox/TestThreeSqlite/SQLite.swift/SQLite/Helpers.swift /Users/paul/Documents/MySandbox/TestThreeSqlite/SQLite.swift/SQLite/Typed/Collation.swift /Users/paul/Documents/MySandbox/TestThreeSqlite/SQLite.swift/SQLite/Typed/Setter.swift /Users/paul/Documents/MySandbox/TestThreeSqlite/SQLite.swift/SQLite/Typed/CustomFunctions.swift /Users/paul/Documents/MySandbox/TestThreeSqlite/SQLite.swift/SQLite/Extensions/FTS4.swift /Users/paul/Documents/MySandbox/TestThreeSqlite/SQLite.swift/SQLite/Core/Value.swift /Users/paul/Documents/MySandbox/TestThreeSqlite/SQLite.swift/SQLite/Typed/Operators.swift /Users/paul/Documents/MySandbox/TestThreeSqlite/SQLite.swift/SQLite/Typed/Schema.swift /Users/paul/Documents/MySandbox/TestThreeSqlite/SQLite.swift/SQLite/Typed/Query.swift /Users/paul/Documents/MySandbox/TestThreeSqlite/SQLite.swift/SQLite/Core/Statement.swift /Users/paul/Documents/MySandbox/TestThreeSqlite/SQLite.swift/SQLite/Typed/AggregateFunctions.swift /Users/paul/Documents/MySandbox/TestThreeSqlite/SQLite.swift/SQLite/Extensions/FTS5.swift -target x86_64-apple-ios10.0 -enable-objc-interop -sdk /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.0.sdk -I /Users/paul/Library/Developer/Xcode/DerivedData/TestThreeSqlite-hfrusllbfhbivxajwyfswvzejkpl/Build/Products/Debug-iphonesimulator -I /Users/paul/Documents/MySandbox/TestThreeSqlite/SQLite.swift/CocoaPods/iphonesimulator-10.0 -F /Users/paul/Library/Developer/Xcode/DerivedData/TestThreeSqlite-hfrusllbfhbivxajwyfswvzejkpl/Build/Products/Debug-iphonesimulator -application-extension -enable-testing -g -import-underlying-module -module-cache-path /Users/paul/Library/Developer/Xcode/DerivedData/ModuleCache -serialize-debugging-options -Xcc "-I/Users/paul/Library/Developer/Xcode/DerivedData/TestThreeSqlite-hfrusllbfhbivxajwyfswvzejkpl/Build/Intermediates/SQLite.build/Debug-iphonesimulator/SQLite iOS.build/swift-overrides.hmap" -Xcc -iquote -Xcc "/Users/paul/Library/Developer/Xcode/DerivedData/TestThreeSqlite-hfrusllbfhbivxajwyfswvzejkpl/Build/Intermediates/SQLite.build/Debug-iphonesimulator/SQLite iOS.build/SQLite-generated-files.hmap" -Xcc "-I/Users/paul/Library/Developer/Xcode/DerivedData/TestThreeSqlite-hfrusllbfhbivxajwyfswvzejkpl/Build/Intermediates/SQLite.build/Debug-iphonesimulator/SQLite iOS.build/SQLite-own-target-headers.hmap" -Xcc "-I/Users/paul/Library/Developer/Xcode/DerivedData/TestThreeSqlite-hfrusllbfhbivxajwyfswvzejkpl/Build/Intermediates/SQLite.build/Debug-iphonesimulator/SQLite iOS.build/SQLite-all-non-framework-target-headers.hmap" -Xcc -ivfsoverlay -Xcc /Users/paul/Library/Developer/Xcode/DerivedData/TestThreeSqlite-hfrusllbfhbivxajwyfswvzejkpl/Build/Intermediates/SQLite.build/all-product-headers.yaml -Xcc -iquote -Xcc "/Users/paul/Library/Developer/Xcode/DerivedData/TestThreeSqlite-hfrusllbfhbivxajwyfswvzejkpl/Build/Intermediates/SQLite.build/Debug-iphonesimulator/SQLite iOS.build/SQLite-project-headers.hmap" -Xcc -I/Users/paul/Library/Developer/Xcode/DerivedData/TestThreeSqlite-hfrusllbfhbivxajwyfswvzejkpl/Build/Products/Debug-iphonesimulator/include -Xcc "-I/Users/paul/Library/Developer/Xcode/DerivedData/TestThreeSqlite-hfrusllbfhbivxajwyfswvzejkpl/Build/Intermediates/SQLite.build/Debug-iphonesimulator/SQLite iOS.build/DerivedSources/x86_64" -Xcc "-I/Users/paul/Library/Developer/Xcode/DerivedData/TestThreeSqlite-hfrusllbfhbivxajwyfswvzejkpl/Build/Intermediates/SQLite.build/Debug-iphonesimulator/SQLite iOS.build/DerivedSources" -Xcc -DDEBUG=1 -Xcc -ivfsoverlay -Xcc "/Users/paul/Library/Developer/Xcode/DerivedData/TestThreeSqlite-hfrusllbfhbivxajwyfswvzejkpl/Build/Intermediates/SQLite.build/Debug-iphonesimulator/SQLite iOS.build/unextended-module-overlay.yaml" -Xcc -working-directory/Users/paul/Documents/MySandbox/TestThreeSqlite/SQLite.swift -emit-module-doc-path "/Users/paul/Library/Developer/Xcode/DerivedData/TestThreeSqlite-hfrusllbfhbivxajwyfswvzejkpl/Build/Intermediates/SQLite.build/Debug-iphonesimulator/SQLite iOS.build/Objects-normal/x86_64/CoreFunctions~partial.swiftdoc" -Onone -module-name SQLite -emit-module-path "/Users/paul/Library/Developer/Xcode/DerivedData/TestThreeSqlite-hfrusllbfhbivxajwyfswvzejkpl/Build/Intermediates/SQLite.build/Debug-iphonesimulator/SQLite iOS.build/Objects-normal/x86_64/CoreFunctions~partial.swiftmodule" -serialize-diagnostics-path "/Users/paul/Library/Developer/Xcode/DerivedData/TestThreeSqlite-hfrusllbfhbivxajwyfswvzejkpl/Build/Intermediates/SQLite.build/Debug-iphonesimulator/SQLite iOS.build/Objects-normal/x86_64/CoreFunctions.dia" -emit-dependencies-path "/Users/paul/Library/Developer/Xcode/DerivedData/TestThreeSqlite-hfrusllbfhbivxajwyfswvzejkpl/Build/Intermediates/SQLite.build/Debug-iphonesimulator/SQLite iOS.build/Objects-normal/x86_64/CoreFunctions.d" -emit-reference-dependencies-path "/Users/paul/Library/Developer/Xcode/DerivedData/TestThreeSqlite-hfrusllbfhbivxajwyfswvzejkpl/Build/Intermediates/SQLite.build/Debug-iphonesimulator/SQLite iOS.build/Objects-normal/x86_64/CoreFunctions.swiftdeps" -o "/Users/paul/Library/Developer/Xcode/DerivedData/TestThreeSqlite-hfrusllbfhbivxajwyfswvzejkpl/Build/Intermediates/SQLite.build/Debug-iphonesimulator/SQLite iOS.build/Objects-normal/x86_64/CoreFunctions.o"

问题是由于使用的 swift 版本不支持 https://github.com/stephencelis/SQLite.swift 0.11.0 版中的某些新 swift 语言功能(例如 fileprivate访问级别修饰符)。很难将 Xcode 测试版与 swift 相关联 版本(在本例中为 swiftlang-800.0.34.6 clang-800.0.33)到 swift 语言发行说明 (https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/RevisionHistory.html).

我升级到 Xcode 8.1,它使用 Swift 3.0.1,现在没有发现构建问题。现在 Xcode 不再是测试版,我希望 xcode 版本、swift 语言代码和 swift 发行说明之间的交叉引用会更容易。