報錯的關鍵詞是:libstdc++。
原因是蘋果在 XCode10 和 iOS12 中移除了 libstdc++ 這個庫,由 libc++ 這個庫取而代之,蘋果的解釋是 libstdc++ 已經標記為廢棄有5年了,建議大家使用經過了 llvm 優化過并且全面支持C++11的 libc++ 庫。
如果是第三方的sdk引用到了這個庫,只能采取臨時解決方案,先讓項目能夠運行起來。
臨時解決方案:
真機通過編譯解決方法:
1.下載鏈接:http://ouz34cilp.bkt.clouddn.com/libstdc++.6.0.9.tbd.zip
2.將壓縮之后的內容拷貝到目錄:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib/libstdc++.* /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib/
模擬器通過編譯解決方案:
1.下載鏈接:http://ouz34cilp.bkt.clouddn.com/libstdc++_sim.zip
2.將壓縮之后的內容拷貝到目錄:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib/
1.下載鏈接:http://ouz34cilp.bkt.clouddn.com/libstdc++.dylib_sim.zip
2.將壓縮之后的內容拷貝到目錄:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/
熟悉的模擬器:
image.png
完美解決方案:
1.將用到 libstdc++ 的地方重新調整為依賴 libc++。
2.三方庫用到 libstdc++ 的地方,升級三方庫。
ps:避免三方庫的其他問題,升級你的CocoaPods。
Xcode11解決方案:https://github.com/cy920820/Libstdc-.6.0.9-files