ericsink / SQLitePCL.raw

A Portable Class Library (PCL) for low-level (raw) access to SQLite
Apache License 2.0
512 stars 106 forks source link

Debug local iphone results in file is not a database #601

Open whann0205 opened 3 days ago

whann0205 commented 3 days ago

The following packages are in use: PackageReference Include="sqlite-net-sqlcipher" Version="1.9.172" /> PackageReference Include="SQLitePCLRaw.bundle_e_sqlcipher" Version="2.1.8" /> PackageReference Include="SQLitePCLRaw.provider.dynamic_cdecl" Version="2.1.8" /> It is a net maui application targetting .net8. Everything is kept up to date. Problem is that the app cannot access the database. The file get installs by using openfile OpenAppPackageFileAsync somewhere in the initialization section of the app. It is proven that the file is indeed here and accessible, have even copied the file via SMB to my File Server to check if it get installed correctly. The file is a sqllite4 format with encryption. It is working perfectly on android device, android emulator, ios emulator no matter which emulated device. it works on the mac itself, too. Not tried to deploy as a release yet. But when i try to debug the app on the iphone via hot restart (visual studio 2022 17.10.3) the file is there but i throws the exception "File is not a database". I really dont know where to start since i dont know if the problem is inside your library or praeclarum or where ? I am stuck do whatever it takes to solve that problem.

sjlombardo commented 1 day ago

@whann0205 You need to disable hot restart under VS iOS Settings. When that feature is enabled it skips the native linking step within Xcode on the paired mac. That results in the application using the built-in SQLite which does not include encryption features.