tyoshikawa1106のブログ

- Force.com Developer Blog -

SFDC:Building an Ionic2 App with the Salesforce Mobile SDKを試してみました

海外の開発者の方が公開してくれたブログ、Building an Ionic2 App with the Salesforce Mobile SDKを試してみました。Ionic2は現在ベータ版です。

f:id:tyoshikawa1106:20160314132450p:plain

Building an Ionic2 App with the Salesforce Mobile SDK - Oyecode


次のコマンドでIonic2とcordovaの環境を用意します。

$ cd desktop
$ cd work
$ sudo npm install -g ionic@beta
$ sudo npm install -g cordova

次のコマンドでIonicアプリを作成します。

$ ionic start myApp salesforce
$ cd myApp
$ ionic platforms update ios
$ ionic plugin add https://github.com/forcedotcom/SalesforceMobileSDK-CordovaPlugin

次のコマンドでemulateコマンドが実行できるようになります。

$ npm install -g ios-sim


次のコマンドでビルドが実行されます。

$ ionic build ios 


ビルドエラーが発生したら次のコマンドで解決するかも・・・

$ ionic platform remove ios
$ ionic platform add ios


次のコマンドでエミュレータが起動します。

$ ionic emulate ios


エミュレータのtargetが見つからないというようなエラーがでた場合は次のコマンドで解決できると思います。

$ ionic emulate ios --target="iPhone-6, 9.2"

9.2はOSのバージョン、XCodeのDeviceメニューから確認できます。


・・・自分の環境ではエミュレータに正しく表示されましせんでした。


続きです。

$ sudo npm install -g force-server 
$ cd www/
$ force-server


先ほどのiOSエミュレータではうまく行きませんでしたが、force-severの方はうまくいきました。
f:id:tyoshikawa1106:20160314141242p:plain