Invalid Device State - Xcode/iOS Simulator error
Asked Answered
R

13

58

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.

Rewire answered 6/4, 2015 at 21:48 Comment(4)
Make sure you have selected the Apple Watch scheme in Xcode and have opened the external display in the Simulator that allows you to view the watch display.Farrica
I tried an older Xcode project I know was working weeks ago before some updates and it no longer works either. Good suggestions nonetheless.Rewire
Get this as well on Xcode 7.3Felker
Check this answer for XCode 9.0Waterfront
E
41

Force Quit xCode and restart will resolve problem.

Ema answered 1/4, 2016 at 9:25 Comment(1)
This. Thank goodness I didn't delete Xcode first, like other answers suggest!Nazarius
I
26

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!

Ivett answered 21/1, 2016 at 7:9 Comment(0)
G
16

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 !

Gaiser answered 27/4, 2015 at 12:19 Comment(0)
G
12

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.
Galleon answered 17/8, 2016 at 22:56 Comment(0)
B
8

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.

Backfield answered 30/9, 2016 at 5:31 Comment(0)
C
3

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

Catchpole answered 29/7, 2016 at 22:11 Comment(0)
C
1

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.
Caboose answered 13/6, 2016 at 7:45 Comment(0)
L
1

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.

Labradorite answered 30/12, 2016 at 7:27 Comment(0)
K
0

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.
Knowland answered 24/5, 2016 at 17:20 Comment(0)
Q
0

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

Quantitative answered 21/9, 2016 at 9:25 Comment(0)
I
0

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

Intosh answered 2/6, 2017 at 3:50 Comment(0)
R
0

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

Receptacle answered 17/7, 2021 at 1:41 Comment(0)
P
0

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.

Palm answered 17/11, 2022 at 6:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.