dimanche 10 mai 2015

Swift - Apple Mach-O Linker Error sqlite3 local db

I have as this tutorial presentens added a local db to my project. Within my solution I have two projects one is the main application and the other one is a Today Extension project. When added the SQLlite files (provided from the tutorial) and libsqlite3.0.dylib to the main application it works perfectly to SELECT, INSERT, UPDATE and DELETE from the db, but when I tried to add the SQLite files to the Extension I am receiving these errors:

Undefined symbols for architecture x86_64:
  "_sqlite3_bind_blob", referenced from:
      __TFC12AppToday8SQLiteDBP33_9CF002B13E24CF8B0C3EFF52F9662D0D7preparefS0_FTSS6paramsGSqGSaPSs9AnyObject____VSs14COpaquePointer in SQLiteDB.o
  "_sqlite3_bind_double", referenced from:
      __TFC12AppToday8SQLiteDBP33_9CF002B13E24CF8B0C3EFF52F9662D0D7preparefS0_FTSS6paramsGSqGSaPSs9AnyObject____VSs14COpaquePointer in SQLiteDB.o
  "_sqlite3_bind_int", referenced from:
      __TFC12AppToday8SQLiteDBP33_9CF002B13E24CF8B0C3EFF52F9662D0D7preparefS0_FTSS6paramsGSqGSaPSs9AnyObject____VSs14COpaquePointer in SQLiteDB.o
  "_sqlite3_bind_null", referenced from:
      __TFC12AppToday8SQLiteDBP33_9CF002B13E24CF8B0C3EFF52F9662D0D7preparefS0_FTSS6paramsGSqGSaPSs9AnyObject____VSs14COpaquePointer in SQLiteDB.o
  "_sqlite3_bind_parameter_count", referenced from:
      __TFC12AppToday8SQLiteDBP33_9CF002B13E24CF8B0C3EFF52F9662D0D7preparefS0_FTSS6paramsGSqGSaPSs9AnyObject____VSs14COpaquePointer in SQLiteDB.o
  "_sqlite3_bind_text", referenced from:
      __TFC12AppToday8SQLiteDBP33_9CF002B13E24CF8B0C3EFF52F9662D0D7preparefS0_FTSS6paramsGSqGSaPSs9AnyObject____VSs14COpaquePointer in SQLiteDB.o

Etc..

The printscreen below shows the structure of the projects and the files that I have added.

enter image description here

My idea was to add the SQLiteDB.swift and String-Extras in the Extension project to be able to make sqlite calls to the db. I have also added the necessary briding-header file, but I´m receiving the errors presented above.

I saw in another thread that I can delete the DerivedData folder in settings > Locations, but that did not solve the problem.

Anyone got a clue why this occur? It´s weird that it works in the main project but not in the extension...

Aucun commentaire:

Enregistrer un commentaire