Xcode is pretty smart as it now takes care of all those little details for us as long as we have our Apple ID registered in Xcode’s Preference Pane. Now it might happen you encounter a little hick-up along the way and so you will have to do it yourself. Your certificate is used to code sign the apps and they uniquely identify you. You can easily install the one you need via Xcode. This article shows you how to do so by using Xcode 12. Open up your Xcode and go to Xcode Preferences through the top menu bar.
- The iOS simulator is a version of iOS running in x86 (Intel) machine language. Apps on the app store are ARM code. As the iPhones/iPad's are based on an arm processor and the simulator is an Intel x86 it's not possible.
- Xcode will now compile and build your app, install it in iPhone Simulator, and launch the app. You can now use your app inside iPhone Simulator, as if it were a real iPhone! You can use the mouse to interact with your app, but there’s a few things you should know.
iOS Simulator is an integral part of any iOS development process. We just can’t ignore it. New Simulator from Xcode 9 brings a lot of useful tricks, which could make you even more productive. Finally, Apple recalled they have Simulator out there! Comparing to previous modest updates, this one seems like a big deal.
So let’s break this down and list all features I found in new iOS simulator (some tricks you can use in the old Simulators as well).
1. Use Simulator in Full-screen mode with Xcode
When you have 13″ screen the full-screen mode for Xcode is a just life saver. Unfortunately, you couldn’t use Simulator with Xcode in the full-screen mode previously. Well now you can 😎
This feature is enabled by default starting from Xcode 9b3. So you don’t even need to do anything to make it work.
To do so you need to create an empty folder with name “AppleInternal” in the root directory. Just run this command below and restart Simulator:
The new menu item should show up. ☝️
2. Open Multiple Simulators at Once
Do you remember the frustration of testing your app on different simulators? Previously you were forced to open only one Simulator instance at the time. There were many “hacks” how to open multiple instances of iOS simulator in an older version of Xcode. But finally, with Xcode 9 this feature is available out of the box.
3. Resize Simulator just like a regular window
Before Xcode 9, we had “Scale options” only to adjust simulator’s window size. Now Apple finally made resizing of the Simulator’s window available. It’s useful little detail which can help you organize workspace efficiently if you have multiple simulators opened.
4. Record Video of Simulator
In the official “What’s new” document for Xcode 9, Apple claims that now you can record a video of simulator’s screen. It’s not completely true. You can do it even in the older versions with simctl. I didn’t find any evidence you can enable video recording from the interface though (except for built-in screen recording in iOS 11).
For getting your video file, execute the following command:
5. Share files to Simulator right from Finder
Now Simulator has Finder extension which allows you to share files directly from the Finder’s window.
You can do something similar with image/video files using the simctl command below:
It’s nice to have such abilities. However, drag&drop file to the Simulator’s window seems much faster for me.
Xcode Uninstall Simulator Version
6. Open URLs on Simulator
This one comes with simctl as well. So you can open custom URL schemes on older Simulators too.
Execute the command below with whatever URL you need:
For the list of all Apple’s URL schemes please check out the documentation..
7. Quickly Find App’s Container Folder
One more command from simctl. You can get app’s container on the file system with a single command. You just need to know app’s bundle identifier and execute the command below:
2 4 6 8 10 12 14 16 | ApplicationType=User; BundleContainer=<PATH TOFOLDER WITH APP FILE>; CFBundleExecutable=TestiOSApp; CFBundleName=TestiOSApp; DataContainer=<PATH TOYOUR DATA>; }; SBAppTags=( } |
Execute command below and explore the output:
One last thing…
iOS Simulator is a very powerful tool which can speed up your development process a lot. But only if you know all little details and tricks. And obviously, as a good engineer, you have to know your tools.
Here at Flawless, iOS Simulator is extremely important for us. Our product is an iOS Simulator plugin which allows engineers to inspect any design on top of implementation right inside Simulator. So I can’t even tell you how happy I’m with this new Xcode 9 and Simulator release. Can’t wait for the public version! So we can implement more useful features to keep a visual quality of iOS apps in a good shape.
Also, if I missed something important feel free to add your tricks in the comments below. I believe it will be really useful to have more tricks in a single place 😊
This is a guest post by Ahmed Sulaiman, Founder and CEO at Flawless. The original post of this article was published on medium.com. You can reach Ahmed via Twitter.
I have downloaded Xcode 6.2 today which replaced previous Xcode 6.1
now to use simulator 7.1 & 8.1 it asks to download both simulators , but for some reason after trying 4-5 times it shows network issues in downloading or request time out (note: in n/w diagnostic after it shows net is working properly)
so is there any direct link from where i can download the simulator package directly or somewhere at least it shows progress in percentage/size instead just a bar
if it’s not possible i have read about copying the older simulator to new Xcode so how can i place the old simulator(7.1 & 8.1) in Xcode 6.2 that it works directly without downloading again
Clicking on Download in Xcode didn’t do anything – the progress bar did not progress (does that make it a regress bar?).
This is what worked for me:
- Open Xcode, open preferences, go to the Downloads section.
- Open the Console App, clear the console.
- Go back to the Xcode preferences. Start the simulator download, then cancel it.
- Now in the Console, you will see something about the cancellation with the download URL.
Copy the URL from the Console. Then in Terminal in some suitable scratch folder, download it:
curl [the url you copied] -O (the letter O, not a zero)
Finally, copy this file to ~/Library/Caches/com.apple.dt.Xcode/Downloads
Remove all *.dvtdownloadableindex files (maybe it doesn’t matter, but I removed them).In Xcode, in the Downloads section, start the Simulator download again, it should find the file you downloaded and install it.
How easy was that! Only 7 steps, hah!
So a quick tip for the people who use a download manager to download the .dmg file and didn’t manage to get it work.
Once you place the file inside the ‘Downloads’ folder,
Copy and paste the url somewhere and copy the file name alone.
( for me I was downloading iOS 9.3 so the url was –
https://devimages.apple.com.edgekey.net/downloads/xcode/simulators/com.apple.pkg.iPhoneSimulatorSDK9_3-9.3.1.1460411551.dmg
and rename the file you just copied to the ‘Downloads’ folder, even if it looks exactly the same.
I wasted 2 to 3 hours trying to figure this out. The problem is that the filename looks exactly the same. But there was an extra space somewhere.
Another Tip: Also to get the download url – open system console. Make sure all messages are selected and search for xcode inside the Search box. Go to xcode simulator download screen, start and stop the download for the simulator you want and check inside console log. You should find the url there.
so is there any direct link from where i can download the simulator
package directly or somewhere at least it shows progress in
percentage/size instead just a bar
You can’t download the simulators package directly. Instead, you can download the xcodes from developer.apple using this link, which provides you the required simulators.
If you want the old simulators in new Xcode, download the desired Xcode using the above link,after downloading it, Open the DMG or open your existing older Xcode, right click on the Xcode application and click ‘Show Package Contents’, navigate to:Contents/Developer/Platforms/iPhoneSimulator.platform/Developer
, copy the found simulator folder (eg. iPhoneSimulator7.1.sdk folder), repeat steps 2 & 3 for your current Xcode application, paste the simulator folder,restarting the Xcode will show you the new added simulators.
Often, what it takes with Xcode is a good ‘ol fashioned restart. This didn’t work for me, so I restarted my MacBook Pro. Now it works 🙂
It’s a quick thing to do when you’re stuck.
Follow these steps to add a (new) simulator (Xcode 9 onwards)
- Click on Simulator icon and open simulator list.
- At the end of list, there is an option to add new simulator “Add Additional Simulator“. That will open ‘Device & Simulator’ window.
- Switch to ‘Simulator’ tab.
- There are three field in simulator tab.
- Click on ‘+’ icon, on left bottom corner of window.
- Simulator Name: Enter simulator name here
- Device Type: Select iPad from this dropdown list
- OS Version: Select OS version from this dropdown list
- Click on ‘Create’
A new simulator will be added in your Simulator option list.
Look at this snapshot to understand flow of above steps:
And if there is no simulator/OS version in simulator list, you’re looking for,
- Click on Simulator icon and open simulator list.
- At the end of list, there is an option to add new simulator “Download Simulator“. That will open ‘Component’ window (from Xcode >> Preferences).
- Select/click simulator from list, which you need to download.
Look at this snapshot:
Tags: xcode