KeeperOfKale
KeeperOfKale

Reputation: 721

Invalid Device State - Xcode/iOS Simulator error

Problem: I cannot simulate an Apple watch interface. Whenever I try and test my Apple watch app on the iPhone 6 simulator, Xcode successfully finishes and builds the app, attempts at opening simulator and fails with an error message which reads 'Invalid Device State'.

Screenshot added

I believe simulator has a watch simulator that opens along with the compatible iPhone simulator models that can communicate with Apple watch (example: iPhone 6) Although I have yet to see it work. I have built a universal interface for iPad and iPhone and another for the watch, so it's not a matter of the app being for the wrong device. Whenever I test on my actual iPhone I can test the universal interface successfully.

I'm using Xcode 6.2 on iMac OS X 10.10.3

I have tried restarting Xcode/Computer. I can't seem to find any other mention of 'Invalid Device State' anywhere, hopefully due to it being an obvious thing to avoid/fix that I've overlooked. Any help would be appreciated.

Upvotes: 58

Views: 28828

Answers (13)

MikeL
MikeL

Reputation: 2894

I am pretty sure that in my case the simulator was corrupt after a failed language change.
Following this answer to reset the simulator worked.

Upvotes: 0

Norman
Norman

Reputation: 3215

On M1 Mac I've found more than 3 open simulators can cause this error. Quit the simulator app to fix this error.

Upvotes: 0

Mandeep Singh
Mandeep Singh

Reputation: 2855

First of all, just clean the project.

  1. Quit your project.
  2. Quit your Xcode.
  3. Restart Xcode.

This happens to me when I have two different Xcode versions running at the same time. Hopefully this helps you.

Upvotes: 8

Muhammad Shauket
Muhammad Shauket

Reputation: 2778

Robust fix is Just Quit your xcode and run again, hope so it will help you. This heck work for me.

Upvotes: 0

Dheeraj D
Dheeraj D

Reputation: 4451

I have Xcode 7.3 and Xcode 8.0 Installed.

If a am working with Xcode7.3 and opens Xcode8.0 to get some code from Xcode8.0 project.

When i run my application on Xcode7.3 So it will give me same error.

Solution is simple ForceQuit or Quit all Xcode's and open the required one.

Upvotes: 1

serdar aylanc
serdar aylanc

Reputation: 1347

Jus clean the project and restart Xcode. This happens to me when I have two diffent xcode versions running at the same time.

Upvotes: 0

bademi
bademi

Reputation: 421

I observed this happening when more than one Xcode app installed.

To fix this,

  1. Launch Xcode and click preference..,
  2. Go to "Location" Tab, Select correct options from "Command Line Tools" dropdown
  3. Quit Xcode and relaunch it.
  4. Run your app.

Upvotes: 12

John Difool
John Difool

Reputation: 5702

No need to quit, restart or even re-install. Switch to another iOS Simulator device (6s if you were using 6s plus) and voila!

Upvotes: 3

Swapnil
Swapnil

Reputation: 41

Nothing worked for me on XCode 7.3.1.

Had to reinstall it to make the simulator work.

  1. Go to applications folder. Drag drop XCode to Dustbin.
  2. Empty dustbin contents.
  3. Go to App Store and install XCode.
  4. Run XCode. The simulator should work now.

Upvotes: 1

Kevin Laity
Kevin Laity

Reputation: 2481

In my case, the simulator would show an indefinite black screen whether attempting to run a project, or running the simulator directly (which should bring you to the simulated home screen). This would happen even on a newly created simulated device.

After the existing suggestions failed, the following worked for me:

  • Delete the Simulator
  • Delete XCode
  • Delete the Developer folder
  • Reinstall XCode from the app store. This requires attempting to run XCode again so that Mac OS will realize it's no longer installed.

Upvotes: 0

Chirag Vindhani
Chirag Vindhani

Reputation: 502

Force Quit xCode and restart will resolve problem.

Upvotes: 42

Jayprakash Dubey
Jayprakash Dubey

Reputation: 36447

I had come across this issue after updating Xcode 6.4 to 7.1. Below are fixes for this :

  1. Clean project (cmd+shift+k) as well as clean build folder (cmd+shift+k+option)

Screenshot for clean

  1. Quit simulator and run again
  2. Quit Xcode and Simulator and run again
  3. Restart your Mac.

Solution 3 worked for me!

Upvotes: 26

RoaflinSabos
RoaflinSabos

Reputation: 967

I had the same issue. Generally it is because you just update Xcode or change its name in the Applications folder.

If you just restart your computer it will work correctly.

Hope it helps !

Upvotes: 16

Related Questions