相信很多開發(fā)者用xcode14打包的app提交到appstore后都有用戶反饋iOS12.3一下設備啟動閃退的問題耙替,這點大家可以參看http://www.reibang.com/p/6d205a3e1f9f 這個鏈接來解決。但同時有一個問題,對于pod生成的target 如果需要修改的就會很麻煩包蓝,尤其是在pod install 后,手動修改后的pod target的build setting會被重置
這時候可以修改podfile文件企量,在 post installer后在other linker flag 后append 相關設置测萎。具體代碼如下:
```
post_install do |installer|
? installer.pods_project.targets.each do |target|
? ? #####
? ? if target.name != "FCFileManager" //去除OC 庫
? ? ? xcconfig_paths = Array.new
? ? ? target.build_configurations.each do |config|
? ? ? ? new_xcconfig_path = config.base_configuration_reference.real_path
? ? ? ? if xcconfig_paths.include? new_xcconfig_path
? ? ? ? ? next
? ? ? ? end
? ? ? ? xcconfig_paths << new_xcconfig_path
? ? ? ? xcconfig_path = config.base_configuration_reference.real_path
? ? ? ? # read from xcconfig to build_settings dictionary
? ? ? ? build_settings = Hash[*File.read(xcconfig_path).lines.map{|x| x.split(/\s*=\s*/, 2)}.flatten]
? ? ? ? # modify OTHER_LDFLAGS
? ? ? ? build_settings['OTHER_LDFLAGS'] = "-Wl,-weak-lswiftCoreGraphics -Wl,-rpath,/usr/lib/swift #{build_settings['OTHER_LDFLAGS']}"
? ? ? ? # clear current file content
? ? ? ? File.open(xcconfig_path, "w") {|file| file.puts ""}
? ? ? ? # write build_settings dictionary to xcconfig
? ? ? ? build_settings.each do |key,value|
? ? ? ? ? File.open(xcconfig_path, "a") {|file| file.puts "#{key} = #{value}"}
? ? ? ? end
? ? ? end
? ? end
? ? #########
? end
end
```
參考連接:
https://developer.apple.com/forums/thread/714795