Xcode7中 Link Binary With Libraries 沒有.dylib庫,只能找到對應的.tbd,但不能代替使用,通過查找資料,嘗試后得到以下兩種解決方法。
方法1. (heqin測試可行)在項目Target中的Link Binary With Libraries 手動添加
首先點擊 “+”
顯示搜索添加頁面,在這里如果搜索之前的libsqlite3.dylib是搜不出來ios9之前的。所以需要點擊 Add Other,出現文件目錄頁面,正常情況這里去通過Finder也是找不到老的libsqlite3.dylib文件的,因為這個文件是隱藏掉的。所以需要按 打開finder,輸入
快捷鍵 CMD+Shift+G (Go to the folder),輸入/usr/lib后,進入隱藏的界面,然后添加你需要的 *.dylib,如libsqlite3.dylib文件。即可。
方法2(尚未測試).Build Phases 配置
project -> Build Settings ->Linking -> Other Linker Flag
添加 -l< 所需 dylib 的名稱 >
例如:libsqlite3.dylib -> -lsqlite3
為什么用tbd文件代替dylib文件的一種解釋。
http://stackoverflow.com/questions/31450690/why-xcode-7-shows-tbd-instead-of-dylib
So it appears that the .dylib file is the actual library of binary code that your project is using and is located in the /usr/lib/ directory on the user's device. The .tbd file, on the other hand, is just a text file that is included in your project and serves as a link to the required .dylib binary. Since this text file is much smaller than the binary library, it makes your app's download size smaller.
tbd文件類似于dylib文件的鏈接,可以使app變得更小。