低版本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
複製代碼