deploying Qt/QML App with LocalStorage (Sqlite) on OS X - qt

I'm doing an app with QML that uses LocalStorage to store some informations.
It's working fine when I run in debug mode.
My storage.js that access the database is like that.
.import QtQuick.LocalStorage 2.0 as Sql
// First, let's create a short helper function to get the database connection
function getDatabase() {
return Sql.LocalStorage.openDatabaseSync("MyApp", "0.1", "StorageDatabase", 100000);
}
My Qt .pro file contains the Sql module:
QT += sql
And at first moment it runs fine in Release mode either.
But when I try to deploy on OSX, running macdeployqt like that:
macdeployqt MyApp.app -dmg -qmldir=../MyApp/qml/
First I got one error, but I think that's ok because I don't use MySQL: ERROR: no file at
"/opt/local/lib/mysql55/lib/libmysqlclient.18.dylib"
I'm using sqlite via LocalStorage.
Then trying to run in Release mode it doesn't work anymore, the database access doesn't work, not even the in the deployment it works... now when I try to run the app I got the error:
storage.js:5: ReferenceError: Sql is not defined
The line 5 is this one:
return Sql.LocalStorage.openDatabaseSync("MyApp", "0.1", "StorageDatabase", 100000);
And the Sql name is defined in the first line:
.import QtQuick.LocalStorage 2.0 as Sql
Looking for this error in the internet I found some places telling to do exactly what I did, like here: https://qt-project.org/forums/viewthread/28371
Any clue about this?
I'm using Qt5.2, Quick 2.0, Qt Creator 3.01

The problem was related to this Qt bug that is here since Qt5.1
https://qt-project.org/forums/viewthread/29805/
I've used the script and custom macdeployqt linked in the post to make this work.
Script: https://gist.github.com/lasconic/5965542
Custom macdeployqt: https://github.com/MaximAlien/macdeployqt
It seems that Qt is not giving much attention to desktop development, only that explains a bug like that not fixed yet.

Related

Xamarin.Auth AccountStore - KeyStore was not initialized

I've had this Xamarin.Auth AccountStore working in my app for a while, but then decided to do some updates to some Nuget Packages and Target Android versions >_<
I now have no idea what went wrong and how to get it working again, here is the exception:
Java.Security.KeyStoreException: KeyStore was not initialized
The code is pretty simple and looks like this:
var accountStore = AccountStore.Create(Android.App.Application.Context);
var accounts = accountStore.FindAccountsForService(providerName);
The 2nd line is throwing the exception.
This is in the Android project, being called from a PCL DependencyService.
It has been working this way for a while, I guess something changed in a version update in one of the packages but I don't know what, any ideas?
try to repair your visual studio installation.
This made the trick for our project. We had the same problems like you.

Unity ios build work with debug mode but crash with release mode (archive ipa)

