Unable to boot device in current state: Booted - ios8

Any guess on "Unable to boot device in current state: Booted" error in Xcode6 beta while running (build+run) project in Simulator. I am just running my existing project in Xcode 6 I found above message. I tried cleaning, deleting of the derived data, even restarting the simulator doesn't work. Finally i restarted my Xcode 6 then it is working. Any simpler way to resolve the error instead of restarting your xcode6.

In Xcode go to the Xcode menu->Open Developer Tool - IOS Simulators. Choose simulator and then go hardware->device->manage device.
If the troubled device shows in the left column, delete it. Then add the device back from the '+' button. If it wasn't there in the first place, simply add it using the '+' button.

From terminal, get the list of devices with:
xcrun simctl list
This will show you your list of devices with "Shutdown" or "Booted". You'll likely see your device is in a "Booted" state. You can shut it down with:
xcrun simctl shutdown <simulator id>
Where <simulator id> is the name of the device in the list. For example:
xcrun simctl shutdown "iPhone 6 Plus"

2022 fix
I found solution. Simulator -> Preferences -> Simulator lifetime: When Simulator starts boot the most recently used simulator I unchecked.

This will kill any booted/running simulators even if the .app is not shown:
xcrun simctl shutdown all

I encountered similar problem. Got it resolved. Below are steps to fix it.
Open Simulator
Select Hardware -> Device -> Manage Devices...
This will opens a window containing list of simulator devices
Delete simulator that prompts error by right click on it.
Again add simulator by clicking '+' button onto right corner of window
Select Simulator Name, Device Type and iOS Version

Restarting the computer solved this for me. I restart very rarely so I would never normally have thought of this!

I solved this issue by this way:
Open Xcode
Goto Xcode menu > Open Developer Tool > iOS Simulators
It will run Simulator with error
Goto Hardware > Device > Manage Device
Add needed simulator to your system

This solution worked for me
Go to Xcode -> Open Developer Tool-> Simulator -> uncheck the option when simulator starts boot the most recently used simulator

