低版本Xcode升级到Xcode10以后,将废弃libstdc++6.0.9的库,致使不少用到这个库的项目会报出library not found for -lstdc++.6.0.9错误。ios
升级第三方库,或将低版本Xcode9的libstdc++6.0.9.tbd拷贝到Xcode10的目录下 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform(模拟器下运行:iPhoneSimulator.platform)/Developer/SDKs/iPhoneOS.sdk/usr/lib/c++
注意: 此方法只能暂时性解决问题,Xcode升级后须要从新拷贝libstdc++6.0.9.tbdbash
在Podfile中增长post_install的hook,移除Pods目录从新pod install便可,hook部分代码以下app
platform :ios, '9.0'
use_frameworks!
target "DEMO" do
pod 'MJRefresh'
end
post_install do |installer_representation|
installer_representation.pods_project.targets.each do |target|
// DEMO 为本身项目的target名
if target.name == 'Pods-DEMO'
target.build_configurations.each do |config|
xcconfig_path = config.base_configuration_reference.real_path
xcconfig = File.read(xcconfig_path)
new_xcconfig = xcconfig.sub('stdc++.6.0.9', 'c++')
File.open(xcconfig_path, "w") { |file| file << new_xcconfig }
end
end
end
end
复制代码