shenku
shenku

Reputation: 12448

Why is my Ionic2 app always serving as Android app?

I am using ionic2 to develop and ios app - I typically test this locally using ionic serve, after an ionic build ios

At one stage I wanted to demostrate the android capability, and built/served it in the same way for android.

Ever since i am unable to serve the ios version?

What gives, is there some config that has changed that I should delete or similar?

Here is my current config:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<widget id="com.ionicframework.myionic2463102" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
  <name>MyIonic2</name>
  <description>An Ionic Framework and Cordova project.</description>
  <author email="hi@ionicframework" href="http://ionicframework.com/">Ionic Framework Team</author>
  <content src="index.html"/>
  <access origin="*"/>
  <allow-intent href="http://*/*"/>
  <allow-intent href="https://*/*"/>
  <allow-intent href="tel:*"/>
  <allow-intent href="sms:*"/>
  <allow-intent href="mailto:*"/>
  <allow-intent href="geo:*"/>
  <platform name="android">
    <allow-intent href="market:*"/>
  </platform>
  <platform name="ios">
    <allow-intent href="itms:*"/>
    <allow-intent href="itms-apps:*"/>
  </platform>
  <preference name="webviewbounce" value="false"/>
  <preference name="UIWebViewBounce" value="false"/>
  <preference name="DisallowOverscroll" value="true"/>
  <preference name="android-minSdkVersion" value="16"/>
  <preference name="BackupWebStorage" value="none"/>
  <preference name="SplashScreenDelay" value="2000"/>
  <preference name="FadeSplashScreenDuration" value="2000"/>
  <feature name="StatusBar">
    <param name="ios-package" onload="true" value="CDVStatusBar"/>
  </feature>
</widget>

Upvotes: 3

Views: 263

Answers (2)

sebaferreras
sebaferreras

Reputation: 44659

You can also set the platform in the url (directly in the browser) and preview the android/ios version of the app like this:

http://localhost:8100/?ionicPlatform=ios
http://localhost:8100/?ionicPlatform=android

UPDATE:

You can also set the target platform in the serve command like this

ionic serve -t android
ionic serve -t ios

You can find more information about the serve command in Ionic CLI docs

Upvotes: 3

Manu Vald&#233;s
Manu Vald&#233;s

Reputation: 2372

You can force the platform in ionic serve with the --platform option, in your case ionic serve --platform ios

Upvotes: 1

Related Questions