一、現(xiàn)在工作流中使用Jenkins平臺配合Shell腳本完成游戲項目自動打包,在Xcode自動編譯的時候偶爾會報如下錯誤
/Unity-iPhone/Images.xcassets: error: Failed to find newest available Simulator runtime
這種情況終端執(zhí)行如下代碼即可:
sudo xcrun simctl shutdown all && sudo xcrun simctl erase all
二、由于更新新版Xcode 12.2,Jenkins在自動打包過程中,Xcode編譯生成ipa時會報如下錯誤:
BPlatformTool: *** Failed to launch tool with description <IBCocoaTouchPlatformToolDescription: 0x7faa8daf1730> System content for IBCocoaTouchFramework-ElevenAndLater <IBScaleFactorDeviceTypeDescription: 0x7faa88a21180> scaleFactor=2x, renderMode.identifier=(null): Failed to find or create execution context for description '<IBCocoaTouchPlatformToolDescription: 0x7faa8daf1730> System content for IBCocoaTouchFramework-ElevenAndLater <IBScaleFactorDeviceTypeDescription: 0x7faa88a21180> scaleFactor=2x, renderMode.identifier=(null)'.
? 我這邊出現(xiàn)此報錯是因為老版的Unity導出的Xcode工程中LaunchScreen-iPhone.storyboard和新版本Xcode不兼容,所以出現(xiàn)模擬器進程運行不了。
1>不是配置自動打包的項目
可以直接終端執(zhí)行? “killall -9 com.apple.CoreSimulator.CoreSimulatorService”或者重新創(chuàng)建一個新的LaunchScreen-iPhone.storyboard并做適配都可以解決此問題
2>配置自動打包的項目
對于該問題為什么我會出一個講解是因為看了不少文章,有些建議直接使用如下指令:
sudo?killall -9 com.apple.CoreSimulator.CoreSimulatorService
執(zhí)行超級用戶權限,這種方式我再shell運行的過程中需要輸入用戶密碼,這是可以在前面加上如下代碼:
? echo 'xxx' | sudo -S ls -a? #xxx代表電腦的開機密碼
? sudo killall -9 com.apple.CoreSimulator.CoreSimulatorService
將此代碼放到shell自動打包腳本中TEST階段沒什么問題,但是配置完畢Jenkins打包的時候就會莫名的卡死:

后來經(jīng)過測試發(fā)現(xiàn)我殺死CoreSimulatorService,是不需要超級用戶權限,所以再進行自動打包的時候,需要將CoreSimulatorService指令放在Unity導出Xcode工程后,緊接著執(zhí)行如下指令即可:
killall -9 com.apple.CoreSimulator.CoreSimulatorService
shell腳本設置完事,再Jenkins打包,ipa包順利打出。
