libstdc++.6已經(jīng)在Xcode10中被廢棄茵瀑,所以鏈接有stdc++.6的lib會在Xcode10上編譯報錯,這時就需要手動將stdc++.6替換成c++
在Podfile中增加post_install的hook,代碼如下:
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
# Fix libstdc++.6在Xcode10編譯報錯問題
if target.name == "Pods-SomeTarget"
xcconfig_path = config.base_configuration_reference.real_path
xcconfig = File.read(xcconfig_path)
new_xcconfig = xcconfig.sub('stdc++.6', 'c++')
File.open(xcconfig_path, "w") { |file| file << new_xcconfig }
end
end
end
end