0

I am using sqlite.swift

When I include this in my pod file:

  pod 'SQLite.swift/SQLCipher', '~> 0.12.2'

Is SQLCipher still compatible with SQLite.swift? Do I need additional pod statements to import SQLCipher and SQLite or just this one line?

XCode reports error when I build that look like this:

/Pods/SQLCipher/sqlite3.h:6907:10: Redefinition of 'sqlite3_index_orderby' /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.0.sdk/usr/include/sqlite3.h:6758:10: Previous definition is here Pods/SQLite.swift/Sources/SQLiteObjc/include/SQLiteObjc.h:26:9: While building module 'SQLite3' imported from /Library/Developer/Xcode/DerivedData/SpeechCollector-btdxklvmapneuigwvexrhccrhodq/Build/Products/Debug-iphonesimulator/SQLite.swift/SQLite.framework/Headers/SQLiteObjc.h:26: /:2:9: In file included from :2: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.0.sdk/usr/include/sqlite3ext.h:20:10: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.0.sdk/usr/include/sqlite3ext.h:20:

gregm
  • 12,019
  • 7
  • 56
  • 78

1 Answers1

3

We had the same issue on our project, and we couldn't update to the next Xcode until this was solved.

The repo SQLite.swift looks abandoned, but among the pull requests there's this one that resolved the issue for our project.

What we did is download the repo and added it as a local dependency (we are using Cocoapods), then we added the changes that appear in that PR. In file SQLiteObjc.h, we changed from

@import Foundation;
#if defined(SQLITE_SWIFT_STANDALONE)
@import sqlite3;
#else
@import SQLite3;
#endif

to

@import Foundation;
#if defined(SQLITE_SWIFT_STANDALONE)
@import sqlite3;

#elif defined(SQLITE_SWIFT_SQLCIPHER)
@import SQLCipher;

#else
@import SQLite3;
#endif

Hope this helps to you also.