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,859评论 2 38
  • 发现 关注 消息 iOS 第三方库、插件、知名博客总结 作者大灰狼的小绵羊哥哥关注 2017.06.26 09:4...
    肇东周阅读 12,268评论 4 61
  • 午间吃饭,需要鲜新空气的我,喜欢走到另一栋住宅楼的楼下,天晴时那里有阳光,也有木椅木凳。于是午餐时习惯了听音频,有...
    小丫屠阅读 1,930评论 0 0
  • 中间穿插印象笔记软文,莫怪莫怪,干货也不少 1、大脑喜欢色彩。平时使用高质量的有色笔或使用有色纸, 颜色能帮助记忆...
    学徒晓成阅读 1,502评论 0 3
  • 最近一直在减肥,其实没有什么运动,就是饭后走一走,然后看看微信里大家的步数,不行在走一走。慢慢有了一些感悟。 走步...
    子右阅读 292评论 0 0