ionicで新規アプリを作成して、iosデバイスでテスト実行するまでの手順(ionic-cli)
- ionic version 3.6.0
ionicで新規プロジェクトを作成
ionic start buildtest blank
事前準備
デバイスで実行する前に以下のインストールが必要
npm install -g ios-deploy
config.xml
初期状態は以下の通り
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<widget id="io.ionic.starter" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>MyApp</name>
<description>An awesome Ionic/Cordova app.</description>
<author email="hi@ionicframework" href="http://ionicframework.com/">Ionic Framework Team</author>
このままだと、idがビルドした時のbundle identiferになるので、書き換える。
アプリ名、メールアドレスなども、自分の希望するものに適宜変更
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<widget id="com.firstfournotes.buildtest" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>BuildTestApp</name>
<description>Buildtest app.</description>
<author email="xxxxx@firstfournotes.com" href="http://firstfournotes.com/">FirstFourNotes,LLC</author>
build.json
ビルド用のプロビジョニング定義を書きます
{
"ios": {
"debug": {
"codeSignIdentity": "iPhone Developer",
"developmentTeam": "{team name}",
"packageType": "development"
},
"release": {
"codeSignIdentity": "iPhone Developer",
"developmentTeam": "{team name}",
"packageType": "app-store"
}
}
}
実行
- iosプラットフォームの追加
ionic cordova platform add ios
- デバイスで実行
iPhoneつなぎましょう
ionic cordova run ios --debug --buildConfig build.json --device
- 途中でキーチェーンへのアクセスを許可するかどうかが出て来ます
「常に許可」
起動とエラー
最後にエラーとなってしまうのだけど、デバイスにアプリは転送されて立ち上げることはできています。
------ Debug phase ------
Starting debug of xxxxxxxxx (N66mAP, iPhone 6s Plus, iphoneos, arm64) a.k.a. 'xxxxx' connected through USB...
2017-07-30 08:16:18.120 ios-deploy[37159:2940059] [ !! ] Unable to locate DeviceSupport directory. This probably means you don't have Xcode installed, you will need to launch the app manually and logging output will not be shown!
Error: Error code 253 for command: ios-deploy with args: --justlaunch,--no-wifi,-d,-b,/Users/xxxxxx/gitLab/lab/buildtest/platforms/ios/build/device/BuildTestApp.app
[ERROR] Cordova encountered an error.
You may get more insight by running the Cordova command above directly.
[ERROR] An error occurred while running cordova run ios --debug --device --buildConfig build.json (exit code 1).
Xcodeを一度立ち上げないとダメなのか。。_
上記のエラーを消す方法を探し中。