libsqlite3.dylib and libz.dylib missing in Xcode 7

2019-01-31 03:11发布

问题:

How do I use Parse if libz.dylib and libsqlite3.dylib are missing in Xcode 7 but the .tbd version exists. I am just trying to setup Push Notifications. How do I get this to work?

Also, I think it's because of this I can't import Parse into AppDelegate.swift without an error saying it doesn't exist.

回答1:

As for Xcode 7 b4: To add Parse support into existing project, follow the Parse "Set up the SDK" for existing project and to add the libz and libsqlite3 libs, use:

  • Go to Build Phases > Link Binary with Libraries > + > Add other
  • While in the file selection window press: "command"+shift+G (i.e. Go to folder) and type /usr/lib/
  • From /user/lib find and add : libz.dylib and libsqlite3.dylib

Please note!: Also make sure ATS works for you - this is new in iOS9!, see more info for example at NSURLSession "HTTP load failed kCFStreamErrorDomainSSL, -9813 ; Self signing certificate



回答2:

In tracking down a solution to this on the mac developer forum, this seemed to be the popular answer:

This is a known issue in the Xcode 7 beta. To work around this issue for now, please: Delete all references to .tbd files from either your linked libraries phase, or from the copied bundle resources phase (where they sometimes will be added). Add the library you want to link manually to the "Other Linker Flags" build settings, by adding the argument: -l for each library you want to link (for example, add "-lsqlite3" (without quotes)). For those who are curious, the .tbd files are new "text-based stub libraries", that provide a much more compact version of the stub libraries for use in the SDK, and help to significantly reduce its download size.

In addition to this, I found that this worked verbatim for the sqlite3 example. But for libz.dylib you simply need to type -lz

And from there I was able to build successfully on the simulator, I have yet checked on a device running iOS9



回答3:

step 1 (as described by StanislavK):

Go to Build Phases > Link Binary with Libraries > + > Add other
While in the file selection window press: "CMD"+Shift+G (i.e. Go to folder) and type /usr/lib/
From /user/lib find and add : libz.dylib and libsqlite3.dylib

step 2: open your terminal (for mac)

cd /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/lib

sudo ln -s /usr/lib/libsqlite3.dylib libsqlite3.dylib
sudo ln -s /usr/lib/libz.dylib libz.dylib

That works for me.



回答4:

I don't think adding dylib files manually is the right way. Parse documentation is not updated for XCode 7: .dylib files are now .tbd files! You can add these files using Build Phases > Link binary with libraries panel and selecting these files from the list, searching for libz and libsqlite3 (without the extension). You can find quick info here about tbd files : Why Xcode 7 shows *.tbd instead of *.dylib?



回答5:

In XCode 7 the *.dylib files are now *.tbd files, just search for the library you want and change the extension to .tbd

Example:

libz.dylib      -> libz.tbd
libstdc++.dylib -> libstdc++.tbd

Thanks