選單
GSS 技術部落格
在這個園地裡我們將從技術、專案管理、客戶對談面和大家分享我們多年的經驗,希望大家不管是喜歡或是有意見,都可以回饋給我們,讓我們有機會和大家對話並一起成長!
若有任何問題請來信:gss_crm@gss.com.tw
6 分鐘閱讀時間 (1133 個字)

更新 Mac App 憑證

young-man-working-on-the-macbook-mockup-in-the-bright-office

更新 Mac App 相關憑證

當 Mac App 憑證( provisioning profile ) 要過期之前,我們要有一個更新憑證的 SOP,避免新的使用者 下載到過期的 Mac App 造成無法順利安裝 的狀況發生。
 
在這篇文章中,我們會紀錄 mac distribution app ( 非 app store app ) 的詳盡更新步驟。

更新 Mac App 相關憑證需要以下兩個需求:
  • 需使用 MacOS 來操作
  • 需以 Team Agent 權限來執行
 
而我們要更新的項目有兩個:
  • developer ID certificate:是否要更新視情況而定
  • provisioning profile:一定要更新
讓我們先從更新 developer ID certificate 開始。

新建一個 developer ID certificate

如上所說,developer ID certificate 並不是每次 provisioning profile 要過期就要一起更新,只有在 developer ID certificate 本身也已經要過期時,我們才需要一併更新。反之,若 developer ID certificate 尚未接近過期時間,則可以跳過這個步驟不做。
 
更新 developer ID certificate 的方式實際上就是重新新建一張全新的 developer ID certificate,因為我們並無法改變單一張 developer ID certificate 的過期時間。
 
以下是我們新建 developer ID certificate 的步驟:

到 Apple Developer Center 新建 developer ID certificate

1. 以 Team Agent 身份登入 Apple Developer Center
2. 按左導覽列的 Certificates, Identifiers & Profiles 後,會進入憑證管理頁 
3. 在左側下拉式選單選擇 macOS
 
4. 按 Certificate 類別下的 Production 
5. 按 + 以新建 certificate 
6. 選擇 Developer ID 後按 Continue
 
7. 接下來會進入 Select the certificate you want to generate 的頁面,選擇 Developer ID Application 後按 Continue
8. 接下來會進入 About Creating a Certificate Signing Request (CSR) 的頁面,並跟著步驟來創建 CSR

使用 Keychain Access 創建 CSR

1. 開啟 Keychain Access App 
2. 在 Keychain Access 最上面的選單中選擇 鑰匙圈存取 -> 憑證輔助程式 -> 從憑證授權要求憑證
 
3. 在創建 CSR 的視窗,輸入以下訊息:
- 使用者電子郵件位置:輸入自己的電子郵件
- 一般名稱:輸入 private key 的名稱
- CA 電子郵件位置:保持空白
- 已將要求:選擇 儲存到磁碟
 
4. 跟著步驟將 CSR 存起來

回到 Apple Developer Center 繼續創建 developer ID certificate

1. 回到剛剛 Apple Developer Center 新建 developer ID certificate 的頁面,按下 Continue,會進入 Generate your certificate 的頁面.
2. 按下 Choose File... 並選擇剛剛新建的 CSR 上傳
 
3. 上傳完成後,按下 Generate,會進 Your certificate is ready. 的頁面
4. 按 Download 下載 certificate。certificate 的副檔名會是 .cer
5. 按下 Done

將 developer ID certificate 加入 Keycain Access

1. 雙擊剛剛下載下來的 developer ID certificate (.cer 檔)
    - 這動作會打開 Keychain Access 並自動將此憑證匯入進去
2. 確認該 developer ID certificate 是否出現在 類別 -> 我的憑證 中,且展開後應該會看到對應的 private key

將 developer ID certificate 輸出成 .p12 檔

1. 開啟 Keychain Access
2. 在 類別 -> 我的憑證 中,展開剛剛匯入的 developer ID certificate
3. 同時選擇 developer ID certificate 與 private key,並點右鍵選擇 輸出 2 個項目
 
4. 輸入名稱 & 位置後,按下 儲存
 
5. 如要設定 .p12 的密碼,可在視窗中的 密碼: 與 驗證中輸入欲設定的密碼;如不設定 .p12 的密碼,留白即可。設定完好按下
 
6. 當跳出是否 「鑰匙圈存取」想輸出鑰匙圈中的密鑰「privateKey」 視窗時,輸入 mac 的密碼後,按 永遠允許
 
7. 將 .p12  交給其他需要建置此 Mac App 的開發者

更新 provisioning profile

更新完 developer ID certificate 後,就可以開始更新 provisioning profile 了。
以下是我們新建 provisioning profile 的步驟:

到 Apple Developer Center 新建 provisioning profile

1. 以 Team Admin / Team Agent 登入 Apple Developer Center
2. 按左導覽列的 Certificates, Identifiers & Profiles 後,會進入憑證管理頁
3. 在左側下拉式選單選擇 macOS
 
4. 到 Certificates -> Production 中,找到對應的 developer ID certificate 點擊 Download 下載 .cer 檔 (也就是上個大步驟 Generate 出來的憑證)
5. 按 Provisioning Profiles 類別下的 Distribution
6. 找到 目標 provisioning profile 並點開,provisioning profiles 中的詳細內容即會展開 
7. 按下 目標 provisioning profile 詳細內容中的 Edit 按鈕
8. 在 certificates 的欄位中,上傳剛下載的 developer ID certificate (.cer 檔)
9. 按 Generate 來製作 provisioning profile
10. 按 Download 來下載 provisioning profile,副檔名會是 .provisionfile
11. 把 .provisionfile 檔匯入 XCode 中,建置新的 Mac App,並將新建置的 Mac App 發佈
完成這些步驟後,更新憑證完成。

步驟總覽

以下為更新步驟總覽:
  • 新建一個 developer ID certificate
    • 到 Apple Developer Center 新建 developer ID certificate
    • 使用 Keychain Access 創建 CSR
    • 回到 Apple Developer Center 繼續創建 developer ID certificate
    • 將 developer ID certificate 加入 Keycain Access
    • 將 developer ID certificate 輸出成 .p12 檔
  • 更新 provisioning profile
    • 到 Apple Developer Center 新建 provisioning profile

參考資料

Swagger for Web API Document - Part Ⅰ
使用 IoC 進行專案的客製

相關文章

 

評論

尚無評論
已經注冊了? 這裡登入
Guest
2024/05/16, 週四

Captcha 圖像