iOS .tdb代替.dylib


原文鏈接:http://www.meniny.cn/2015/09/22/00-00-01-iOS_Xcode_7_tbd/

不少升級 Xcode 7 的小伙伴們都表示在引入動態庫時驚呆了,因為熟悉的 .dylib 不見了,取而代之的是 .tbd

.dylib 去哪了

事實上 .dylib 還在原來的位置,而且我們也可以通過解析 .tbd 來找到他們,要使用原來的.dylib 文件可以這樣做:

  • 選擇 Target
  • 選擇 BuildPhases
  • 展開 Link Binary With Libraries
  • 點擊 +
  • 點擊 Add other
  • 按下  +  + G
  • 輸入 /usr/lib/

.tbd 是什么

經過苦苦的搜索之后,還是沒有(!!!)任何有價值的文獻,只在蘋果開發者論壇中有一段來自蘋果官方的回答:

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.

簡單說, .tbd 又是和蘋果壓縮 iOS 系統和應用體積的政策的產物。

.tbd 出錯了

如果你在使用 .tbd 時出現類似這樣的的錯誤:

warning: skipping file ‘/Users/me/xcode7/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.0.sdk/usr/lib/libz.tbd’ (unexpected file type ‘text’ in Frameworks & Libraries build phase)”

請參考下面的解決辦法:

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<library_name> for each library you want to link (for example, add “-lsqlite3” (without quotes)).

也就是說:

  • 刪除所有 .tbd 引用,不論 Link Binary With Libraries 還是 Copy Bundle Resources
  •  Build Settings => Other Linker Flags 中手動將每一個你要導入的庫以 -l<library_name> 的形式添加,例如你要導入 sqlite3 則添加 -lsqlite3


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM