Xcode cannot run on simulator - xcode

in Xcode, I can see the simulators (in Window->Devices), however XCode itself will not recognize the simulator as an option to run on. Any ideas?

there may be two reason by which your Xcode not recognise simulator.
1.You have selected higher or lower version in development target.
Go to Xcode ---> window ---> Devices --> Add device on click + icon. it will be added a device on your Xcode .
Thanks
Enjoy coding.....

Related

Xcode: iOS Simulator Dev Menu will not open

Specs: React Native, xCode, iOS Simulator
I'm currently running xCode and just trying to start my hello world however despite numerous approaches I cannot get the dev menu in the iOS Simulator to open. The hotkey CMD + D will not work.
I have tried:
I checked and unchecked the simulator keyboard settings, “Connect
Hardware Keyboard”. Reference
I have tried “Reset Content and Settings” in the simulator menu.
Switching between scheme settings for the project. “Check your
scheme settings. The current scheme shows at the top of Xcode. Click
on it, then Edit Scheme. Under "Run", make sure the build
configuration is set to Debug. If it's set to something different,
you won't get the dev menu.” Reference
Restarting the simulator and restarting my mac.
Let's you try command + control + z
I also faced the same issue and after searching a lot I finally got a solution.
Create a fresh project by react-native init and see if it(dev menu) works or not? If it does, just upgrade the react-native version of your project. In my case, creating a fresh project worked.
I faced a similar issue when the default launch device as iPhone 11. But when I ran the command to run with iPhone 11 Pro developer menu came back. May be specific to a device on my machine.
https://reactnative.dev/docs/running-on-simulator-ios
"react-native run-ios --simulator='iPhone 11 Pro'"
To list all devices
xcrun simctl list devices

Can I set the default simulator for new projects in Xcode 7.1 or latest?

I've been making a ton of new projects as I'm learning Swift. My development is all on my laptop, so I hate using the default 6s Plus simulator, since the window is too big to easily see. Is there a way to change the default simulator to be a different one for new projects?
No need to delete simulators!
Product → Destination → Add Additional Simulators...
In the sidebar, select the simulator you want to hide
Uncheck "Show as run destination"
Edit: Updated for Xcode 10
You can select the desired simulator via the Hardware > Device > [OS] menu (Xcode 9):
While unchecking "Show as run destination" hides the simulator, this will also change the default value.
Updated image for Xcode 11.5
Xcode 9 UPDATE:
In Xcode 9, no need to delete simulators, and the way to turn them on/off is to go in Product/Destination/Add Additional Simulators... select the simulator you want to turn off, then uncheck the box: 'Show as run destination'
No. But...
If you don't like the size of the 6s plus simulator, make it smaller with the simulator Window Scale menu.
If you don't like the 6s plus simulator at all, delete it with the Xcode Window Devices menu.
Xcode 12.5
In Xcode, go to Product -> Destination -> Choose Destination menu and selecting the device you'd like to be your default.
The original answer could be found in apple support forum here: Apple support forum,
In addition if you want to make the device smaller just hover over bottom right corner of the simulator and you will see the resize option
Deleting the simulators you don't want will default you to the simulator you do want. I also develop on my laptop and the biggest simulator I can see w/o scaling down is the 4S, so I deleted simulators for iPhone 5 and above and now every project I create defaults to 4S simulator. If I ever need the newer simulators, I will just re-download.
In my case, just select the device in Product → Destination, Xcode 12.4
Xcode version 11.5
On Simulator > File > Open Device > iOS 13.5 > Change the default Simulator
Xcode(v11.5)
open your simulator, choose **File/Open Device/iOS 13.5/iPhone8 ** will change your simulator device to iPhone 8.
When you reopen your simulator, iPhone 8 will be your device simulator.

XCode 7. iOS simulators missing and not installable

