The iOS Simulator is a Virtual Machine or a Emulator? - ios

The iOS simulador that installs with Xcode is a VM or a emulator like Android does?

It's neither a Virtual Machine nor an Emulator. It's a simulator, in another words it's a standard mac application which mimic the behaviour of iOS devices. It mimics most of the features of an actual devices, but lacks some major features. So you need to use a real device for testing some of the real world scenarios.
You can read more about simulators here : About Simulator
I would like to quote some key information from the above linked page:
What is Simulator
Simulator allows you to rapidly prototype and test builds of your app
during the development process. Installed as part of the Xcode tools,
Simulator runs on your Mac and behaves like a standard Mac app while
simulating an iPhone, iPad, Apple Watch, or Apple TV environment.
Think of the simulator as a preliminary testing tool to use before
testing your app on an actual device.
Need of actual device for Testing
Simulator is a useful tool, but it should not be the only way you test
an app. Because the simulator is an app running on a Mac, it has
access to the computer’s resources, including the CPU, memory, and
network connection. All of these resources are likely to be faster
than those found on a mobile device. As a result, the simulator is not
an accurate test of an app’s performance, memory usage, and networking
speed. For this same reason, always test the performance of your app’s
user interface on a device. In Simulator, your app’s user interface
may appear to run both faster and smoother than on a device.
Also keep in mind that some user interface elements can be easier to
interact with in Simulator using a mouse than when trying to interact
with the app through touch on a device.
Finally, there are some hardware and API differences in Simulator.
These differences may affect your app when testing in Simulator.

Related

What's the point of have multiple (same resolution) iOS simulators?

I've been developing iOS apps for some time now and I'm aware that the iOS simulators run code faster than their hardware counterparts - i.e. actual devices. I read the following on Apple's Testing and Debugging in Simulator documentation site.
Because the simulator is an app running on a Mac, it has access to the computer’s resources, including the CPU, memory, and network connection. All of these resources are likely to be faster than those found on a mobile device. As a result, the simulator is not an accurate test of an app’s performance, memory usage, and networking speed.
I understand that completely. I also understand that it's important to have multiple simulators to test different size-classes/resolutions.
What I don't understand, however, is why Apple include so many simulators for devices with the same resolution. See the following picture showing iPhone 6, 6s and 7 - all of which have the same screen size and resolution.
Given that the simulator runs at 'full speed' (regardless of which devices its actually simulating), what's the point of having all those simulators (each taking up a few GB of storage)?
Thanks in advance,
Loic
Each device type attempts to simulate the respective physical device, including features like the presence of force touch. If your trackpad supports force touch the Simulator will translate that into force on the simulated device, but only for device types that support it. There are also things like graphics class and memory class that enable or disable certain behaviors. (In theory Jetsam should more aggressively evict background apps on the iPhone 5 simulator compared to the iPad Pro simulator.)
You can use xcrun simctl to create or delete devices, including the default devices though Xcode updates may re-create default devices.
You can also create multiple simulator instances for the same device type if you want different photo libraries, permission settings (grant your app permission to use location in one and deny it in the other), and so forth.

Is the iPhone Simulator actually as "slow" as device itself

