Reputation: 3
My first question here, yoroshiku.
When installing SQLite.swift (0.11.5) to my project manually as a sub project or via cocoapods, the installation succeeds. But Xcode (9.3) gives me a bunch of errors in some of the SQLite.swift files.
I have installed it successfully to three projects before. Those projects still work today. But suddenly, I can't install SQlite.swift on any new projects.
The errors I get are...
Value of type 'Dictionary.Keys' has no member 'compactMap'
Value of type '[Expressible?]' has no member 'compactMap'
Cannot convert value of type 'Self.IndexDistance' to expected argument type 'Int'
Missing argument for parameter #2 in call
Above errors appear in 16 different locations. I can give more specific information about this if necessary but it seems to me the problem is more likely in settings or during installation.
What I do is the following
I follow the official guide on https://github.com/stephencelis/SQLite.swift but I have also watched and read tutorials that I’ve found here and there.
...
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.
I then open the project by double clicking the new white-icon .xcworkspace. Everything seems fine until the first build, then all the errors appear.
Under the project settings General tab I have: Embedded Binaries: none Linked frameworks and binaries: Pods_SQLTest6.framework (Required)
I tried comparing the project settings to the working projects but I can't seem to find anything different.
I tried several times on old and new projects. I also tried the manual way by downloading the zip from GitHub, dragging the project to the project navigator and adding the frameworks and binaries according to the guide in the official documentation linked to above.
Sorry if it's vague. I have been scanning SO for three days trying to find anything similar. No luck.
Anyone got any idea?
Upvotes: 0
Views: 870
Reputation: 19750
The project you are importing is not yet compatible with recent changes introduced in Swift 4.1. Namely one obvious one is changing flatMap to compactMap.
Reference:
Check to see if they have a Swift 4.1 branch. (Update: I checked, they don't)
Another option would be to build your project with an older Swift version which may be more compatible. You can do this in the Build Settings, change Swift Language Version to your desired version. 4.0 would possibly work, it doesn't seem to have any major breaking changes.
EDIT
My apologies, I got this the wrong way around. The project has updated to Swift 4.1.
The previous, non Swift 4.1 version was 0.11.4, so if you specify this version in your PodFile that will resolve your issue until you update your project to Swift 4.1.
// install specific version of pod
pod 'SQLite.swift', '0.11.4'
Upvotes: 1