DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Last call! Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • In-App Browsers in Mobile Apps: Benefits, Challenges, Solutions
  • How To Install Live Chat and Chatbot Using PhoneGap SDK
  • Cordova: Communicating Between JavaScript and Java
  • Ionic App Development Over Other Frameworks: Is It Hyped?

Trending

  • AI-Based Threat Detection in Cloud Security
  • The Modern Data Stack Is Overrated — Here’s What Works
  • Scalable System Design: Core Concepts for Building Reliable Software
  • Unlocking AI Coding Assistants Part 3: Generating Diagrams, Open API Specs, And Test Data
  1. DZone
  2. Coding
  3. Frameworks
  4. Important Note for Targeting iOS Emulators in Cordova

Important Note for Targeting iOS Emulators in Cordova

A great tip to help you work out which emulators are available when testing your applications

By 
Raymond Camden user avatar
Raymond Camden
·
Oct. 15, 15 · Tutorial
Likes (2)
Comment
Save
Tweet
Share
4.8K Views

Join the DZone community and get the full member experience.

Join For Free

With the recent changes to iOS9, I’ve had to do more testing in iOS 8.4 versus 9.0 when working on Ionic/Cordova applications. It is relatively easy to switch which emulator you are using if you use the –target argument in the CLI:

cordova emulate ios --target="something"

Of course, the question is, what value do you use for “something”? My coworker Carlos Santana has an excellent answer over on Stackoverflow. Basically if you run:

./platforms/ios/cordova/lib/list-emulator-images


You will get a list of valid targets for your simulator. As an aside, how many of you ever dig around in your platforms folder? Did you even know this tool existed? Should I write up an exploration of this folder? Ok, stay on target, Raymond.

Running this command will give you output that looks like this:


iPad-Air, 8.4
iPad-Air, 8.4
iPad-Air, 8.4
iPad-Air, 9.0
iPhone-6, 8.4
iPhone-6, 8.4
iPhone-6, 8.4
iPhone-6, 9.0
iPhone-6-Plus, 8.4
iPhone-6-Plus, 8.4
iPhone-6-Plus, 8.4
iPhone-6-Plus, 9.0

The list above is about half of my list and your list will be different. Ok, problem solved, right? Not so fast. What happens when you try to target the 8.4 version of the iPhone?

cordova emulate ios --target="iPhone-6, 8.4"


shotA


Wtf? Confusing, right? If you keep reading on that StackOverflow page, you come to this answer by Ruslan Soldatenko. He points out that the platforms/ios/cordova/lib/run.js file has a specific list of allowed targets. I’m sure there is a good reason for this. Maybe the Cordova CLI doesn’t want to keep asking the system for valid targets. Either way, if you open it up, you will find a line like this:

var validTargets = ['iPhone-4s', 'iPhone-5', 'iPhone-5s', 'iPhone-6-Plus', 'iPhone-6',
        'iPad-2', 'iPad-Retina', 'iPad-Air', 'Resizable-iPhone', 'Resizable-iPad'];

Add “iPhone-6, 8.4” to the end of the array and you are good to go… for this project only. You’ll need to modify this line in every project you work with where you need to target different iOS versions.

As an aside, this (obviously) applies to Ionic and their CLI.

Apache Cordova

Published at DZone with permission of Raymond Camden, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • In-App Browsers in Mobile Apps: Benefits, Challenges, Solutions
  • How To Install Live Chat and Chatbot Using PhoneGap SDK
  • Cordova: Communicating Between JavaScript and Java
  • Ionic App Development Over Other Frameworks: Is It Hyped?

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends: