静态库大概步骤

1.new project->framework

2.build setting中设置mach-o type static libraty

3.cd到目录 pod init

4.修改pod pod install

5.重要:.h文件中import所有需要暴露的头文件,否则会报找不到文件

6.编译,真机和模拟器分别编译一份

lipo info /Users/user/xxx/Pods/libMQTTClient/products/libMQTTClient.framework/libMQTTClient 查看两个版本支持的cpu架构

sudo lipo -create /Users/user/Library/Developer/Xcode/DerivedData/libMQTTClient-bxngmnzxnfrtcggfqltcwcrnfagk/Build/Products/Release-iphoneos/libMQTTClient.framework/libMQTTClient /Users/user/Library/Developer/Xcode/DerivedData/libMQTTClient-bxngmnzxnfrtcggfqltcwcrnfagk/Build/Products/Release-iphonesimulator/libMQTTClient.framework/libMQTTClient -output /Users/user/libMQTTClient/products/libMQTTClient

合并架构

7.新建podspec文件

修改git相关参数

git repo push XXX

s.vendored_frameworks = 'products/*.{framework}'

推库

8.pod中引入 pod install使用

https://www.jianshu.com/p/155a3cfb765e

https://www.jianshu.com/p/f1c5641cae97

https://www.jianshu.com/p/d643c1368c9d

你可能感兴趣的:(静态库大概步骤)