XCode 10 shows no simulators or devices - xcode

I just reinstalled XCode 10 and now navigating to XCode -> XCode -> Open Developer Tool -> Simulator -> Hardware -> Device -> Manage Devices shows no devices or simulators:
Does anyone know what might cause that behavior, or what I can do to install a simulator version (e.g. iOS 6s)? Any help would be greatly appreciated!

So this machine had a previous version of XCode installed, and had some legacy simulators that were left over from that earlier XCode installation. Step one was to remove those simulators:
xcrun simctl delete unavailable
Then I manually created a new simulator:
xcrun simctl create duhaime-6s com.apple.CoreSimulator.SimDeviceType.iPhone-6s com.apple.CoreSimulator.SimRuntime.iOS-12-0
Those arguments are: xcrun simctl NAME DEVICE_TYPE RUNTIME. You make up the simulator name, and can select a device type and runtime from the list of options displayed if you run xcrun simctl list. After creating the simulator, you can start it:
xcrun simctl boot 4A6368C3-A94C-4D83-8AA3-9E9900ABCC74
That GUID / simulator ID will be displayed if you rerun xcrun simctl list.

Related

xcrun simctl status_bar not working in xcode 12

I have just upgraded my Xcode to 12 beta. I have tried to override the status bar on the simulator using this command:
xcrun simctl status_bar 52B135BF-F549-4684-A959-914499AB3296 override --time '9:41' --batteryState charged --batteryLevel 100;
This command works on the previous version. However, it doesn't work anymore.
Does anyone know how to fix this?
From Xcode 12b3 Release Notes: "simctl status bar overrides don’t work properly on simulated devices running iOS or iPadOS 13.6 or earlier. (63958080)"
Just got burned by this myself.

When launching an iOS simulator it closes straight away but still runs in the background

When I try to run a project (even a default single view app) in Xcode 10.2 (also occoured on Xcode 10.3 and beta 11 build 3) the simulator launches but then closes but Xcode still thinks it's running (looks like it is running headless). Any ideas on how I can see the simulator?
I have tried the following so far but the only time I can see the Simulator is on its first launch after that it disappears after launching.
Uninstalling and re-installing Xcode (making sure to delete all related directories and doing a system restart)
Adding and removing simulators from window -> Devices and simulators from within Xcode
Tried clearing the simulator cache xcrun simctl erase all
Tried running the following sudo killall -10 com.apple.CoreSimulator.CoreSimulatorService
Clearing Derived data ~/Library/Developer/Xcode/DerivedData/
Another thing I noticed is if I run: /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app/Contents/MacOS/Simulator I get the following error:
Bus error: 10
But if I run: sudo/Applications/Xcode.app/Contents/Developer/Applications/Simulator.app/Contents/MacOS/Simulator the Simulator launches fine.
Thanks for any help.

How to see logs when running app in iOS simulator directly?

I want to run an app in iOS simulator directly and see the log emitted from NSLog (rather than running the app from Xcode). How can I achieve that?
Depending on the runtime version, you can use one of:
xcrun simctl spawn booted syslog -w
xcrun simctl spawn booted log stream
tail -F "$(xcrun simctl getenv booted SIMULATOR_LOG_ROOT)/system.log"
If you're on macOS Sierra, you can also select the simulated device from within Console.app to see the logs.

Weird Strings for iOS version in Xcode simulator list

As you can see in the screenshot, I am getting this weird string for some simulators. How can I fix this?
It happened to me,when there were both Xcode7-beta and Xcode6 in my Mac.
As you see,UDID-like strings are UDIDs (Unique Device IDentification numbers) for the iOS Simulator devices. As they are duplicated devices with unique UDIDs,to there are two ways to solve this problem,:
I suspect the issue will go away if you restart the service:
Quit Xcode, Instruments, and the iOS Simulator and then run this in Terminal.app:
sudo killall -9 Xcode 'iOS Simulator' com.apple.CoreSimulator.CoreSimulatorService
Then
rm -rf ~/Library/Developer/CoreSimulator/Devices
Just change and rename your simulators: In xCode go to Window -> Devices and press the plus in the bottom corner and add the simulators that you wish or minus to remove.
Then it'll be ok:
Thanks to #stevechen for pointing me in the right direction, I finally solved this problem :
Xcode Menu > Open Developer Tools > Open iOS Simulator
iOS Simulator Menu > Hardware > Device > Manage Devices
Delete all the bad entries
Add then back
Enjoy!
I ended up running this:
killall Xcode
sudo killall -9 com.apple.CoreSimulator.CoreSimulatorService
rm -rf ~/Library/Developer/CoreSimulator/Devices
open /Applications/Xcode.app
Per this SO answer: https://stackoverflow.com/a/31421158/406
It worked great for me!
Xcode 6.4

Xcodebuild showSDKs shows different available iOS sims than Xcode 6.3 GUI

OSX 10.10.1
Xcode 6.3 or 6.3.1
xcodebuild version "Xcode 6.3.1"
This happened on one machine and I thought it was a fluke. Has now happened on two machines. I have followed the advice in
Why aren't simulators showing in the Xcode 6.3.1 scheme selector?
to no avail. Here is what I see on the command line:
xcodebuild -showsdks
iOS Simulator SDKs:
Simulator - iOS 8.3 -sdk iphonesimulator8.3
in "xcode GUI -> prefs -> Downloads"
iOS 8.2 Sim (checkmark)
iOS 8.1 Sim (checkmark)
iOS 7.1 Sim (checkmark)
in the ios sim application (opened from Xcode -> Open dev tool -> ios sim)
in the "hardware -> device" dropdown menu i see
iOS 7.1 > (lots of choices)
iOS 8.1 > (lots of choices)
iOS 8.2 > (lots of choices)
iOS 8.3 > (lots of choices)
So the Xcode GUI generally agrees with itself, but I need to build for and kick off all of these iOS sims programmatically from the command line, but xcodebuild doesn't see all of the available simulators.
Ignore what xcodebuild -showsdks tells you. You are confusing SDKs with destinations. A simulator is a destination.
The way to know what simulators you've got is with xcrun simctl list.
The way to tell xcodebuild what destination to build for is with the -destination option. You can construct and specify any simulator with which your project's deployment setting is compatible.

Resources