Xcode 14 打包 iOS11/12 設(shè)備崩潰問題(含pod安裝庫)

相信很多開發(fā)者用xcode14打包的app提交到appstore后都有用戶反饋iOS12.3一下設(shè)備啟動(dòng)閃退的問題,這點(diǎn)大家可以參看http://www.itdecent.cn/p/6d205a3e1f9f 這個(gè)鏈接來解決。但同時(shí)有一個(gè)問題,對于pod生成的target 如果需要修改的就會很麻煩,尤其是在pod install 后,手動(dòng)修改后的pod target的build setting會被重置

這時(shí)候可以修改podfile文件,在 post installer后在other linker flag 后append 相關(guān)設(shè)置。具體代碼如下:

```

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

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容