首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >安装后的sqlite.swift吨错误

安装后的sqlite.swift吨错误
EN

Stack Overflow用户
提问于 2018-04-18 14:21:33
回答 1查看 664关注 0票数 0

我的第一个问题,yoroshiku。

当手动将SQLite.swift (0.11.5)作为子项目或通过cocoapods安装到我的项目时,安装就成功了。但是Xcode (9.3)给了我一些SQLite.swift文件中的错误。

我以前已经成功地将它安装到三个项目。这些项目至今仍然有效。但突然之间,我无法在任何新项目上安装SQlite.swift。

我得到的错误是.

  • 类型'Dictionary.Keys‘的值没有成员'compactMap’
  • 类型的值‘可表达?’没有成员“compactMap”
  • 无法将“Self.IndexDistance”类型的值转换为预期的参数类型“Int”
  • 调用中缺少参数#2的参数

上述错误出现在16个不同的位置。如果有必要的话,我可以给出更具体的信息,但在我看来,这个问题在设置或安装过程中更有可能出现。

我所做的是下面的

我遵循https://github.com/stephencelis/SQLite.swift上的官方指南,但我也看过并阅读了我在这里和那里找到的教程。

  • 创建一个全新的单视图应用程序。
  • 我退出Xcode
  • 然后在终点站

..。

代码语言:javascript
复制
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

..。

代码语言:javascript
复制
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

..。

代码语言:javascript
复制
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来打开项目。在第一次构建之前,一切看起来都很好,然后所有的错误都出现了。

在“项目设置”选项卡下,我拥有: Embedded二进制文件:无链接框架和二进制文件: Pods_SQLTest6.framework (必需)

我试着将项目设置与工作项目进行比较,但似乎找不到任何不同的地方。

我在旧的和新的项目上试过几次。我还尝试了手动方式,从GitHub下载zip,将项目拖到项目导航器,并根据上面链接到的正式文档中的指南添加框架和二进制文件。

抱歉,如果是模糊的话。我已经扫描了三天,试图找到类似的东西。不走运。

有人知道吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-04-18 14:31:52

您要导入的项目与Swift 4.1中最近引入的更改还不兼容。也就是说,一个明显的问题是将flatMap改为compactMap。

参考:

检查他们是否有Swift 4.1分支机构。(更新:我查过了,他们没有)

另一种选择是使用更老的Swift版本构建您的项目,这个版本可能更兼容。您可以在“生成设置”中这样做,将Swift语言版本更改为所需的版本。4.0可能会起作用,它似乎没有任何重大的破坏变化。

编辑

抱歉,我搞错了。项目更新为SWIFT4.1。

以前的非SWIFT4.1版本为0.11.4,因此如果在PodFile中指定此版本,将解决问题,直到将项目更新为SWIFT4.1。

代码语言:javascript
复制
// install specific version of pod
pod 'SQLite.swift', '0.11.4'
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/49902181

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档