1

First of all I have to say that I'm new with Xcode and I found some things a bit comfusing for beginners.
For now I want to include SQLite support in my test app. I found the wrapper "FMDB" which seems very easy to use.
I was already able to include the .m and .h files into my project and setting the header line for bridging to Swift.
But if I build my app then I will get some link errors. I think the problem is that the sqlite library is missing. But I've no idea to include it. So I searched the web for some tutorials but all I found seems too old and didn't help me.
What I've already done are the following steps: I selected the top item of my project in the Project Explorer. Then I selected my build target and switched to the tab "Build Phases". But now I see no possibility to include the libsqlite.a file. I followed some suggestions and typed the keyword "sqlite" in the search field but I only get the message "No results found."
I'm using Xcode 8 + Swift 3 on Mac Sierra.

Eric Aya
  • 69,473
  • 35
  • 181
  • 253
altralaser
  • 2,035
  • 5
  • 36
  • 55
  • There are other SQLite wrappers for Swift 3, such as https://github.com/groue/GRDB.swift#installation, which clearly document how to integrate SQLite into your Xcode project (with all the advantages of being written directly for Swift) – Gwendal Roué Oct 10 '16 at 10:07
  • Thanks for your suggestion. For me GRDB is a bit too overloaded for only executing some select and insert statements but it seems a good wrapper for more complex tasks. – altralaser Oct 15 '16 at 20:23
  • GRDB is not overloaded: it does well what it does, and you choose what you need it to do. It provides the bast select/insert SQL api in town. – Gwendal Roué Oct 15 '16 at 21:45
  • How to do simple SQL with GRDB: https://github.com/groue/GRDB.swift#sqlite-api – Gwendal Roué Oct 15 '16 at 21:47

2 Answers2

0

I think that U should find libsqlite.a file in the filesystem and only then add libsqlite.a to project by right click on project files in Xcode 8 and selecting "add files to " and select you .a library from system location like Homebrew's sqlite root folder, only then you can select this static library in "+" linking menu. Please read this answer:

https://stackoverflow.com/a/15974037/2835276

Community
  • 1
  • 1
menangen
  • 145
  • 2
  • 8
0

I solved my problem by including sqlite3.c and sqlite3.h from sqlite.org so every wrapper works fine.

altralaser
  • 2,035
  • 5
  • 36
  • 55