I wanted to know whether the iPhone Simulator in XCode "really" emulates the device hardware.
So when deploying to iPhone 4s Simulator, will my app actually be "as slow as on a real iPhone 4S device" and when using an iPhone 6 Simulator, will it be as fast as on a real device?
The simulator does a really lousy job of indicating app performance. In fact it doesn't try.
For most things the simulator is much, much faster than an iOS device. It runs your code on an x86 processor, which is much faster than the ARM and has many times more memory. (It also actually links again OXS frameworks, not iOS frameworks. There is glue code in the simulator that makes it work with iOS code, but it's not perfect.)
However, some things, like Core Image filters and OpenGL graphics, are actually slower on the simulator than on a real iOS device.
The bottom line is that you can't really tell ANYTHING about your app's performance from the simulator, and shouldn't try. You can do basic development on the sim, but when it comes time to test performance, use real devices, and make sure to test on the oldest/slowest device your app supports (usually an iPhone 4s or iPad 2).
You also can't test memory usage on the simulator. A program that will run out of memory and crash on an iOS device may run just fine on the simulator.
The Simulator is a useful tool, and it should not be the only way you
test an app. Because the Simulator is an app running on a Mac, it has
access to the computer’s resources, including the CPU, memory, and
network connection. All of these resources are likely to be faster
than those found on a mobile device. As a result, the simulator is not
an accurate test of an app’s performance, memory usage, and networking
speed.
Source

Possible to Run iOS Apps on PC

Is it possible to run iOS Apps DIRECTLY on Mac OS? What about Windows? Or do you always have to use a virtual machine? I searched around and all I found was people saying you need to use a virtual machine. Reason for this: I want to automate behavior on an app on my iphone, and I think that will be much faster on my PC.
The iOS SDK accesses the hardware of the iPhone/iPad. It's very specific hardware which is not available on any other device.
The CPU is different, the display, device buttons, sensors and phone specific stuff...
The simulator simulates all this hardware, still it needs a different compile and can not execute the iOS bundle as it does not simulate the Arm CPU architecture.
That said, it does not make much sense to do automated test on another platform than the target platform, as the app might have slightly different errors and behavior.

phoneGap app for iOs: if application works in xCode device emulator

I've got a newbie question about phoneGap and creating apps for iOs.
If my phoneGap app runs in device emulator in xCode and everything is ok, can I be sure that it will work the same way on a real iOS device when I publish it in the appstore?
The XCode simulator does what the name suggest - 'simulates'. It is not identical to the actual hardware, for a number of reasons. Here are just a few of them:
Performance - your computer has much more memory and processing power available than the phone itself. Your app may run fine on the simulator, but quite slow on the device. This is why it's a good idea to run on the device itself, especially if you're doing stuff which could use up a lot of memory.
Missing features - the simulator doesn't allow certain things to be tested, like in app purchase or media/asset management. And obviously you're missing things like the camera, the accelerometers, compass, etc. You can from iOS 5 simulate certain things like the GPS, but nowhere near everything.
Visuals - the simulator runs at your monitor resolution, whereas the phone itself has a much higher DPI display. Things that look readable or fine on the simulator can on device look very different.
If you're not testing your app on an actual device before releasing it to the app store you're doing a disservice to your users - this is Apple's point of view, and one shared by most developers. It's not necessarily what you might want to here, but unfortunately the simulator really is just that - a simulator. You wouldn't want to be in a plane piloted by somebody who had only trained on a simulator. And you probably wouldn't want to use an app that had only been run on the iOS simulator.
Here's what Apple have to say about it in their own documentation:
Although you can do much of your debugging and testing of an iOS application using iOS Simulator, simulation cannot completely match the results of running your application on the target devices; you must test your application on actual devices to ensure that it runs as intended and to tune it for performance on actual hardware.

Blackberry Development (Test Devices)

I'm planning to create an app for blackberry. The Android and iPhone Versions are almost done. Next on the list is the blackberry one.
So my question is: how good are the simulators? Do I need a real device to test? Which one would you recommend?
It is unlikely you'll be able to create a bugless app without a real device. However totally ignoring simulators would also be a mistake. Simulators are quite good, because they allow to test a substantial part of features on a wide range of device models/OS versions. It would be quite expensive to have a dozen of real devices. :)
Usual points to bear in mind while working on simulators:
real devices are slower in times.
simulators do not support permissions (simulators act as if permissions are always granted regardless of what you actually see).
real device may not support the same type of network transport that your simulator has (TCP, WIFI, BES).
big wireless providers (e.g. Verizon) usually install a slightly customized version of BB OS on their devices, and sometimes it results in a different behaviour (or even bugs).
I've had fairly good luck with the simulators. I've been using the Storm, and I have a real curve. I have a colleague with a real storm so I run everything by him as well.
There have only been 2 times that having a real device has helped me. 1. Making sure I had my install files correct. Since Eclipse just copies them out to the simulator it took me 2 attempts on a real device.
and 2. When testing creating & using a database on the sim card. I got about 95% there on the simulator, and the other 5% was really just verification.
That said, which one depends on what version you're writing for. Storm and some curves are 5.0 (and can be upgraded to 6.0) The Torch is only 6.0
Blackberry simulators are really good
They are exact replicas of the devices
I have worked with storm and also the torch devices
I have faced problems during the connections to the internet
and while using the SD cards (SQLite databases)
Getting images from the SD Card which is not possible from the simulator
If you are developing an application which needs the basic UI components and the native blackberry components, simulators are fine
But if you are really developing something out of the box device is a must
It would be more better if an app can be tested in the device before rolling out
Try your luck
Thank you.
The Blackberry simulators are fine. I believe they are built using the same code as actual devices, so they are pretty much identical to real devices. The only thing that makes a difference is the software that they run.
The simulators will provide you with almost all the same functionality with the exception of things like GPS. I believe I've used an image from an SD card before using the simulator as well...
As far as I know, simulators are set at a specific OS version, whereas in the real world there are tons of different OS versions being used (minor revisions). There have been cases where a feature has worked on the simulator but once it was built and launched on the device, the device shows something different. So if you want to get your app tested, you should test on your TARGET device and OS on simulator and real device.

Resources