iT邦幫忙

2017 iT 邦幫忙鐵人賽
DAY 8
2
Cloud

Xamarin.Forms, ASP.NET Core WEB API搭配AZURE服務與資料庫服務整合應用實例系列 第 8

Day08 - IOS實機部署測試 Part 1

看了相關網頁, 便開始猶豫要不要寫這篇, 因為過程有點繁瑣, 與其說麻煩到不如說是Apple對於開發部署是相當嚴謹的, 重點是若要實機部署是需要Apple developer account, 年費是$USD 99, 既然要打怪強迫自己升級, 就把頭洗下去了, 申請Apple developer account就不贅述了, 網路上可以google到很多文章, 這一關堪稱是實機測試篇的大魔王, 尤其對於一個MAC新手來說.

首先看一下底下的文章, 介紹實機部署需要的東西, 主要就是四個, 開發者憑證, Device Register, App ID與 Provisioning Profile, 所以Part 1就介紹如何取得這四個關鍵道具
https://developer.xamarin.com/guides/ios/getting_started/installation/device_provisioning/
http://ithelp.ithome.com.tw/upload/images/20161209/20103333jezpIIC4SK.png

首先要產生.certSigningRequest (CSR) 檔案, 到底下紅框所示, 點擊Keychain Access
http://ithelp.ithome.com.tw/upload/images/20161209/20103333yuOTXhXzHc.png

之後點擊Certificate Assistant, 選擇Request a Certificate From a Certificate Authority如紅框所示
http://ithelp.ithome.com.tw/upload/images/20161209/201033331Vq7Ju2IeQ.png

之後輸入Email 跟點選Saved to disk, 按下Continue
http://ithelp.ithome.com.tw/upload/images/20161209/20103333dt22cIE8tM.png

然後將檔案存到桌面
http://ithelp.ithome.com.tw/upload/images/20161209/20103333ngaru61hCw.png

接著可以看到桌面的檔案, 並且在Keychain Access裡面, 可以看到過程中產生的public key跟private key如紅框所示
http://ithelp.ithome.com.tw/upload/images/20161209/20103333UVxg299BWW.png

之後登入Apple Developer網站, 在Development項目, 點擊Certificate Signing Request
http://ithelp.ithome.com.tw/upload/images/20161209/20103333m1f9jwg1oj.png

點選iOS App Development
http://ithelp.ithome.com.tw/upload/images/20161209/20103333XGcfrBlPFz.png

接著出現說明頁面, 按下Continue
http://ithelp.ithome.com.tw/upload/images/20161209/20103333sBXhF9JRUw.png

選擇剛剛產生在桌面的檔案, 然後上傳
http://ithelp.ithome.com.tw/upload/images/20161209/20103333PbWx0VYCpN.png

之後就可以下載開發者憑證
http://ithelp.ithome.com.tw/upload/images/20161209/20103333mJ99k9rg4y.png

檔案下載後如下
http://ithelp.ithome.com.tw/upload/images/20161209/20103333otagabomoV.png

之後點擊這個憑證檔, 安裝到Keychain裡
http://ithelp.ithome.com.tw/upload/images/20161209/20103333jgPkn33WFN.png

安裝完畢後, 就可以在Keychain看到它, 到這邊第一個道具取得
http://ithelp.ithome.com.tw/upload/images/20161209/20103333gzgYOCd75I.png

接下要把註冊實機IPHONE, 讓它可以變成可以測試部署用, 但由於要VM裡MAC OS認得IPHONE, 必須要將USB裝置設為2.0, 才抓的到如下圖所示
http://ithelp.ithome.com.tw/upload/images/20161209/20103333N46gk3eWrN.png
http://ithelp.ithome.com.tw/upload/images/20161209/20103333f6Ckt7SoA3.png

接著在iTunes就可以看到這台IPHONE, 找到序號顯示的地方, 並點擊它
http://ithelp.ithome.com.tw/upload/images/20161209/20103333ZuIo4itff6.png

之後會看到UDID, 這個要複製下來, 等下會用到
http://ithelp.ithome.com.tw/upload/images/20161209/20103333l5NpZgJUsU.png

之回到開發者網站, 在Device項目裡, 點選manually register devices
http://ithelp.ithome.com.tw/upload/images/20161209/20103333hhw0db300p.png

填入剛剛的UDID
http://ithelp.ithome.com.tw/upload/images/20161209/201033337ilY9Fverl.png

之後按下Register, 就完成註冊, 到這邊算是取得第二個道具
http://ithelp.ithome.com.tw/upload/images/20161209/20103333hwR9pWbmSc.png
http://ithelp.ithome.com.tw/upload/images/20161209/20103333SLgvK8TlYl.png

之後點選Provisioning Profile, 點擊manually generate profiles如下圖所示
http://ithelp.ithome.com.tw/upload/images/20161209/20103333Tw4wsq1xGW.png

點選 iOS App Development
http://ithelp.ithome.com.tw/upload/images/20161209/20103333lKKP7oLmyV.png

接著會看到沒有App ID可以選, 需要新建一個
http://ithelp.ithome.com.tw/upload/images/20161209/2010333372Jd81n1Uj.png

填入App ID Description, 並選擇Wildcard App ID如下紅框所示
http://ithelp.ithome.com.tw/upload/images/20161209/20103333zQ0u0nsdrj.png
http://ithelp.ithome.com.tw/upload/images/20161209/20103333WFryLl9UJI.png

完成畫面如下, 第三個關鍵道具取得http://ithelp.ithome.com.tw/upload/images/20161209/20103333HVSa6C6PFq.png

接著回到Add iOS Provisioning Profile畫面, 就可以看到剛剛建立的App ID
http://ithelp.ithome.com.tw/upload/images/20161209/20103333mrggisEVCL.png

接著選擇開發者憑證
http://ithelp.ithome.com.tw/upload/images/20161209/20103333H8zfZhjNYB.png

選擇剛剛註冊的IPHONE
http://ithelp.ithome.com.tw/upload/images/20161209/20103333AbO8QvhL13.png

填入Profile Name
http://ithelp.ithome.com.tw/upload/images/20161209/20103333Z7BWJwb4a1.png

之後便可以將provisioning profile下載下來
http://ithelp.ithome.com.tw/upload/images/20161209/20103333kocLUUe3Io.png

下載完成如下圖所示, 第四個道具取得
http://ithelp.ithome.com.tw/upload/images/20161209/20103333QQcdtBq6P7.png

後記: 以上過程對於熟悉iOS App 應該是很容易, 對於門外漢的我來說, 著實花了不少時間, 今天就寫到這, 明天再戰!


上一篇
Day07 - IOS模擬器部署測試
下一篇
Day09 - IOS實機部署測試 Part 2
系列文
Xamarin.Forms, ASP.NET Core WEB API搭配AZURE服務與資料庫服務整合應用實例32
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

1 則留言

0
海綿寶寶
iT邦大神 1 級 ‧ 2016-12-23 09:46:35

Xamarin 是「開發一次,跨多平台」的開發環境
可是還是避免不了在部署階段各平台的不同要求

以我只會寫iOS native app的身分來看
您寫的這系列文章寫得真詳細

我要按三個讚
/images/emoticon/emoticon12.gif/images/emoticon/emoticon12.gif/images/emoticon/emoticon12.gif

arksu iT邦新手 2 級 ‧ 2016-12-23 12:53:58 檢舉

感謝海大支持/images/emoticon/emoticon41.gif

我要留言

立即登入留言