Xcode cannot run iOS simulator - ios

Version 8.0 beta 5.
I've recently installed the above beta version of Xcode but I'm unable to run any iOS 10.0 simulators. I've done various uninstalls on both the 8 beta and Xcode 7, clearing out directories and reboots but no success. After reinstalling I still can't run iOS 10.0 simulators. (I've copied the Xcode download to another machine and successfully unpacked and installed it there without any problems, so it's not a corrupt download.)
xcrun yields the following information...
09:44:13 ~ > xcrun simctl list
== Device Types ==
iPhone 4s (com.apple.CoreSimulator.SimDeviceType.iPhone-4s)
iPhone 5 (com.apple.CoreSimulator.SimDeviceType.iPhone-5)
iPhone 5s (com.apple.CoreSimulator.SimDeviceType.iPhone-5s)
:
iPad Pro (9.7-inch) (com.apple.CoreSimulator.SimDeviceType.iPad-Pro--9-7-inch-)
iPad Pro (12.9-inch) (com.apple.CoreSimulator.SimDeviceType.iPad-Pro)
Apple TV 1080p (com.apple.CoreSimulator.SimDeviceType.Apple-TV-1080p)
== Runtimes ==
iOS 8.1 (8.1 - 12B411) (com.apple.CoreSimulator.SimRuntime.iOS-8-1)
iOS 9.3 (9.3 - 13E233) (com.apple.CoreSimulator.SimRuntime.iOS-9-3)
iOS 10.0 (10.0 - 14A5335a) (com.apple.CoreSimulator.SimRuntime.iOS-10-0) (unavailable, failed to open liblaunch_sim.dylib)
tvOS 10.0 (10.0 - 14T5321a) (com.apple.CoreSimulator.SimRuntime.tvOS-10-0)
== Devices ==
-- iOS 8.1 --
-- iOS 9.3 --
-- iOS 10.0 --
-- tvOS 10.0 --
== Device Pairs ==
09:44:18 ~ >
Any help appreciated.

sudo killall -9 com.apple.CoreSimulator.CoreSimulatorService
This brought my simulators back to the run menu, allowed me to add more, and my simulators actually now run again. (Xcode 10b6).
Strangely enough, seemed to clear up a system header build problem too.. now my extra system header search directory location works and no compile error indicating it can't find the files and I did not mod the project.

