Unity 如何釋出到Mac App Store
最近蛋疼的需要釋出unity遊戲到Mac App Store,網上的教程不太多,第一搞有點蛋疼,各種證書搞糊塗了,就這機會惡補下apple的相關證書。
官網上大概描述了整個事情的流程,但是各種細節還待完善。
下面就整個過程整理如下:
申請證書
需要到 https://developer.apple.com/ 上去註冊Mac證書, 這裡需要註冊兩個證書,分別是 Mac App Distribution 和 Mac Installer Distribution 。 然後就是生成 Provisioning Profile,生成之後下載匯入到Xcode中(這裡可能也需要些技巧,因為直接雙擊profile似乎不能匯入,網上百度教程吧,但是有時好奇怪,我檢視證書的詳細資訊之後雙擊又能夠安裝了,好糾結。。。)。
為了說的明白,上幾張圖(感謝小夥伴提供的原圖)
下載申請的證書,雙擊安裝,在鑰匙串裡就能看到了。
其他的過程類似,就不細說了,不明白的地方留言。
Unity配置
1.Build Settings設定
2.PlayerSetting設定
bundle 、公司名、遊戲名等正常設定就行
Mac App Store Validation (測試時不要勾,釋出時要勾上)
3.直接build生成本地App
App包內容設定
選擇對應app,點選右鍵選擇顯示包內容,如圖:
修改這個info.plist檔案,如圖:
簽名打包上傳
1.簽名
簽名方法有兩種:一種是xcode工具自動簽名,另外一種是通過命令手動簽名。由於unity生成的工程檔案是app,不能有xcode自動簽名,那麼只能採用手動簽名了。
①準備entitlements授權檔案
直接建立新檔案,新增如下內容:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>com.apple.security.app-sandbox</key> <true/> </dict> </plist>
儲存檔案,命名為YourGameName.entitlements即可,字尾一樣,名字無所謂。
②授權
給app及子目錄檔案賦值許可權
chmod -R a+xr "YourAppName.app"
③簽名
codesign -f --deep -s '3rd Party Mac Developer Application: cerName' --entitlements “appname.entitlements” “appname.app”
簽名之後,包裡會多一個資料夾”_CodeSignature”。
2.打包
打包pkg,命令如下:
productbuild --component “appname.app” /Applications --sign "3rd Party Mac Developer Installer: cername" appname.pkg
3.上傳Mac App Store
終於完了,祝你好運。