Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

libsqlite in simulator and iOS compiling

I'm having some issues when compiling my app to iOS. I'm using sqlite3 and imported as

#import <sqlite3.h>

Well, I only found a file named libsqlite3.0.dylib in my Mac and I copied it to my project. When I compile it for iOS Simulator, it works just fine. However, when I try to compile the app for iOS Device, it throws an error (Apple Match-O Linker Error) in every call I do in my implementation to sqlite's function (such as _sqlite3_open, etc.)

How can I compile it to iOS Device?

Thank you!

like image 544
Ibai Avatar asked Oct 01 '11 20:10

Ibai


2 Answers

Just in case someone faced that same problem as me. If you are unit testing your code, add the lib file also to your test target.

like image 127
Abdalrahman Shatou Avatar answered Oct 17 '22 21:10

Abdalrahman Shatou


Instead of simply copying the library, do it like this:

  • in Xcode Navigator, click on your target (the upmost entry)

  • go to Build Phases, then Link Binary With Libraries

  • add the libsqlite3.dylib from it's location at /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOSxx.sdk/usr/lib/

like image 58
ott-- Avatar answered Oct 17 '22 21:10

ott--