Unable to boot device because it cannot be located on disk - ios

The device's data is no longer present at /Users/[user name]/Library/Developer/CoreSimulator/Devices/D651BCC7-29FD-4B91-82F6-E255E856EA2F/data.
I uninstalled xcode 9 and installed xcode 9.1, but when run project, following message was shown:
Unable to boot device because it cannot be located on disk.
The device's data is no longer present at /Users/[user name]/Library/Developer/CoreSimulator/Devices/D651BCC7-29FD-4B91-82F6-E255E856EA2F/data.
I found "Developer" folder, but cannot find "CoreSimulator" folder.

I was able to resolve the issue running xcrun simctl erase all in Terminal.

Quit Xcode.app, Simulator.app, etc
Try the following commands in Terminal
sudo killall -9 com.apple.CoreSimulator.CoreSimulatorService
rm -rf ~/Library/*/CoreSimulator

Go to Xcode menu Window-> Devices and Simulators -> Simulators tab, right-click the bad simulator and choose Delete from the menu list, then add it back from the left bottom entry again, it works!

Click on the simulators dropdown at the top of Xcode, and select Download Simulators....
From here, you can select which versions you want to download and for what devices.

Just run this command in terminal:
xcrun simctl shutdown all && xcrun simctl erase all

I had the same issue.
It worked for me by erasing the device which your Mac does not found.
xcrun simctl erase AKADKJ-
Here is also a link where a found a good explanation.
https://medium.com/xcblog/simctl-control-ios-simulators-from-command-line-78b9006a20dc

Related

Flutter Doctor : Xcode installation is incomplete

I have an app created with Flutter want to build it in IOS.
When i want to run simulator or build the I get error ,When I run Flutter doctor I get this error L
Xcode - develop for iOS and macOS
✗ Xcode installation is incomplete; a full installation is necessary for iOS development.
I was facing the same issue. I did not installed Xcode from Apple Store. If your scenario is same, you can try below steps,
Open Xcode
Go to Preferences -> Location tab
You will find "Command Line Tools" option. If it is blank, select the Xcode version from list (see image below). It will ask for password or Touchid to update it.
Run flutter doctor again. It should resolve the issue
You probably miss the xcode command line tools, you may want to reinstall XCode, or select the xcode command line tools with the command xcode-select
Here's a full fix that should solve your problem: https://github.com/flutter/flutter/issues/6308#issuecomment-257812324
So, I was facing this same issue, and tried to and copy paste the command already given. Namely
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
But why did it not work? Silly mistake of mine: I have two Xcode versions in my Applications folder. One is called Xcode_12_3_0 and the other Xcode_12_5_1. Make sure that, when you run the command, you also make sure you enter your app's real name. For instance:
sudo xcode-select -s /Applications/Xcode_12_5_1.app/Contents/Developer
An answer for us, absent-minded people.
If you already have Xcode and this happens. Just run this command
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
And
sudo xcodebuild -runFirstLaunch
It will automatically show

Cannot select iOS Phone Simulator in Android Studio for Flutter

I have an issue. I started to code in Android Studio and I want to select iOS Simulator. However, I can select only option Open iOS Simulator which opens.. a watch!
How could I launch a phone as a simulator?
I tried going into Simulator itself, but couldn't find any ways how to do it.
Open iOS Simulator externally first. Now, open Xcode, Select your latest Xcode version in Xcode -> Preferences -> Locations -> Command Line Tools
Now, go to Terminal and run flutter doctor See if it shows any iOS device connected.
If yes, then you're done. Now you can see opened simulator can be seen in Flutter Device Selection and used to run your flutter application in iOS Simulator.
If No, then open terminal of project and run xcrun simctl list, from list of devices copy UID of wanted device and run xcrun simctl boot *SELECTED_UID*
After extensive research, I found a solution.
First, go to your xcode.
xcode -> Preferences -> Components and install selected iOS version.
After installation is finished, head to Android Studio go to Terminal tab and write xcrun simctl list - you will get list of devices. Select which one you want to use, copy UID (bunch of numbers) and use it with this command xcrun simctl boot *YOUR_DEVICE_ID*
Hope it helps for someone with same issue!

How to uninstall downloaded Xcode simulator? [duplicate]

This question already has answers here:
Xcode Simulator: how to remove older unneeded devices?
(21 answers)
Closed 3 years ago.
How to uninstall one of the downloaded Xcode simulators?
My iOS 7 Simulator won't boot (Unable to boot the iOS Simulator). I want to completely reinstall it.
I tried:
Deleting ~/Library/Caches/com.apple.dt.Xcode
Deleting Xcode and downloading it again from the App Store.
But the iOS 7.1 Simulator remains installed. How to remove it?
Note that I also tried:
Resetting the simulator content and settings.
Deleting the simulator device and creating it again.
and it didn't fix my problem.
You can remove them from /Library/Developer/CoreSimulator/Profiles/Runtimes (Not ~/Library!):
NOTE: This will only remove a device configuration from the Xcode devices list. To remove the simulator files from your hard drive see this answer.
For Xcode 7 just use Window \ Devices menu in Xcode:
Then select emulator to delete in the list on the left side and right click on it.
Here is Delete option:
That's all.
Run this command in terminal to remove simulators that can't be accessed from the current version of Xcode in use.
xcrun simctl delete unavailable
Also if you're looking to reclaim simulator related space Michael Tsai found that deleting sim logs saved him 30 GB.
~/Library/Logs/CoreSimulator
Slightly off topic but could be very useful as it could be the basis for other tasks you might want to do with simulators.
I like to keep my simulator list to a minimum, and since there is no multi-select in the "Devices and Simulators" it is a pain to delete them all.
So I boot all the sims that I want to use then, remove all the simulators that I don't have booted.
Delete all the shutdown simulators:
xcrun simctl list | grep -w "Shutdown" | grep -o "([-A-Z0-9]*)" | sed 's/[\(\)]//g' | xargs -I uuid xcrun simctl delete uuid
If you need individual simulators back, just add them back to the list in "Devices and Simulators" with the plus button.

How do I remove app from iOS 8 Simulator from command line?

I have an automation running in the iOS Simulator that I have to remove before another run. How do I remove the app from the iOS Simulator from the command line?
For each simulator device directory (located at ~/Library/Developer/CoreSimulator/Devices/*), I
tried to delete ./data/Containers/Bundle/Application/ and ./data/Containers/Data/Application/.
Even when I tried to delete the app by long pressing the app in the Simulator (the app becomes jiggly) and click on the X button, the user defaults were not being cleared. I want the app state to be 100% clean.
I found a good solution to solve this problem.
With Xcode 6.1, to uninstall an app, use the following command:
xcrun simctl uninstall booted com.example.apple-samplecode.UICatalog
where com.example.apple-samplecode.UICatalog is the bundle identifier of the application you wish to uninstall.
One approach that we found for deleting user defaults is to delete all files in the ./data/Library/Preferences/* in addition to deleting application and data directories.
However, in Xcode 6, the command xcrun has new subcommand called simctl that allows me to manage iOS Simulator including resetting the simulator, and installing the application.
The solution that I came up with is to use the command
xcrun simctl erase [device ID]
Example
If xcrun simctl list(†) returns
9DDA0CFE-7CEC-40B6-A343-1EC01F282B22 (active, disconnected)
Watch: Apple Watch Series 2 - 42mm (88474523-163E-4021-B591-2AECBFA26997) (Shutdown)
Phone: iPhone 7 Plus (5785E680-15CD-42D3-82AB-597286A270C5) (Shutdown)
then run these 2 commands
xcrun simctl erase 88474523-163E-4021-B591-2AECBFA26997
xcrun simctl erase 5785E680-15CD-42D3-82AB-597286A270C5
(†) The device ID can be obtained from running
xcrun simctl list
This will reset the simulator (equivalent to iOS Simulator > Reset Contents and Settings... menu item).
With Xcode 6.0.1 (Build 6A317), there is either a bug or a change in behavior where when you uninstall an application, user defaults are not removed.
Usage: simctl [--noxpc] [--set <set path>] <subcommand> ... | help [subcommand]
Command line utility to control the iOS Simulator
For subcommands that require a <device> argument, you may specify a device UDID
or the special "booted" string which will cause simctl to pick a booted device.
If multiple devices are booted when the "booted" device is selected, simctl
will choose one of them.
Subcommands:
create Create a new device.
delete Delete a device.
erase Erase a device's contents and settings.
boot Boot a device.
shutdown Shutdown a device.
rename Rename a device.
getenv Print an environment variable from a running device.
openurl Open a URL in a device.
addphoto Add a photo to the photo library of a device.
install Install an app on a device.
uninstall Uninstall an app from a device.
launch Launch an application by identifier on a device.
spawn Spawn a process on a device.
list List available devices, device types, or runtimes.
notify_post Post a darwin notification on a device.
icloud_sync Trigger iCloud sync on a device.
help Prints the usage for a given subcommand.
Reset all Content & Settings in a single command
Quit iPhone Simulator
In Terminal, run:
xcrun simctl erase all
This will reset content and settings of all the simulators for the active version of Xcode (the one referenced by xcode-select -p).
xcrun simctl uninstall simulatorIdentifier appBundleId

Running iOS app on a different Mac / simulator

I have built a demo iOS app on my Mac. My client wants to get the executable and run it on his iOS simulator on his Mac so as to give me feedbacks. I have an Apple developer account and I can deploy my app to my iPad / iPhone or distribute it via AppStore. But I don't know how to generate an iOS simulator executable for him. He only wants the iOS simulator executable. Does anyone have tried this before?
P.S. I can't really distribute it via AppStore since it is just a demo app. It is very likely rejected. Plus, I have to send it to him today so I don't think Apple can pass my app within a day.
P.P.S. I can't give him the source code unless he pays me. But it is not possible after a month.
Please help. Thanks in advance!
You need to send him the Application folder under the iPhone Simulator folder.
You can find it here:
~/Library/Application Support/iPhone Simulator/<Simulator-Version>/Applications/
Building upon this answer by #Midhun, for later versions of Xcode (Xcode 6, Xcode 7 and Xcode 8 in my research), the simulators now live here:
~/Library/Developer/CoreSimulator/Devices
I was actually trying to use an app built on Xcode 8 for iOS8 simulator and get it to run on an ios7 simulator from Xcode 6 on another Mac. I couldn't find out how to simply copy files around but I did manage to copy the Mine.app folder to the other Mac, then install it using
xcrun simctl install 6DC6323C-504C-423F-ACD6-652557B33D48 Mine.app
where you need to replace 6DC6323C-504C-423F-ACD6-652557B33D48 with your simulator device type ID (find using xcrun simctl list devices).
For running app, build on other mac machine to yours machine simulator. we require .app file for that project.
run below command in terminal
xcrun simctl install booted $LOCATION/FILENAME.app
replace $LOCATION with the path and the FILENAME should be the name.for more details check this link => https://www.webdigi.co.uk/blog/2016/how-to-transfer-your-app-to-an-ios-simulator-on-another-machine-using-app-file-and-xcrun/
iOS Run .app on another simulator
Build .app[About]
Xcode: Product -> Build
xcodebuild command[About]
//building workspace
xcodebuild -workspace "/path/to/workspace" -scheme "MyShemeName" -sdk iphonesimulator CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO
Find .app
//1. Build location*. Usually it is derived data folder
//2. Xcode.
Project navigator -> project -> Products group
//3. Get it from iOS simulator
Activity Monitor -> <App Name>(not Xcode) -> Double click -> Open Files and Ports -> Find <App Name.app> path -> find and copy a file <App Name.app> by path -> save the file locally
[Build location]
Install .app
xcrun simctl install booted <app_path.app>
Or you can send just the one app you need from ~/Library/Application\ Support/iPhone\ Simulator/7.0/Applications/GUID-OF-YOUR-APP
i have used a similar tool called Simulator Bundler in a recent project with no issues,
https://github.com/landonf/simlaunch/downloads
Midhun MP answer is good but in case of solution don't work then in emergency sometimes making video and sending it to client would help. This tool provide light weight video creation.
http://www.screencast-o-matic.com/
You can resize it for your simulator.

Resources