1. 當組件繼承於第三方庫時需修改導入方式
錯誤引入: #import "AFHTTPSessionManager.h"
正確引入: #import <AFNetworking/AFHTTPSessionManager.h>
錯誤引入方式,會在執行如下命令時提示 ”xxx.h“ file not found
pod lib lint xx.podspec
2. 執行 pod spec lint xxx.podspec
時,如果報錯無法找到某個依賴庫,請添加如下配置參數
pod spec lint xxx.podspec --use-libraries
發佈時也需添加如下
pod trunk push xxx.podspec --use-libraries
pod repo push repo_name xxx.podspec --use-libraries
–use-libraries:表示使用靜態庫或者是framework,這裏主要是解決當我們依賴一些framework庫後校驗提示找不到庫的時候
擴展參數
–verbose:有些非語法錯誤是不會給出錯誤原因的,這個時候可以使用–verbose來查看詳細的驗證過程來幫助定位錯誤。
–allow-warnings:表示允許警告。
3.[!] Authentication token is invalid or unverified. Either verify it with the email that was sent or register a new session.
pod trunk register '[email protected]' 'liuyongjie' --description='macbook pro'
4.私有庫中依賴了靜態庫.a文件,路徑配置正確,仍報錯找不到該庫,如下:
ld: library not found for -lRangersAppLog-Lite
如上是在導入第三方.a靜態庫 RangersAppLog-Lite.a
文件後的報錯信息
原因:製作私有庫時,所依賴靜態庫命名必須以”lib“開頭
解決方案:修改靜態庫名稱爲”libRangersAppLog-Lite“。
5. 靜態庫導入後,依賴庫也已配置,編譯通過,運行報錯如下:
unrecognized selector sent to class
靜態庫中方法報錯找不到該方法
原因:.podspec文件少了 -ObjC 編譯配置,並且少bitcode的配置。
解決方案:在.podspec中配置編譯項:
s.xcconfig = { "OTHER_LDFLAGS" => "-ObjC", "ENABLE_BITCODE" => "NO"}
6. 私有庫中有些pod依賴庫中含有.a靜態庫,執行 pod install 報錯:
[!] The 'Pods-MXStatService_Example' target has transitive dependencies that include statically linked binaries: (/Users/liuyongjie/Documents/233模塊&組件/MXStatService/Example/Pods/RangersAppLog/RangersAppLog/Core/libRangersAppLog_Core_ios.a)
.a文件無法鏈接到
原因:podfile文件中指定的是 use_frameworks! ,如果刪除此標識,那麼frameworks就無法pod了。frameworks與.a靜態庫不可共存
解決方案:如果私有庫組件需依賴.a靜態庫,又依賴其他framework(如:AFN),那麼只能將 .a靜態庫手動集成了