iT邦幫忙

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

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

Day07 - IOS模擬器部署測試

由於是將MAC OSX跑在VMWARE裡, 但VMWARE與Hyper-V是無法同時啟動的, 所以需用指令來控制Hyper-V的啟動與關閉
http://ithelp.ithome.com.tw/upload/images/20161208/20103333IryKcfoHro.png

指令如下
關閉hypervisor:bcdedit /set hypervisorlaunchtype off
啟用hypervisor:bcdedit /set hypervisorlaunchtype auto
關閉和啟用指令於命令提示字元執行後須重開機才會生效
http://ithelp.ithome.com.tw/upload/images/20161208/20103333oQX9L3ylyn.png
http://ithelp.ithome.com.tw/upload/images/20161208/20103333nIufI04r1F.png

且在VMWARE裡, VM的CPU設定如下, 不然VM會跑不起來
http://ithelp.ithome.com.tw/upload/images/20161208/201033335D639kO5wU.png

由於IOS模擬器部署是透過Xcode叫用, 所以要先裝Xcode
http://ithelp.ithome.com.tw/upload/images/20161208/20103333GE72wl14lz.png

之後下載Xamarin Studio Community
https://www.xamarin.com/download
http://ithelp.ithome.com.tw/upload/images/20161208/20103333QQrkunK1oF.png

接著安裝Xamarin Studio Community
http://ithelp.ithome.com.tw/upload/images/20161208/20103333tUjjfKBKeP.png

一路安裝到底
http://ithelp.ithome.com.tw/upload/images/20161208/20103333rmbSf1ATH0.png
http://ithelp.ithome.com.tw/upload/images/20161208/201033338HCG49f4b0.png
http://ithelp.ithome.com.tw/upload/images/20161208/2010333331Gn0LuGod.png
http://ithelp.ithome.com.tw/upload/images/20161208/20103333h4oQhYtGM7.png

接著打開Xamarin Studio先測試
http://ithelp.ithome.com.tw/upload/images/20161208/20103333Bu7OCjZ7OA.png

開啟一個新專案
http://ithelp.ithome.com.tw/upload/images/20161208/20103333rEOi21AlO0.png

選擇Forms App專案類型
http://ithelp.ithome.com.tw/upload/images/20161208/20103333UmBdAAwESG.png

填入App名稱
http://ithelp.ithome.com.tw/upload/images/20161208/20103333qXReSM2NJz.png

填入專案名稱
http://ithelp.ithome.com.tw/upload/images/20161208/20103333LG0qZThHIe.png

按下紅框處, 直接部署
http://ithelp.ithome.com.tw/upload/images/20161208/20103333Sty0srlOKv.png

IOS模擬器就跑起來了, 這麼輕鬆愉快就成功, 有嚇到本魯^^
http://ithelp.ithome.com.tw/upload/images/20161208/20103333MjoiFcg0O9.png

之後打開Visual Studio, 現在可以對底下的Remote Login做設定
http://ithelp.ithome.com.tw/upload/images/20161208/20103333vCHWIpFg08.png

找不到上述畫面的, 也可以在底下位置啟動Xamarin Mac Agent
http://ithelp.ithome.com.tw/upload/images/20161208/20103333dQpNZoMPXW.png

點擊Add Mac
http://ithelp.ithome.com.tw/upload/images/20161208/20103333qtcHC89i3Z.png

輸入IP Address
http://ithelp.ithome.com.tw/upload/images/20161208/20103333I3fJH00Xjs.png

結果Login反灰, 不能按, 果然沒這麼簡單
http://ithelp.ithome.com.tw/upload/images/20161208/20103333Mnsqn2M8dE.png

看了一下說明, 在Mac裡Sharing要啟用Remote Login的功能如下圖
http://ithelp.ithome.com.tw/upload/images/20161208/20103333i1r9vhZzGR.png

勾選Remote Login 然後重啟MAC
http://ithelp.ithome.com.tw/upload/images/20161208/20103333aifcv9KAEF.png

回到Visual Studio, 不用再輸入IP, 會直接搜尋到VM裡的MAC, 按下Connect
http://ithelp.ithome.com.tw/upload/images/20161208/20103333qC1FPmRuNI.png

不是吧~大人 囧rz, 還是反灰不能按
http://ithelp.ithome.com.tw/upload/images/20161208/20103333zUU4Lrhko3.png

好吧, 只好把Log叫出來看
http://ithelp.ithome.com.tw/upload/images/20161208/20103333VuxOmkLcI6.png

找到底下紅色框這行, 說是拒絕連線, Google了半天, 沒找到相關解法, 都是說Mac Remote Login啟用就能連線
http://ithelp.ithome.com.tw/upload/images/20161208/20103333AitxgC3EdL.png

起心動念一想不會是防毒軟體擋住了吧, 立馬把Windows Defender停用試試
http://ithelp.ithome.com.tw/upload/images/20161208/20103333Ihgtwmj6tL.png

回到Visual Studio裡, Login能按了~ WTF
http://ithelp.ithome.com.tw/upload/images/20161208/20103333MABvhgI8XJ.png

接著就看到跟MAC順利連上
http://ithelp.ithome.com.tw/upload/images/20161208/201033337nrdsXiQyM.png

Visual Studio裡也能看到IOS模擬器列表
http://ithelp.ithome.com.tw/upload/images/20161208/20103333uerRGuAf0a.png

一樣先Build再Deploy, 就可以順利部署了
http://ithelp.ithome.com.tw/upload/images/20161208/20103333ONnywoCHdt.png

後記: 有被Windows Defender陰到的感覺, 鬼打牆了好幾個小時>”<


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

尚未有邦友留言

立即登入留言