Delete all devices on Simulator->Hardware, and add them back, not working :(
Bug or not, restarting Xcode doesn't work for me; could not get Simulator back to work until restarting my computer and it seems the adding-back had failed before restarting.

Quit iOS simulator. Change Target iOS Simulator to any other iPhone or iPad and then run app. Its working for me.

Applicable for Xcode 6.x, here is the command-line solution (type on Terminal window):
xcrun simctl shutdown
xcrun simctl erase
open /Contents/Developer/Applications/iOS\ Simulator.app
Where is the id of the device you want to launch. You can get the list of devices and their UDIDs here:
xcrun simctl list

I had the same problem. I reset the settings on the iOS Simulator, and run an xcrun simctl erase all and got the simulator working again.

Quit Xcode and Simulator.Then rebuild build and run.

Happened to me also, run an xcrun simctl shutdown <simulator uid> and got the simulator working again.

I don't know if this is any help to you guys but in my case I had this issue when I had a simulator window already open and I tried the command line invocation of simulator to run a .app file.
/Applications/Xcode.app/Contents/Developer/Applications/iOS\ Simulator.app/Contents/MacOS/iOS\ Simulator -SimulateApplication ${pathToMyApp}/MyApp.app/MyApp
I just quit all of my simulator windows and ran the command again. That fixed it.

I had the same problem. I reset the settings on the iOS Simulator, and it was fine again.
iOS Simulator -> Reset Content and Settings...

When I came to this issue,I tried to tackle it as follows:
cd /Applications/Xcode.app/Contents/Developer/Applications
In Terminal: open -n Simulator.app.Click Ok.
Then go to Simulator->hardware->Device choose another device,not the same type of already opened one.(e.g, the first one is iphone 6 the new one could be iphone 7)
4.Then there will open a new simulator.
Hope this will help you.

I just quit the Xcode and then remove all derrived data. Then relaunch Xcode and do cleaning, build it wait for it's indexing complete then run the project and issue get resolved.

With simulator opened, select "simulator preferences" and disable (simulator lifetime),so it doesn't use the same simulator used before the default.
Resolved for me.

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

Xcode duplicated devices bug

I opened Xcode and suddenly I found the simulator devices duplicated. I found a similar question 1 but that's not my case, I'm using the latest SDK and a clean Xcode installation.
Screenshot in the link bellow. Any ideas?
1 iOS Simulator devices listed twice in Xcode run destinations list
You can delete the duplicates that you don't want from Xcode's Devices window (Window -> Devices) or from the command line using 'xcrun simctl delete [UDID]'

Reset iOS Simulator application data to run app for first time

I just finished writing some code that checks if it is the first time the app is running then display a message, if it is not the first time then display another message..
How do you reset the simulator on Xcode so that I can test the app when it runs the first time?
I tried cleaning the build folder but it didn't work..
In the iOS Simulator, press iOS Simulator in the menu at the top of the screen, and press 'Reset Content and Settings...'. This will clear the entire simulator.
Or, on the home screen of the simulator, uninstall the app in the same way you would on a physical device, by pressing and holding on the application icon until an 'x' appears in the top left, and press the 'x', and select 'Delete' from the alert view. This will clear all data associated with a single app.
Then do a clean, build and run.
Edit:
As of Xcode 11+ Simulator, this is under Device > Erase All Content and Settings
The correct way to do this in XCode is: (Simulator must be shut down first)
xcrun simctl erase <device UDID>
or
xcrun simctl erase all
To find out the UDID use:
xcrun simctl list
Currently (Simulator Version 10.0), you can do it the following way:
Hardware > Erase All Content and Settings...
#Tim's answer is probably easier for interactive usage.
We use scripts for automated testing and delete the simulator's data directory to ensure it's clean. The simulator will re-create basic information when it restarts.
Delete the following:
~/Library/Application Support/iPhone Simulator/${simulator.version}
Don't really know if this is the best way but following is working for me:
first kill all working Simulators with
killall Simulator 2>&- && sleep 5 || true
afterwards reset all devices with
xcrun simctl erase all
ps.: I'm working with XCode 8
All of the answers are how to delete an app, or how to erase all simulator content and settings. If you want to delete just content and settings for specific simulator app find the following folder and delete it:
~/Library/Developer/CoreSimulator/Devices/{DEVICE_UDID}/data/Containers/Data/Application/{APP_UDID}
Where {DEVICE_UDID} is identifier for specific simulator and {APP_UDID} is identifier for specific app.

Xcode not detecting my device

I upgraded my iPad device OS version recently to 5.1.1 (9B206). From that my Xcode is not detecting my device. Am just getting iOS Device and simulator options in my Xcode. But am getting my device in older version of Xcode and iTunes. For this i updated my MAC OS version to 10.7.4 and Xcode version to 4.3.3. But still am facing the same problem. Now how to make my Xcode to detect my device?
This Worked for me.
Quit Xcode.
Disconnect the device.
In a terminal window, type: sudo pkill usbmuxd (it will be restarted
again automatically)
Restart Xcode
Connect the device
Your device should now be visible again in Xcode!
Open the Organizer in Xcode, go to devices, find your device and click the option to use for development
I just plugged into another USB port and it detected by device.
In another case, check the "iOS Deployment Target" in "Build Settings",
if the target iOS version number is great than the version of device,
then the device will not show in the list.
Say that, the "iOS Deployment Target" == 7.0, and the version of device is 6.0,
to solve the problem by change the "iOS Deployment Target" to 6.0 or lower.
If the chosen answer still does not work for you try this:
Select the project in project explorer
Select the target on the main window
Select Build Settings
Select Deployment
Select iOS Deployment Target. Change it to the version of your device. (e.g. iOS 5.1)
I was also faced the same issue in Xcode, my device was not detected after update the Xcode latest version(7.3.1)
Done so many things what suggested in the web-search but still the device was not detected.
Finally, I just quit and open the Xcode my device was detected(oh my bad).
This SO answer solved it for me https://stackoverflow.com/a/56054170/5813473 .
sudo killall -STOP -c usbd
did the magic.
Well later I had to unplug/plug in again at occasions, but that 'killall' really solved the original issue.
Most recently, Xcode 8.3 and iOS 10.3 seems to have more security around Xcode accessing the iPad/iPhone. My sequence:
Rebooted the machine,
Attached the iPad,
Gone through a "trust this computer" security cycle on both iMac and iPad
Xcode can now see the device
Sometimes restarting Xcode helps. Give it a shot.
In my case, restarting Mac worked and no other solution.
I updated my iPad (it's in Settings -> General -> Software Update, near the top) and restarted my computer and Xcode sees it now.
FWIW I tried all the tips in this thread and nothing would work: from reboots, command line statements, unplugging, different USBC ports, etc. I also tried something not mentioned here (yet) by going to "Settings > General > Reset > Reset Location & Privacy" ... however even this didn't work.
Later on in the evening I was in a different room of the house and out of nowhere I got the "Trust This Computer" prompt on my iPad. I of course tapped "Trust" or whatever and then magically my Mac laptop finally sees my iPad.
I realize I'm not really giving a helpful tip/fix here - just sharing how things went for me in case anyone finds useful.
iPad: iOS 13.4.1 | Macbook laptop: OSX 12.3.1
Recently (2022) I've noticed that the iPad prompt to "Trust this Computer" won't appear unless using an Apple USB-C cable. Apple reps assure me they aren't doing any funny business here, but I have tried every cable I can find, including several thunderbolt 3 and 4 cables and Anker cables. Worth trying an Apple cable if still having problems.
Just simple, close the project on your XCode. Just right-click on the XCode in the taskbar and give a quit option. After open the XCode from the directory, it will detect your device. It also work on Xcode version 11.2.1
close your project or XCode.
Give Right click on the Xcode in MAC tabbar and give the Quit option.
Reopen the project from your finder(project place).
The device will be automatically detected.
Open the Windows in Xcode, go to devices. If Device is visible in Left side, Right click and select "Show in Destination Menu".
Enjoy..

Xcode Doesn't Recognize My Device After OS Upgrade

This has to be a simple configuration issue, but I don't know my way around the build settings very well.
I upgraded my iPad from 4.3 to 5.0. I am using Xcode 4.2. When I plug my device in, it is not showing up on run button, and I have a message that it can't run using the selected device.
What do I have to do?
Open Xcode, go to Window -> Organizer and find your device. Click the "Use for Development" button to get Xcode to recognise it again.
go to your iphone device, settings->Reset->Reset All Settings. Close Xcode, restart XCode, device should be in the list now.
Restarting USB process worked for me.
Run sudo pkill usbmuxd on terminal
or
Open Activity Monitor and select Disk by tapping from segment control and search usbmuxd, select the same and force quite/quite.
Note: before doing above stuff, remove device and quite Xcode.

Resources