sqlite.swift 安装后出现大量错误
sqlite.swift tons of errors after installation
我的第一个问题,yoroshiku。
当手动将 SQLite.swift (0.11.5) 作为子项目或通过 cocoapods 安装到我的项目时,安装成功。但是 Xcode (9.3) 在某些 SQLite.swift 文件中给了我一堆错误。
我之前已经成功安装到三个项目中了。这些项目今天仍然有效。但是突然之间,我无法在任何新项目上安装 SQlite.swift。
我得到的错误是...
'Dictionary.Keys' 类型的值没有成员
'compactMap'
类型“[Expressible?]”的值没有成员 'compactMap'
无法将类型 'Self.IndexDistance' 的值转换为预期值
参数类型 'Int'
调用中缺少参数 #2 的参数
以上错误出现在 16 个不同的位置。如有必要,我可以提供更具体的信息,但在我看来,问题更有可能出现在设置或安装过程中。
我做的是下面的
我遵循 https://github.com/stephencelis/SQLite.swift 上的官方指南,但我也观看和阅读了我在这里和那里找到的教程。
- 创建全新的单视图应用程序。
- 我退出Xcode
- 然后在终端
...
Computer:Desktop user$ cd SQLtest6
Computer:SQLtest6 user$ sudo gem install cocoapods
Password:
Successfully installed cocoapods-1.5.0
Parsing documentation for cocoapods-1.5.0
Done installing documentation for cocoapods after 4 seconds
1 gem installed
...
Computer:SQLtest6 user$ pod init
Computer:SQLtest6 user$ nano Podfile
Computer:SQLtest6 user$ cat Podfile
# Uncomment the next line to define a global platform for your project
platform :ios, '11.0' #also tried commenting this out
target 'SQLtest6' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for SQLtest6
pod 'SQLite.swift', '~> 0.11.5'
end
...
Computer:SQLtest6 user$ pod install --repo-update
Updating local specs repositories
$ /usr/bin/git -C /Users/user/.cocoapods/repos/master fetch origin
--progress
remote: Counting objects: 18, done.
remote: Compressing objects: 100% (16/16), done.
remote: Total 18 (delta 10), reused 0 (delta 0), pack-reused 0
From https://github.com/CocoaPods/Specs
ab34143d0fd..18642c110f8 master -> origin/master
$ /usr/bin/git -C /Users/user/.cocoapods/repos/master rev-parse
--abbrev-ref HEAD
master
$ /usr/bin/git -C /Users/user/.cocoapods/repos/master reset --hard
origin/master
HEAD is now at 18642c110f8 [Add] XyiLotterySDK 1.0.0
Analyzing dependencies
Downloading dependencies
Installing SQLite.swift (0.11.5)
Generating Pods project
Integrating client project
[!] Please close any current Xcode sessions and use `SQLtest6.xcworkspace` for this project from now on.
Sending stats
Pod installation complete! There is 1 dependency from the Podfile and 1 total pod installed.
然后我通过双击新的白色图标 .xcworkspace 打开项目。在第一次构建之前一切似乎都很好,然后所有错误都出现了。
在项目设置的常规选项卡下,我有:
嵌入式二进制文件:none
链接的框架和二进制文件:Pods_SQLTest6.framework(必需)
我尝试将项目设置与工作项目进行比较,但我似乎找不到任何不同之处。
我在新旧项目上尝试了几次。我还尝试了手动方式,从 GitHub 下载 zip,将项目拖到项目导航器并根据上面链接的官方文档中的指南添加框架和二进制文件。
抱歉,如果它含糊不清。我一直在扫描 SO 三天,试图找到类似的东西。运气不好。
有人知道吗?
您正在导入的项目尚不兼容 Swift 4.1 中引入的最新更改。即一个明显的是将 flatMap 更改为 compactMap。
参考:
查看他们是否有 Swift 4.1 分支。 (更新:我查过了,他们没有)
另一种选择是使用可能更兼容的旧 Swift 版本构建您的项目。您可以在构建设置中执行此操作,将 Swift 语言版本更改为您想要的版本。 4.0 可能会工作,它似乎没有任何重大的重大变化。
编辑
抱歉,我理解错了。项目 has 已更新至 Swift 4.1。
之前的非 Swift 4.1 版本是 0.11.4,因此如果您在 PodFile 中指定此版本将解决您的问题,直到您将项目更新为 Swift 4.1。
// install specific version of pod
pod 'SQLite.swift', '0.11.4'
我的第一个问题,yoroshiku。
当手动将 SQLite.swift (0.11.5) 作为子项目或通过 cocoapods 安装到我的项目时,安装成功。但是 Xcode (9.3) 在某些 SQLite.swift 文件中给了我一堆错误。
我之前已经成功安装到三个项目中了。这些项目今天仍然有效。但是突然之间,我无法在任何新项目上安装 SQlite.swift。
我得到的错误是...
'Dictionary.Keys' 类型的值没有成员 'compactMap'
类型“[Expressible?]”的值没有成员 'compactMap'
无法将类型 'Self.IndexDistance' 的值转换为预期值 参数类型 'Int'
调用中缺少参数 #2 的参数
以上错误出现在 16 个不同的位置。如有必要,我可以提供更具体的信息,但在我看来,问题更有可能出现在设置或安装过程中。
我做的是下面的
我遵循 https://github.com/stephencelis/SQLite.swift 上的官方指南,但我也观看和阅读了我在这里和那里找到的教程。
- 创建全新的单视图应用程序。
- 我退出Xcode
- 然后在终端
...
Computer:Desktop user$ cd SQLtest6
Computer:SQLtest6 user$ sudo gem install cocoapods
Password:
Successfully installed cocoapods-1.5.0
Parsing documentation for cocoapods-1.5.0
Done installing documentation for cocoapods after 4 seconds
1 gem installed
...
Computer:SQLtest6 user$ pod init
Computer:SQLtest6 user$ nano Podfile
Computer:SQLtest6 user$ cat Podfile
# Uncomment the next line to define a global platform for your project
platform :ios, '11.0' #also tried commenting this out
target 'SQLtest6' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for SQLtest6
pod 'SQLite.swift', '~> 0.11.5'
end
...
Computer:SQLtest6 user$ pod install --repo-update
Updating local specs repositories
$ /usr/bin/git -C /Users/user/.cocoapods/repos/master fetch origin
--progress
remote: Counting objects: 18, done.
remote: Compressing objects: 100% (16/16), done.
remote: Total 18 (delta 10), reused 0 (delta 0), pack-reused 0
From https://github.com/CocoaPods/Specs
ab34143d0fd..18642c110f8 master -> origin/master
$ /usr/bin/git -C /Users/user/.cocoapods/repos/master rev-parse
--abbrev-ref HEAD
master
$ /usr/bin/git -C /Users/user/.cocoapods/repos/master reset --hard
origin/master
HEAD is now at 18642c110f8 [Add] XyiLotterySDK 1.0.0
Analyzing dependencies
Downloading dependencies
Installing SQLite.swift (0.11.5)
Generating Pods project
Integrating client project
[!] Please close any current Xcode sessions and use `SQLtest6.xcworkspace` for this project from now on.
Sending stats
Pod installation complete! There is 1 dependency from the Podfile and 1 total pod installed.
然后我通过双击新的白色图标 .xcworkspace 打开项目。在第一次构建之前一切似乎都很好,然后所有错误都出现了。
在项目设置的常规选项卡下,我有: 嵌入式二进制文件:none 链接的框架和二进制文件:Pods_SQLTest6.framework(必需)
我尝试将项目设置与工作项目进行比较,但我似乎找不到任何不同之处。
我在新旧项目上尝试了几次。我还尝试了手动方式,从 GitHub 下载 zip,将项目拖到项目导航器并根据上面链接的官方文档中的指南添加框架和二进制文件。
抱歉,如果它含糊不清。我一直在扫描 SO 三天,试图找到类似的东西。运气不好。
有人知道吗?
您正在导入的项目尚不兼容 Swift 4.1 中引入的最新更改。即一个明显的是将 flatMap 更改为 compactMap。
参考:
查看他们是否有 Swift 4.1 分支。 (更新:我查过了,他们没有)
另一种选择是使用可能更兼容的旧 Swift 版本构建您的项目。您可以在构建设置中执行此操作,将 Swift 语言版本更改为您想要的版本。 4.0 可能会工作,它似乎没有任何重大的重大变化。
编辑
抱歉,我理解错了。项目 has 已更新至 Swift 4.1。
之前的非 Swift 4.1 版本是 0.11.4,因此如果您在 PodFile 中指定此版本将解决您的问题,直到您将项目更新为 Swift 4.1。
// install specific version of pod
pod 'SQLite.swift', '0.11.4'