Finally got it working. I (for the third or fourth time) deleted Xcode-beta.app and Xcode.app and also all the associated files and directories I could find (using the free app AppDelete Lite.app. In addition, I also deleted the /Application/Contents/ directory.
Then, I extracted the Xcode-beta.app again and installed it as normal and it all worked. I'd be happier if I could pin down the cause of the problem and happier still if I could get the lost two days of my life back but at least everything appears to be working now.

This should solve your problem:
killall "Simulator" 2> /dev/null; xcrun simctl erase all

Related

Here is the Empty List of IOS simulators 12.1 and 12.4. How can I install them back?

As a ios developer, i need iOS simulators so that I can build my project and dependencies using Carthage. When I run carthage bootstrap , I find that my iOS simluators missing. Would you please help me advise the way to install the simulators back?
jackson#Larrys-MBP src % xcrun simctl list devices
== Devices ==
-- iOS 10.0 --
-- iOS 10.1 --
-- iOS 10.2 --
-- iOS 10.3 --
-- iOS 11.0 --
-- iOS 12.1 --
-- iOS 12.4 --
-- tvOS 12.4 --
-- watchOS 2.2 --
-- watchOS 5.3 --
jackson#Larrys-MBP src % open -a Simulator
Open Xcode (e.g. Xcode 11.2.1) and open Xcode->Preferences->Components and tap "arrow down" for corresponding iOS simulators to download.
Xcode 11.2.1 allows to download simulators starting from iOS 10.3. Hence, you will need to download older version of the Xcode to be able to install previous versions, e.g. Xcode 10.
It looks like you deleted the simulator devices (either via the Devices Window in Xcode or via the simctl command line tool). Xcode will automatically create some devices when it encounters a new simulator runtime. If you delete them, they don't get recreated.
If you want them back, you'll need to manually recreate them using the devices window or simctl (eg: xcrun simctl create ...)

Test app on iOS 7.1

I need to test my app on iOS 7.1 but ran out of options.
My setup:
MacBook running El Capitan Xcode 7
No physical devices running iOS 7
I cant run the iOS 7 simulator - the simulator says that the runtime cannot be found and I cannot download iOS 7 from "downloads.
Do you have any suggestions?
My adviceļ¼š
(Remind: my English is limited, my expression is not very good!)
1.We can use Xcode7 to compiler to generate debug app
2.Use the xcode - select switch commandline tool to Xcode6.4
3.Run xcode6.4 iOS7 simulator
4.Using xcrun simctl installed test app to xcode6.4 iOS7 simulator
5.Run to check the effect (can't debugging)

installing ios 7 on xcode 6.1 on yosemite

I have search a lot and comes up with lot's of different solutions and opinions which I got really confused .
I have xcode 6.1 installed with ios 8.1 simulator and I'm trying to test my apps on ios 7 . There are so many different opinions about installing ios 7 . Some says that ios 7 is not working on Yosemite and some says otherwise. also I have tried to install ios 7 from preference>devices but It got stuck and there is no progress at all with downloading.
Can anybody helps me please?Is it possible to run ios 7 on xcode 6.1 and yosemite?If so , how should I download ios 7 simulator for xcode 6.1 without using the xcode download section?maybe I can extract it from older version of xcode or download it from another source.Does upgrading to higher version of xcode helps?
Thanks
Open at Xcode Window menu, then Devices and there you can add desired simulator using little + button at the left bottom corner
The iOS 7.0 Simulator Runtime is not supported on OS X Yosemite.
The iOS 7.1 Simulator Runtime is supported on OS X Yosemite.
Install Xcode 6.2 and navigate to Xcode -> Preferences -> Downloads, and you will be given the option to install the iOS 7.1 Simulator Runtime. It will install below /Library/Developer/CoreSimulator.
Note that some versions of Xcode have a bug where the download will not occur if your laptop is running on battery. I do not know of the top of my head which versions of Xcode are affected. If the download progress isn't moving forward, go connect to AC.
Of course you can run iOS 7 on Xcode 6 or higher version. In order to download the iOS 7 follow the blow steps
Xcode > Preferences > Downloads > Choose the iOS 7 simulator
UPDATE
If you want to extract the iOS sdks from older version go to the terminal and follow below and then restart the xCode.
cp -r SOURCE_PATH DESTINATION_PATH
for example
cp -r /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/

The iOS 8.1 simulator runtime is not available error in Xcode 6.1

I was using Xcode 6.0.1 till now and things were fine. Then I upgraded to Xcode 6.1 and tried running my application(which has a deployment target of 7.0) in iPhone 6 simulator. But it shows an error message :
The iOS 8.1 simulator runtime is not available. Download the iOS 8.1 simulator runtime from the Downloads section in Xcode's Preferences
I manually deleted the earlier Xcode (6.0.1) and installed 6.1 from a dmg.
I tried searching across but couldn't find related stuff. Any help would be appreciated.
It is a Mac problem, not an Xcode problem.
Logout the user, shutdown, restart or just reboot Mac. Your Xcode simulator will go back to normal.
For anyone still facing this issue, this command worked for me:
sudo killall -9 com.apple.CoreSimulator.CoreSimulatorService
Rebooting did not help me.
Installing/Reinstalling Simulators worked!!
Look under (XCode Preferences-> Downloads -> Components)
Maintain an accurate list of iOS simulators
When upgrading, you may drag around old simulators no longer available with your current version of Xcode. You can clean these by running this command in Terminal:
xcrun simctl delete unavailable
Quit Xcode first just for good measures. From the documentation:
Delete a device or all unavailable devices.
Rebooting my computer fixed this exact issue for me. Same error was thrown for both iOS7 and iOS8 simulators. I'm on OS X 10.10 and Xcode 6.1.
Just had this problem with Xcode 8 beta 5. I downloaded ios8 and 9 simulators, but was not able to run my app. I simply deleted derived data and rebooted my computer. It worked for me.

Cordova: start specific iOS emulator image

I'm developing a cross-platform mobile app using Cordova, focussing mainly on iOS in the development stage.
For my development process it would be ideal if I could start my Cordova app directly from the command line and have it load into a specified emulator. I can do this by running the following from the project root directory:
$cordova run --debug --emulator iOS
This works fine, and results in an iOS-simulator running my app in a simulated iPhone 4 Retina with iOS 7.0.3
Besides this simulated device, I would also like to test on (for instance) an iPad. I have these emulation images installed, and I can start my app in them manually in Xcode. Also, the command list-emulator-images (located in project_dir/platforms/ios/cordova/lib) gives the following output:
"iPhone Retina (3.5-inch)"
"iPhone Retina (4-inch)"
"iPhone Retina (4-inch 64-bit)"
"iPhone"
"iPad"
"iPad Retina"
However, the thing is: I can't seem to figure out how to start the emulator in anything other than the default (which appears to be the iPhone Retina (4-inch) emulation image). The relevant output of cordova help gives the following information:
run [--debug|--release]
[--device|--emulator|--target=FOO]
[PLATFORM] ............................ deploys app on specified platform devices / emulators
I've tried things like the following:
cordova run --debug --emulator=iPad iOS
And many variations thereof, but no luck. Every time it starts in the same emulator.
The documentation for the command-line tool doesn't offer any information in this regard, and an extensive Google-search also failed to turn up anything. Am I missing something trivial? Or am I trying to do something weird? I really hope someone here has experience with this, and can provide some answers.
Thanks very much in advance!
edit: forgot to mention explicitly; I'm doing all this on a Mac. As mentioned earlier, running the app in different emulators/simulators in Xcode works fine.
To find out what are the simulator images available you can use to list them
$ cordova emulate ios --list
Available iOS Virtual Devices:
iPhone-4s, 9.3
iPhone-5, 9.3
iPhone-5s, 9.3
iPhone-6, 9.3
iPhone-6-Plus, 9.3
iPhone-6s, 9.3
iPhone-6s-Plus, 9.3
iPad-2, 9.3
iPad-Retina, 9.3
iPad-Air, 9.3
iPad-Air-2, 9.3
iPad-Pro, 9.3
Then use one of the simulator names in the --target parameter:
cordova emulate ios --target="iPhone-4s, 9.3"
cordova emulate ios --target="iPad-Air-2, 9.3"
cordova emulate ios --target="iPhone-6s, 9.3"
cordova emulate ios --target="iPhone-6-Plus, 9.3"
Important Quit the simulator before launching a different target simulator (On Menu bar select Simulator->Quit)
Take into account that you may need to quit the iOS simulator via menu to switch from 3.5 to 4 inch iPhone.
dynamic list is available in platforms/ios/cordova/lib/list-emulator-images
As say csantanapr you can use:
cordova emulate ios --target="iPhone-4s"
but, in this case cordova (or PhoneGap or other) project will be launched on iPhone 4s simulator with iOS version 7.0.3.
If you want launch project on same simulator, but with other version iOS (7.1 or 8.0, if it versions exist in your system)?
Of corse, you can do like say cobberboy:
start a specific emulator and choose your ios version by directly using ios-sim.
But you can improve --target option of cordova run command.
At first you must ensure what target iOS version available on your system.
For it use answer of cobberboy:
$ ios-sim showdevicetypes
Then you need to open the file your_project_dir/platforms/ios/cordova/lib/run.js and find lines of code like below:
// validate target device for ios-sim
// Valid values for "--target" (case sensitive):
var validTargets = ['iPhone-4s', 'iPhone-5', 'iPhone-5s', 'iPhone-6-Plus', 'iPhone-6',
'iPad-2', 'iPad-Retina', 'iPad-Air', 'Resizable-iPhone', 'Resizable-iPad'];
For use iPhone-4s, 7.1 (or some other) simple add it to array validTargets.
var validTargets = ['iPhone-4s', 'iPhone-4s, 7.1', 'iPhone-5', 'iPhone-5s', 'iPhone-6-Plus', 'iPhone-6',
'iPad-2', 'iPad-Retina', 'iPad-Air', 'Resizable-iPhone', 'Resizable-iPad'];
And in
cordova emulate ios --target="iPhone-4s, 7.1"
your --target="iPhone-4s, 7.1" will be valid.
And function deployToSim of run.js:
function deployToSim(appPath, target) {
// Select target device for emulator. Default is 'iPhone-6'
if (!target) {
target = 'iPhone-6';
console.log('No target specified for emulator. Deploying to ' + target + ' simulator');
}
var logPath = path.join(cordovaPath, 'console.log');
var simArgs = ['launch', appPath,
'--devicetypeid', 'com.apple.CoreSimulator.SimDeviceType.' + target,
// We need to redirect simulator output here to use cordova/log command
// TODO: Is there any other way to get emulator's output to use in log command?
'--stderr', logPath, '--stdout', logPath,
'--exit'];
return spawn('ios-sim', simArgs);
}
convert iPhone-4s, 7.1 to valid argument com.apple.CoreSimulator.SimDeviceType.iPhone-4s, 7.1 for ios-sim.
TL;DR
You can start a specific emulator and choose your ios version by directly using ios-sim.
export appname="./platforms/ios/build/emulator/Hello World.app"
ios-sim launch "$appname" --devicetypeid "com.apple.CoreSimulator.SimDeviceType.iPad-2, 8.0" --stderr ./platforms/ios/cordova/console.log --stdout ./platforms/ios/cordova/console.log
Details
When I ran this:
cordova emulate ios --target="iPad"
and looked at the processes running, I saw this (on a single line):
ios-sim launch ./platforms/ios/build/emulator/HelloWorld.app
--stderr ./platforms/ios/cordova/console.log
--stdout ./platforms/ios/cordova/console.log
--family ipad
--exit
Investigating further into ios-sim, it looks like there are some more specific options, particularly:
--devicetypeid <device type> The id of the device type that should be simulated (Xcode6+). Use 'showdevicetypes' to list devices.
e.g "com.apple.CoreSimulator.SimDeviceType.Resizable-iPhone6, 8.0"
So I did as it suggested and ran ios-sim with a "showdevicetypes" argument and got this:
$ ios-sim showdevicetypes
com.apple.CoreSimulator.SimDeviceType.iPhone-4s, 7.1
com.apple.CoreSimulator.SimDeviceType.iPhone-5, 7.1
com.apple.CoreSimulator.SimDeviceType.iPhone-5s, 7.1
com.apple.CoreSimulator.SimDeviceType.iPad-2, 7.1
com.apple.CoreSimulator.SimDeviceType.iPad-Retina, 7.1
com.apple.CoreSimulator.SimDeviceType.iPad-Air, 7.1
com.apple.CoreSimulator.SimDeviceType.iPhone-4s, 8.0
com.apple.CoreSimulator.SimDeviceType.iPhone-5, 8.0
com.apple.CoreSimulator.SimDeviceType.iPhone-5s, 8.0
com.apple.CoreSimulator.SimDeviceType.iPhone-6-Plus, 8.0
com.apple.CoreSimulator.SimDeviceType.iPhone-6, 8.0
com.apple.CoreSimulator.SimDeviceType.iPad-2, 8.0
com.apple.CoreSimulator.SimDeviceType.iPad-Retina, 8.0
com.apple.CoreSimulator.SimDeviceType.iPad-Air, 8.0
com.apple.CoreSimulator.SimDeviceType.Resizable-iPhone, 8.0
com.apple.CoreSimulator.SimDeviceType.Resizable-iPad, 8.0
Don't include version number
cordova run ios --target="iPhone-6s"
As of Xcode 8.3.2...
Old thread, I know, but it seems, perhaps, that the answer has changed slightly. The hints from earlier posts in this thread helped, but so did reading the documentation included in the code, <cordova-project>/platforms/ios/cordova/lib/run.js
Execute ./platforms/ios/cordova/lib/list-emulator-images to list the available emulator images. Do not include the version number on the end when making the cordova call to run in the desired emulator.
cordova run ios --emulator --target="iPad-Air"
See more
I can't comment on the answer above due to my low reputation, but the list of targets is available from:
start-emulator
under
your platform/ios/cordova/lib/
Having said that, I cannot make the ipad retina emulator work...
fastest output of devices list:
$ instruments -s devices
Just use the device name without the version.
Now is:
cordova run ios --list
Available ios devices:
Available ios virtual devices:
Apple-TV-1080p, tvOS 14.3
Apple-TV-4K-4K, tvOS 14.3
Apple-TV-4K-1080p, tvOS 14.3
Apple-Watch-Series-5-40mm, watchOS 7.2
Apple-Watch-Series-5-44mm, watchOS 7.2
Apple-Watch-Series-6-40mm, watchOS 7.2
Apple-Watch-Series-6-44mm, watchOS 7.2
iPhone-8, 14.3
iPhone-8-Plus, 14.3
iPhone-11, 14.3
iPhone-11-Pro, 14.3
iPhone-11-Pro-Max, 14.3
iPhone-SE--2nd-generation-, 14.3
iPhone-12-mini, 14.3
iPhone-12, 14.3
iPhone-12-Pro, 14.3
iPhone-12-Pro-Max, 14.3
iPod-touch--7th-generation-, 14.3
iPad-Pro--9-7-inch-, 14.3
iPad-Pro--11-inch---2nd-generation-, 14.3
iPad-Pro--12-9-inch---4th-generation-, 14.3
iPad--8th-generation-, 14.3
iPad-Air--4th-generation-, 14.3
And:
cordova run ios --target="iPad-Pro--12-9-inch---4th-generation-, 14.3"
In Cordova 10.0.0
Different iphone and ipad simulator
cordova run ios --list
cordova emulate ios --target "iPhone-7"
Runs iOS simulator with web request based on already generated build for cordova application.
Execute this request from browser opens simulator on mac with iPhone 8Plus version:
http://hostname:3000/cordova/build/[xxxx-buildnumber]/emulate?target=iPhone-8-Plus
#Birja's answer is working right now but the run command he used finally is still wrong so here the right answer:
To list all the devices available in simulator cordova run ios --list
It will result in something like this:
Available ios devices:
Available ios virtual devices:
Apple-TV-1080p, tvOS 12.2
Apple-Watch-Series-2-38mm, watchOS 5.2
iPhone-5s, 12.2
iPhone-6, 12.2
iPad-Air-2, 12.2
iPad--5th-generation-, 12.2
iPad-Pro--9-7-inch-, 12.2
iPad-Pro, 12.2
iPad-Pro--12-9-inch---2nd-generation-, 12.2
iPad-Pro--10-5-inch-, 12.2
iPad--6th-generation-, 12.2
iPad-Pro--11-inch-, 12.2
iPad-Pro--12-9-inch---3rd-generation-, 12.2
cordova run ios --target "iPad-Pro, 12.2" Use any target from the above. To run in simulator.

Resources