iOS-項(xiàng)目運(yùn)行錯(cuò)誤總結(jié)

我會(huì)逐漸把項(xiàng)目中遇到的問(wèn)題記錄在這篇文章,放便后期查閱。

  • 1.接收項(xiàng)目初次加載pods出現(xiàn)resources.sh: Permission denied 問(wèn)題

分析原因:是因?yàn)樵L問(wèn)該文件的操作權(quán)限出現(xiàn)問(wèn)題,所以解決方向就是添加訪問(wèn)文件的權(quán)限。
解決方法
a. 項(xiàng)目中查找.sh,找到sh文件,右鍵Show In Finder

查找.sh文件.png

b. cd+ Pods-項(xiàng)目名-resources.sh 路徑,

cd /Users/xx/Desktop/xx/xx/Pods/Target\ Support\ Files/Pods-xx/Pods-xx-resources.sh

切換路徑.png

c. 執(zhí)行添加權(quán)限命令,chmod a+x Pods-項(xiàng)目名-resources.sh路徑,按回車即可添加。

chmod a+x /Users/xxx/Desktop/xx/xx/Pods/Target\ Support\ Files/Pods-xxx/Pods-xx-resources.sh

語(yǔ)法: chmod 用戶 操作 權(quán)限 文件名
chmod:命令
a:表示全部用戶
+:表示增加權(quán)限
x:表示可執(zhí)行的權(quán)限
Pods-xx-resources.sh:表示要修改的文件名

Snip20191223_23.png

+2. 項(xiàng)目中引用KissXML三方庫(kù)的時(shí)候報(bào)錯(cuò)'libxml/tree.h' file not found
分析原因:缺少libxml文件,解決方向是添加庫(kù)文件
解決方法
a.項(xiàng)目中添加libxml2.tbd

添加包.png

libxml2.tbd.png

b.Header Search Paths 添加包路徑${SDK_ROOT}/usr/include/libxml2

添加路徑.png

再次運(yùn)行即可,如果上次都添加后還報(bào)錯(cuò) ,多試幾次,或者關(guān)掉xcode重新試一下。

  • 3 引入``MOBFoundation.framework報(bào)如下錯(cuò)誤:"___gxx_personality_v0", referenced from:
Undefined symbols for architecture arm64:
  "___gxx_personality_v0", referenced from:
      -[MOBFErrorReport initWithAppKey:sdkType:sdkVersion:] in MOBFoundation(MOBFErrorReport.o)
      -[MOBFErrorReport initWithAppKey:productType:sdkVersion:] in MOBFoundation(MOBFErrorReport.o)
      -[MOBFErrorReport writeErrorDataWithMsg:] in MOBFoundation(MOBFErrorReport.o)
      -[MOBFErrorReport writeError:forType:] in MOBFoundation(MOBFErrorReport.o)
      -[MOBFBigInteger init] in MOBFoundation(MOBFBigInteger.o)
      -[MOBFBigInteger initWithInt:] in MOBFoundation(MOBFBigInteger.o)
      -[MOBFBigInteger initWithBigInteger:] in MOBFoundation(MOBFBigInteger.o)
      ...
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

報(bào)錯(cuò)信息.png

分析原因:缺少系統(tǒng)庫(kù)
解決方法
a.項(xiàng)目中添加如下系統(tǒng)庫(kù)文件

libstdc++.tbd
JavaScriptCore.framework
libz.tbd
libicucore.tbd

如果實(shí)在不行,重新添加再次運(yùn)行即可

  • 4 引用RegexKitLite正則表達(dá)式庫(kù)報(bào)錯(cuò)
報(bào)錯(cuò)信息.png

解決方法:在Other Linker Flags 中添加-licucore就可以了。

添加示意圖.png

  • 5.使用CocoaPods 更新庫(kù)的時(shí)候報(bào)錯(cuò)
[!] CocoaPods could not find compatible versions for pod "xxxx":
  In Podfile:
    xxxx (~> 4.11.0)

Specs satisfying the `xxxx (~> 4.11.0)` dependency were found, but they required a higher minimum deployment target.

報(bào)錯(cuò)信息.png

解決方法:
找到要pod的庫(kù)支持的最低版本

修改工程.png

然后重新pod install安裝一下即可。

先記錄這些,感謝閱讀,如有錯(cuò)誤,不吝賜教!

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

友情鏈接更多精彩內(nèi)容