Closed davidmartos96 closed 3 years ago
I'm not fully aware of namespaces in iOS but I think since you redefined the same class with the same name, link should even fail.... You can try to rename all classes and constants (except the static ones) and add a SqlCipher middle prefix. On sqflite I share the code source between macos and ios (they are always identical). It's likely the issue also exists on MacOS too.
Thanks @alextekartik . Well, the project links and builds just fine when using both sqflite
and sqflite_sqlicipher
with the pod override. It also runs great with versions of sqflite
lower than 1.3.0. It's just with the latest changes that it throws this error at runtime. I will try to rename the classes as you suggest anyway to see if it helps.
Hi, has there been any progress on this? I'm currently using the work around suggested, but am interested in knowing if the class rename helped.
@gilescm Unfortunately I wasn't able to get it working with that suggestion. I don't think is much problematic to lock the version of the sqflite package to version 1.3.0 though. It's been working rock solid for a long time.
I'm also curious on why is not working, but it may simply have to do with the internal workings of the FMDatabase
class which comes in the pod, so not an easy fix I'm afraid.
In my testing, the example app uses sqlite3 built by SQLCipher
in _sqflitesqlcipher.openDatabase BUT it uses /usr/lib/libsqlite3.dylib
in sqflite.openDatabase.
I have been able to make it work with 2 sets of changes:
SqfliteXxx
-> SqfliteSqlCipherXxx
to avoid linker warningHEADER_SEARCH_PATHS
to avoid using /usr/lib/libsqlite3.dylib
Check screenshot:
This issue has been resolved in the latest update thanks to @daohoangson
There is no longer need to change the ref in the dependency override. Using fmdb_override
as ref is still needed though.
Crash on iOS with the latest
sqflite
changes, when opening a non sqlcipher database.With the latest
sqflite
version, 1.3.0, on iOS it can throw a native errorEXC_BAD_ACCESS
which crashes the app. It occurs when running the following new added code:This error only happens when opening a normal
sqflite
after having opened ansqflite_sqlcipher
database. Read below for the setup necessary for the crash to happen.Some background: When you are using both
sqflite_sqlcipher
andsqflite
in the same project (probably due to other dependencies like cache_network_image) theFMDB
pod can't be installed with both the normal Sqlite and SqlCipher variants. To fix that, this repo has the branchfmdb_override
which uses the SqlCipher pod in the orginalsqflite
, as the pod shares the same API.I have created a test sample in the SqlCipher group of tests in the example project from this repo which produces the crash. It's in the branch
ios_test_crash
. From what I've researched it looks like it has to do with thread synchronization and theFMDatabaseQueue
but I'm not sure how can it be solved. In theory, the queue in the ObjC code on bothsqflite
andsqflite_sqlcipher
are different.cc @alextekartik I was hoping if you would know what could be the reason of the crash or if you know how could it be handled, while keeping the native implementations in the plugins as independent as possible.
Temporary solution
If you are getting this crash my current solution is to point to this specific commit when overriding
sqflite