控制台输出报错内容:
dyld: Library not loaded: /usr/lib/libstdc++.6.dylib
Referenced from: /Users/yangming/Library/Developer/CoreSimulator/Devices/14C9AC08-7C07-4CED-A8EC-E93D0EA73953/data/Containers/Bundle/Application/73F84C0D-9D2D-474D-9947-F249B0CEEB15/CreatingCEP.app/CreatingCEP
Reason: no suitable image found. Did find:
/usr/lib/libstdc++.6.dylib: mach-o, but not built for iOS simulator
(lldb)
这个错误原因是因为iOS12.0之后去掉了lstdc++.6.0.9.tbd动态库,如下图搜索便知:
iOS12.0中全部采用libc++代替lstdc++的动态库(如下图)
解决方案
Xcode10下:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib/
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib/
Xcode11下:
第一条iOS.simruntime的路径发生了变更,Xcode10中是../Developer/Library/..,而Xcode11中是.../Library/Developer/...
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib/
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib/