wcdb
wcdb copied to clipboard
WCDB.swift doesn't work with Firebase
The language of WCDB
Swift
The version of WCDB
v1.0.7.3 (newest)
The platform of WCDB
iOS
The installation of WCDB
Cocoapods
Environment
Xcode 10, iPhone Simulator / iPhone 5s with iOS 10.3.3
What's the issue?

Firebase and WCDB were installed through Cocoapods. Once database object is created, any pragma statement executed by Handle.exec(_ statement: Statement)
returns error code 21. I set a symbolic breakpoint as the attachment above, which reveals that the sqlite3_exec is not linked to WCDBOptimizedSQLCipher but libsqlite3.dylib. If Firebase were removed, everything works fine.
Any idea to fix this?
Demo project: WCDBFirebase.zip
Make WCDBSwift as a separate dynamic framework, but not within Cocoapods.
Sure a pre-compiled framework will solve the linking problem. I've also tried renaming the sqlite3_exec
to sqlite3_exec_wcdb
in legacy.c of WCDBOptimizedSQLCipher, which works that around too, but both of them appear to be invasive. I was wondering if sqlite3_exec
in WCDBOptimizedSQLCipher will be renamed in future release, or integrate the project of sqlcipher into WCDB, just like it was before.
Of course NOT. Why should WCDB rename the function name of SQLCipher? This is unreasonable.
Well resolving a symbolic conflict like this is beyond my current level, renaming is the only idea I came up with. At last we turn back to WCDB version 1.0.6.x, since there's no source code changes in releases after. A pre-compiled framework is also unacceptable, swift runtime libs will take more than 20MB of space which is a totally waste.
For any reference: https://github.com/wuyuehyang/wcdb
The reason why it failed should be some of the frameworks inside Firebase
linking the builtin SQLite
.
Since WCDBSwift
never import or link SQLite
explicitly, linker should link the WCDBOptimizedSQLCipher
. BUT it not.
I don't if it's a bug of linker or not.
Maybe I will fix it or try to avoid it sooner or later.
Note that Swift runtime libs may not be necessary.
Thanks, It’s glad to hear that you will be working on it. I don’t think it’s a good idea to get rid of those libs. I will have to recompile WCDB every time swift upgrade its ABI, and there will be no compiler errors reminding me if I don’t.
Upgrade to v1.0.7.5 and try again.
Thank you for your great work, I tested it in the demo project and now it works like a charm.
Anyway it could be perfect if these two warnings could be eliminated 😝
It did not happen on my machine. I'll check it later.
Much appreciated. It could be reproduced in the demo project of my first post. Tested on macOS 10.14, Xcode 10
It's fixed. Run pod update
for your project to get the latest version.
Note that WCDBSwift
should be v1.0.7.5 and both SQLiteRepairKit
and WCDBOptimizedSQLCipher
should be v1.2.1.
Thanks, it works perfect for me.
WCDB also have this problem if you enbale generate_multiple_pod_projects in Podfie. could you solve this problem? @RingoD
I still encounter this problem. Is there any new solution now? @RingoD version: WCDB.swift (2.0.4) WCDBOptimizedSQLCipher (1.4.2)