Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error running playground. Unable to find suitable target device. (iOS Swift)

I created a new project in XCode.

File > New > Playground (option+shift+cmd+N)

enter image description here

I restarted my XCode and also rebooted my system, but still same error.

like image 966
HDdeveloper Avatar asked Jan 14 '15 09:01

HDdeveloper


People also ask

Can iPhone play swift playgrounds?

Swift Playgrounds is the best and easiest way to learn how to code. And with Swift Playgrounds 4, you have the tools to build iPhone and iPad apps right on iPad and submit them directly to App Store Connect, providing a new way for you to easily create apps and share them with the world.

How do I stop swift playground from running?

Apparently, on the lower panel, there's a play and stop button there as per picture below.

How do I run a playground program in Xcode?

Simply click the Run button at the bottom-right of the playground, and wait for execution to complete. Xcode now compiles your code, and shows you its result. The default code doesn't output anything to the Console, but you should be able to see the value of the variable str in the sidebar on the right of Xcode.

Can you use swift playground on iPad?

As your knowledge of Swift grows, you can begin learning SwiftUI, the framework you'll use to experiment with app building right on your iPad. Explore the tutorial Get Started with Apps on the More Playgrounds screen and try adding some of your own code to see what it does.


2 Answers

From the developer forums, this worked for me:

  1. Quit Xcode
  2. Delete the folder /Users/<username>/Library/Developer/CoreSimulator/Devices. For example, in Terminal: rm -rf ~/Library/Developer/CoreSimulator/Devices
  3. In Terminal: killall -9 com.apple.CoreSimulator.CoreSimulatorService (or just reboot).
like image 99
Aaron Brager Avatar answered Sep 22 '22 05:09

Aaron Brager


Fox Xcode 7, I had to install iPad Air or iPad Air 2 for the playground to work.

like image 30
Nick Snyder Avatar answered Sep 22 '22 05:09

Nick Snyder