ionic項目ios真機部署(不需開發者賬號)
-
安裝ionic和cordova
npm install -g ionic
npm install -g cordova
-
創建一個新項目
ionic start app_name template_name
-
進入項目目錄
cd app_name
,添加平台ionic cordova platform add ios/android
-
在真機上運行需要
npm install -g ios-deploy ``` 在虛擬機運行時需要 ``` npm install -g ios-sim ```
-
利用xcode在真機上部署ios項目
找到項目文件夾,platforms -> iOS -> xxx.xcodeproj 文件,雙擊打開(即在xcode中打開了這個項目)點擊 菜單欄 xcode -> preferences -> Accounts 添加Apple ID賬號
點擊窗口左側項目名,顯示項目信息,按下圖修改 -
運行:將設備通過數據線臉上電腦,在窗口左上角運行按鈕的右側選擇你的設備后,點擊運行,即可開始真機部署;
或在命令行輸入
ionic cordova run ios
一些錯誤及解決方案
-
錯誤:ios-deploy not found error when running from command line "ionic run ios --device" under El Capitan.
- 解決方法:
npm install -g ios-deploy
- 解決方法:
-
錯誤:Failed to create provisioning profile.The app ID "io.ionic.starter" cannot be registered to your development team. Change your bundle identifier to a unique string to try again.
- 解決方法:
修改xcode中bundle identifier至合理為止
- 解決方法:
-
即使填寫的bundle identifier可用,有時還會出現無法獲取Provisioning Profile和Signing Certificate的現象,試一試檢查你的網絡(可以打開vpn試一試)
by 一顆球
update at 23:41 2017/9/12