iOS framework 中引用 CommonCrypto.h

先在工程根目錄下或是子目錄下創建一個文件夾, 在里面放入一個以 modulemap 為后綴的文件, 比如Module.modulemap.

文件內容模板:

module CCommonCrypto [system] {
header  "/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTV  OS.sdk/usr/include/CommonCrypto/CommonCrypto.h"
export *
}

module CCommonCrypto [system] {
    header      "/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/S DKs/  AppleTVSimulator.sdk/usr/include/CommonCrypto/CommonCrypto.h"
    export *
}

module CCommonCrypto [system] {
    header      "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPho neOS  .sdk/usr/include/CommonCrypto/CommonCrypto.h"
    export *
}

module CCommonCrypto [system] {
    header      "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SD Ks/i  PhoneSimulator.sdk/usr/include/CommonCrypto/CommonCrypto.h"
    export *
}

module CCommonCrypto [system] {
    header      "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX . sdk/usr/include/CommonCrypto/CommonCrypto.h"
    export *
}

module CCommonCrypto [system] {
    header      "/Applications/Xcode.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/Watch OS.   sdk/usr/include/CommonCrypto/CommonCrypto.h"
    export *
}

module CCommonCrypto [system] {
    header      "/Applications/Xcode.app/Contents/Developer/Platforms/WatchSimulator.platform/Developer/SDK s/Wa  tchSimulator.sdk/usr/include/CommonCrypto/CommonCrypto.h"
    export *
}

上面都是在引入一個頭文件, 只是針對的平臺不一樣.

然后在 Build Setting 中的 import path 設置中將該文件的文件夾路徑填上即可. 比如我在某個子目錄下新建了一個 iOS 文件夾(路徑是./FoundationExtensions/iOS), 然后再在里面放入 Module.modulemap 文件, 文件內容只是引入了 iOS 端的頭文件:

module CCommonCrypto [system] {
    header "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/CommonCrypto/CommonCrypto.h"
    export *
}

則 import path 中添加一條內容就是: ./FoundationExtensions/iOS.

混合 swift 和 oc 的庫如何暴露 oc 頭文件: 先在 Build Phases 的 Headers 內將 oc 頭文件加入到 public 一欄中, 然后在 framework 對應的頭文件中 import 即可. 比如 #import "DataConverter.h"

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容

  • github排名https://github.com/trending,github搜索:https://gith...
    小米君的demo閱讀 4,815評論 2 38
  • 發現 關注 消息 iOS 第三方庫、插件、知名博客總結 作者大灰狼的小綿羊哥哥關注 2017.06.26 09:4...
    肇東周閱讀 12,229評論 4 61
  • 午間吃飯,需要鮮新空氣的我,喜歡走到另一棟住宅樓的樓下,天晴時那里有陽光,也有木椅木凳。于是午餐時習慣了聽音頻,有...
    小丫屠閱讀 1,915評論 0 0
  • 中間穿插印象筆記軟文,莫怪莫怪,干貨也不少 1、大腦喜歡色彩。平時使用高質量的有色筆或使用有色紙, 顏色能幫助記憶...
    學徒曉成閱讀 1,499評論 0 3
  • 最近一直在減肥,其實沒有什么運動,就是飯后走一走,然后看看微信里大家的步數,不行在走一走。慢慢有了一些感悟。 走步...
    子右閱讀 289評論 0 0