libsqlite3.dylib is accidently deleted from my Xcode . It is shown as red in "Link Binary with Libraries" (Build Phases) . Not in Trash too . Do I need to install xcode again ?
2 Answers
While the above answers do tell you how to go about adding the library to Xcode, what happens if you cannot find the library? I noticed this issue, and then did a search in Spotlight for libsqlite3, which did not locate any files. While it is kind of crude, you can jump to a Terminal session to locate files throughout your file system. Spotlight does not index everywhere on your drives, and my suspicion is that it does not include the locations where this file lives. At a terminal prompt, type:
find / -name libsqlite3.dylib -print
This is a UNIX command that will locate the file, starting at the root, and printing out the results it finds. You can press CTRL-C to cancel the search at any time. I actually found it within the Xcode bundle; in this case I am running Xcode 7 Beta, so it was found in:
/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib
For convenience, I copied the file from this folder to a Resources folder under Documents, where I keep libraries and other files for easy reference in my projects.
Please note, if you are developing in Swift, then you need to edit your Bridging-Header.h file, and add the line:
#imports <sqlite3.h>
If you don't have the Bridging Header, you can add it to your project, follow the steps:
- Create a new file, Bridging-Header.h in your project.
- Add the line above.
- Go to your Project Build Settings (click on the Project, click on Build Settings tab).
- Locate "Swift Compiler - Code Generation", "Objective-C Bridging Header" setting, and add the name of the file above "Bridging-Header.h"
It looks your library is missing libsqlite3.dylib and libsqlite3.0.dylib, so copy these files from any other computer and place these files in your computer.
Procedure:
- Open xcode on the computer where these files exists, add libsqlite3.0.dylib in your project from link binary with libraries.
- Right click on the libsqlite3.0.dylib and show in finder.
- Copy two files libsqlite3.0.dylib and libsqlite3.dylib and place on the same location on other computer where these files are missing.
original post: