iOS iPhone SQLite and Monotouch issue

2019-08-12 05:49发布

问题:

I have successfully developed a small iPhone+Monotouch (latest version) application with Monodevelop 2.8, which use a "compiled by me" version of SQLite to enable FTS4.

To compile SQLite as static library (libSQLite.a) I used this topic as tutorial: How to use FTS in SQLite with Monotouch for iOS

Also I've followed this tutorial to create a Simulator+Device compliant static library: Build fat static library (device + simulator) using Xcode and SDK 4+

Things are working great on the simulator. :)

Bad news comes from the device, an iPhone 4 with iOS 4. When I deploy and run the application on the device, it suddenly crashes.

To use the libSQLite.a static library in my monotouch project I've followed this tutorial http://docs.xamarin.com/ios/advanced_topics/linking_native_libraries

It seems that something is going wrong when running the application on the device compiled with this additional command: -gcc_flags "-L${ProjectDir} -lSQLite3 -force_load ${ProjectDir}/libSQLite3.a" If I compile and deploy the application without the additional command (to use the static link library) the program start without crashing.

Any suggestion?

Anybody already use SQLite with FTS4 on a monotouch application for iOS?

回答1:

This is related to our bug #707, in short it's an issue which is usually provoked by using external libraries with thumb instructions. This also means the workaround is easy: just disable thumb support in Xcode when compiling your static libraries.

As a sidenote we've tracked down the bug and it will hopefully be fixed in the next MonoTouch release.