Xcode15 archive及apns推送BadDeviceToken報錯

前言

將mac打包機(jī)升級到xcode15后出現(xiàn)一系列莫名其妙的錯誤,特記錄下

一、archive失敗

"Provisioning profile "iOS Team Provisioning Profile" doesn't include the currently selected device "xxx's Macmini"
解決方案,在xcodebuild arhive里增加-destination 'generic/platform=iOS',
參考 Apple M1芯片 自動打包問題解決方案 Xcode 12 iOS 打包失敗
demo如下:

#### Archive ######
xcodebuild archive -workspace "xxxx" \
-scheme "xxxx" \
-configuration "Release" \
-archivePath "xxxx" -destination 'generic/platform=iOS'

二、xcodebuild -exportArchive失敗一直報

No profiles for 'xx.xxx.xxx' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'xx.xxx.xxx'. (in target 'xxxx' from project 'xxxxx') ** BUILD FAILED **

解決方案:
1、檢查ExportOptions.plist里的teamIDbundleId對應(yīng)的賬號是否一致,我一開始不一致導(dǎo)致很久才檢查到這個問題

image.png

2、在xcodebuild -exportArchive增加參數(shù)-allowProvisioningUpdates,可以及時更新描述文件,demo如下

### Export ipa #####
xcodebuild -exportArchive \
-archivePath "xxxx" \
-exportPath "xxxx" \
-exportOptionsPlist "xxxx" \
-allowProvisioningUpdates

還遇到另一個離奇的問題,在使用xcode14打包時,ExportOptions.plist配置的只有一套,method都是development,打出來的包apns推送功能都很正常,但是使用xcode15打出來的包推送時一直報BadDeviceToken, 后來反復(fù)比對,發(fā)現(xiàn)手動archive并選擇adhoc的包推送是正常的,但是使用腳本xcode exportArchive導(dǎo)出的包推送就會報錯,然后檢查發(fā)現(xiàn)是ExportOptions.plistmethod與手動不一致,也需要按adhoc來處理,這個具體應(yīng)該是adhoc還是development,根據(jù)推送的需要來定,但是奇怪的是xcode14沒有這個問題

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

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

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