Swift 2 / iOS 9 - libz.dylib not found

前端 未结 8 1162
小蘑菇
小蘑菇 2020-12-04 10:49

I\'m using some external codes from google in my new Swift 2.0 project that required \"libz.dylib\" in earlier versions. After updating to the new Xcode / the new SDK.

相关标签:
8条回答
  • 2020-12-04 11:36

    Meanwhile you can use previous SDK. This is my answer for libsqlite3:

    https://stackoverflow.com/a/30981161/627794

    Edit: (link content added)

    Open terminal, type (change to your desired library, e.g. libz)

    locate libsqlite3.dylib
    

    You'll find several files like these:

    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/lib/libsqlite3.dylib
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib/libsqlite3.dylib
    

    Go to your project's setting -> Build Phases -> Link with Binaries. Add BOTH files by clicking +, then Add Other. Hit Cmd-Shift-G, and copy-paste the file path. Click Open.

    If you install sqlite3 using macports, remove /opt/local/lib from Library Search Path in Build Settings.

    0 讨论(0)
  • 2020-12-04 11:40

    You can also add the lybz.dylib from "Other Linker Flags" in the Build Settings by adding the argument -lz.

    I had to do this because, using the method where you reference the library from /usr/lib, when I deployed my app to our testers the .dylib library could not resolve and caused the app to crash on launch.

    0 讨论(0)
提交回复
热议问题