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.

4
  • There are other SQLite wrappers for Swift 3, such as 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) Commented Oct 10, 2016 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. Commented Oct 15, 2016 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. Commented Oct 15, 2016 at 21:45
  • How to do simple SQL with GRDB: github.com/groue/GRDB.swift#sqlite-api Commented Oct 15, 2016 at 21:47

2 Answers 2

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

Sign up to request clarification or add additional context in comments.

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.