Can't see any iOS 9.0 simulators. In previous Xcode 7 beta 3 all was OK.
Can't install iOS 8.3 simulator.
Also I can't add any simulator from 'Organizer'. By pressing "Create" nothing happened.
Each time when I'm trying to download iOS simulator I see next thing:
One possible issue is that there may be old leftover simulators installed, which are not compatible with the new XCode, and their presence causes the whole Simulator to fail. To get rid of them, delete the simulators in /Library/Developer/CoreSimulator/Profiles/Runtimes (for me there was an iOS 7 simulator there which was the issue). Relaunch XCode after this.
Then try to run the simulator from XCode->Open Developer Tool->Simulator. Assuming this succeeds, verify that you have the simulators under the iOS Simulator menu Hardware->Device->Manage Devices… – if not, you should be able to click the + in the bottom bar to add yourself some iOS 9 simulators. Relaunch XCode again and they should show up in the menu.
In my case was with Xcode 8.2, what it worked to me was changing Deployment Version:
After setting another different than 10.0 then appeared back all simulators again.
Have you tried going to Xcode > preferences > downloads and trying to re-download the simulators you want?
For me it was only showing one simulator,
and when I go to Xcode > Preferences I can see the simulator is already downloaded but it is not showing up in the list,
if you're facing something similar. This is how you should add required simulator,
From the Xcode menu, open Windows > Devices, shown in the image below
you should see this screen,
notice there is only one simulator (ref: first image)
Now to add required simulator, you should click on the + (in the left corner)
You should see this,
You can choose the simulator from the list, In my case it is iPhone 6s Plus.
In Xcode you can see additional simulator iPhone 6s Plus,
I was also not able to see simulators.Reason is,I have not restarted system after upgrading Xcode.I restarted & simulator started displaying as routine.
There is a bug in the latest El Capitan beta which causes a process to crash when dlopen() fails to mmap() a dynamic library. Such mmap() failures can occur due to code signature verification failures.
These mmap() failures will occur if older iOS Simulator runtimes are present on disk (ie: installed from Xcode 6.x), and that is the reason why Xcode 7 beta release notes have indicated that earlier runtimes are not working in Xcode 7. The iOS 8.x Simulator runtimes were updated in newer downloads, but if the older versions are present on disk, they will cause the mmap() failure, which in the latest El Capitan beta, unfortunately results in the CoreSimulatorService repeatedly crashing which in turn results in no simulators being available.
If simulators are suddenly disappeared:
Just consider decreasing Deployment target to a minor version below current version in Project > Build Settings > Deployment Info > Deployment Target
P.S. Usually you see a place holder text showing the selected version (in gray) in the box denoted above. If for example the gray text says 9.3, then decrease it to 9.2.
Look at seancook's response in the middle of this page... it seems to have fixed this issue for several people.
https://forums.developer.apple.com/thread/11706
Edit:
This can also be fixed by booting into recovery mode (CMD - R) and reinstalling El Capitan.
Go to Windows. Select Devices. Select '+' from left bottom and add all simulators one by one.
I had changed the name of my Project from Finder. I clicked on the old project name (between the Play Button and and the selector for the desired Simulator or Device), selected edit schemes, selected the Targets Tab, and realised that the old scheme was missing so I just added my new Project name by clicking on the plus button and the simulator list reappeared.

How to run Xcode 6.2 simulator?

At the top next to the play/run button, I only have an option for "iOS Device". The simulator is not an option. How do I run projects in the simulator?
You can manually start the simulator from the task bar. I think its under File -> Developer Tools -> iOS Simulator.
Also make sure your deployment target is set to the simulator's firmware.
If still you can't use the simulator you can tap on iOS Device and then add scheme. There you will be able to add simulators, even though this should have been there by default.

Why simulator getting crash on Device change from simulator in Xcode 5?

When i run simulator in my xcode 5 and later on if i try to change simulator Device from under menu 'hardware' of simulator it getting crash. which is something unlikely to xcode previous versions. Is it my xcode copy specific bug or something else?
I had the same problem. Instead of changing the device in the iOS simulator, change to the device of your preference in XCode. Notice your project name in the top left hand corner next to build and run button and stop button. To the right of that is a drop down for different device names. Pick the one that you'd like to simulate. Then build and run in iOS simulator.

Resources