I'm trying to use sqlite with sqlcipher for unity ios game.
I get an sqlite unity example https://github.com/takezoux2/unity-orm
I added a method for unity to call function set key:
[DllImport("__Internal", EntryPoint = "sqlite3_key")]
private static extern int sqlite3_key(IntPtr stmHandle, string key, int len);
I compiled sqlcipher to static library (libsqlcipher.a). Add it to Assets/Plugins/iOS with header sqlite3.h, sqlite3ext.h
In Unity editor, it works without encryption. It's ok. I just want encryption work on ios devices.
I keep moving on export Xcode project, config OPENSSL_SRC in Source trees, add C flag -DSQLITE_HAS_CODEC, add search header "sqlcipher", add Security framework then run on device.
It works! There is no issue. I get the database encrypted in Document folder (i tested it with hexdump -C, SQLiteManager)
The problem only occurred after I archive the app to ipa file (using enterprise provisioning profile). I Use iFunbox to install app to device. The app crash immediately on launch.
This is what i get from crash log:
Exception Type: EXC_BAD_ACCESS (SIGABRT)
Exception Subtype: KERN_INVALID_ADDRESS at 0x00000000
I try to replace sqlite3_key with PRAGMA key='123456';
No more crash, everything works but the output database is not encrypted.
I don't know what different between Archive and Build mode. My example works if i build directly to device (with both sqlite3_key and PRAGMA key='123456';), but archive mode does not.
I also try to import sqlcipher xcode project to unity xcode project (remove libsqlcipher.a from Plugins/iOS), set all architectures to armv7 (also try with/without -mno-thumb), add C flag -DSQLITE_HAS_CODEC, add search header "sqlcipher", add Security framework then run directly on device. It work!!!
Then i try to archive app, install app with iFunbox. Again, i get crash on launch.
I'm not sure if i'm setting something wrong with my project (https://github.com/tamhv/unity-orm-with-encrypt). Please someone take a look on this and give me advice. Thank you so much!
I can't tell you why you are crashing, but you can switch your app to Release mode and then debug it to find out.
In XCode, On the top toolbar next to the play/stop button press on the Project name to bring up the context menu and select Edit Schema.
Under Run/Debug change the Build configuration to Release.
Now run the app from XCode and hopefully you'll see the same crash but have a stack trace.

WP8 : File not Found in SQLite

I follow This Post to try SQlite implementation in Windows Phone 8 and I am able to do that. Recently I installed Win 8.1 with VS 2013. Now I again tried the same step to run the previously created example is not working now.
I am getting error in below code.
#if USE_WP8_NATIVE_SQLITE
return (Result)Sqlite3.sqlite3_open_v2(filename, out db, flags, "");
#else
return (Result)Sqlite3.sqlite3_open_v2(filename, out db, flags, null);
#endif
I am getting lite this
Not sure what is wrong with this.
Can any one help me in this ?
You most likely don't have the SQLite for Windows Phone SDK installed (not the .NET-callable wrapper, the actual engine). Download it from http://sqlite.org/download.html and then add a reference to it in your project.

App crashes when using MagicalRecord in release build

Our app uses MagicalRecord to store data in Core Data. It have worked fine so far, but now, after adding fields to my tables, the app crashes, but only in release builds.
When I upgrade via cable, it works just fine, but when I use Ad-Hoc (Enterprise) distribtion to upgrade the app, the app crashes.
The problem is I don't get any debug data on the crash because of this. The only thing I get is a "exited abnormally with signal 11: Segmentation fault: 11" error.
Crash report:
(http://pastebin.com/64c4jvgJ)
I assume the issue might be related to needing migration, but I can't find any good documentation on how this is supposed to work. Any pointers in the right direction is welcome.
Update:
More info -
Before updating my datamodel, i had a store called PAM.sqlite, and a non-versioned store called PAM.xcdatamodeld. Now i have a versioned store, called PAM & PAM 2.
I use this code to attempt an automigration, but it does not work:
[MagicalRecord setDefaultModelNamed:#"PAM 2.xcdatamodel"];
[MagicalRecord setupCoreDataStackWithAutoMigratingSqliteStoreNamed:#"PAM.sqlite"];
You need to specify the extenstion of the data model (e.g. MyProjectDB.momd)
so, the code syntax would be:
[MagicalRecord setDefaultModelNamed:#"MyProjectDB.momd"];
Found the answer here
I had the same issue. Try to add new version in xcdatamodeld. Then activate it as current. Open it in finder. Choose show package content. You will see two files for both of your versions. Replace the one for old version with non-versioned file from your old build. Use this
[MagicalRecord setupCoreDataStackWithAutoMigratingSqliteStoreNamed:#"PAM.sqlite"];
So your project will have two versions of db. And will have an ability to migrate automatically.
Default settings of MagicalRecord for iOS (https://github.com/magicalpanda/MagicalRecord) is something like this
#ifdef DEBUG
[self setShouldDeleteStoreOnModelMismatch:YES];
#else
[self setShouldDeleteStoreOnModelMismatch:NO];
#endif
That means,If there is change in database model in DEBUG mode,they will simply delete older version of data model.I believe this has been fixed in latest version of Magical record.
If not, change it to
#ifdef DEBUG
[self setShouldDeleteStoreOnModelMismatch:NO];
#else
[self setShouldDeleteStoreOnModelMismatch:NO];
#endif
and fix migration code

Active Record and Linq T4 Templates problem

I've started a C# web application project using subsonic 3.0.3 as my DAL and SQLite for database.
It doesn't have any problem when using SimpleRepo, but the problem occurs when I try to use ActiveRecord/Linq T4 templates.
It says "Metadata file 'System.Data.SQLite' could not be found". The settings.ttinclude is the one provided with SQLite.ttinclude file and its config looks ok, and other files are instructed to use SQLite.ttinclude of course. I've also tested them with an SQL Server database and everything goes fine.
Also tried searching about it on the net and all I could find were these:
Subsonic Google Groups which instructs me to add a reference to System.Data.SQLite to the top of settings.ttinclude. No luck.
Someone at here commented about this issue, and it was answered to check the connection string, which doesn't seem to be my problem, because the app works when I use SimpleRepo.
Is SQLite installed on your machine? You need the .NET driver for it as well (that's what can't be found).

Resources