libstdc++在Xcode10中已經(jīng)移除,蘋果現(xiàn)在用libc++代替libstdc++,那么項(xiàng)目中如果使用了libstdc++改這么辦?
如果是自己工程使用了libstdc++,就用libc++代替。但是如果是第三方使用了,只能等待第三方更新。
但是我們還有一種臨時(shí)解決辦法。
解決辦法
1.從Xcode9中拷貝模擬器和真機(jī)libstdc++庫(kù)
如果嫌麻煩,可以從這個(gè)Git下載
模擬器路徑
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib
真機(jī)路徑
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib
拷貝下面三個(gè)庫(kù)

然后復(fù)制到Xcode10下相同路徑下。
這時(shí)候運(yùn)行會(huì)報(bào)錯(cuò)
Reason: no suitable image found. Did find:
/usr/lib/libstdc++.6.dylib: mach-o, but not built for iOS simulator
2.編譯運(yùn)行庫(kù)拷貝
在Xcode9下,從路徑 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib 復(fù)制這三個(gè)庫(kù)到對(duì)應(yīng)的Xcode10相同路徑下。
至此,無論真機(jī)還是模擬器編譯都正常了。