Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS run two simulators failed: Unable to lookup in current state: Shutdown

Tags:

xcode

ios

I'm trying to run my (React native) app on more simulators.

yarn run ios --simulator="iPhone SE"
# also tried
yarn run ios --simulator="iPhone SE (2nd generation)"

First simulator starts successfully, but the other one failed.

I have error:

Unable to lookup in current state: Shutdown

Xcode version: 13.0, Simulator
OS version: macOS Big Sur 11.5.2

success Successfully built the app
--- xcodebuild: WARNING: Using the first of multiple matching destinations:
{ platform:iOS Simulator, id:dvtdevice-DVTiOSDeviceSimulatorPlaceholder-iphonesimulator:placeholder, name:Any iOS Simulator Device }
{ platform:iOS Simulator, id:FDCE0C7E-5917-42BB-AD4E-FAAA3D726BEE, OS:13.5, name:iPhone 8 }
{ platform:iOS Simulator, id:1034D1B6-A0EF-4334-A4F8-C74E74B092E6, OS:15.0, name:iPhone 8 }
{ platform:iOS Simulator, id:93D44AD6-FB9A-4E8F-819E-52FFC9DD01F5, OS:13.5, name:iPhone 8 Plus }
{ platform:iOS Simulator, id:3FB69956-5357-44CE-88EF-DF02A6930C1D, OS:15.0, name:iPhone 8 Plus }
{ platform:iOS Simulator, id:3AEA5922-A5DE-4F26-9C41-056DD18DE33F, OS:13.5, name:iPhone 11 }
{ platform:iOS Simulator, id:C18F8CC6-6712-45EC-B10B-838CF1961B20, OS:15.0, name:iPhone 11 }
{ platform:iOS Simulator, id:6815E116-44A3-47C3-A454-82EF37C20BE5, OS:13.5, name:iPhone 11 Pro }
{ platform:iOS Simulator, id:C095653C-0FD3-493C-B4E6-D65CEEDCE135, OS:15.0, name:iPhone 11 Pro }
{ platform:iOS Simulator, id:BC6B4577-2A4B-43C8-B1F9-54B0755D3D19, OS:13.5, name:iPhone 11 Pro Max }
{ platform:iOS Simulator, id:5180B3F4-3D40-487C-941B-F0A3A0B28570, OS:15.0, name:iPhone 11 Pro Max }
{ platform:iOS Simulator, id:6D22A3E2-F0B7-40A6-9E30-05CB3837470D, OS:15.0, name:iPhone 12 }
{ platform:iOS Simulator, id:20AF9F18-024F-4242-9113-94BB855B1BA6, OS:15.0, name:iPhone 12 Pro }
{ platform:iOS Simulator, id:639D955E-9BA8-4ECF-BA68-DC6C1F9CCD74, OS:15.0, name:iPhone 12 Pro Max }
{ platform:iOS Simulator, id:612F66A0-7050-45D0-A46F-805E390AF074, OS:15.0, name:iPhone 12 mini }
{ platform:iOS Simulator, id:0FE7C078-556D-40F9-8198-375C10B3991D, OS:15.0, name:iPhone 13 }
{ platform:iOS Simulator, id:885D1181-08F8-438A-8B9A-FE940BCCA59B, OS:15.0, name:iPhone 13 Pro }
{ platform:iOS Simulator, id:5803C768-0E6F-420C-A236-0637CE433775, OS:15.0, name:iPhone 13 Pro Max }
{ platform:iOS Simulator, id:8A9F4BC4-D751-4D25-8290-E3D35C46F48F, OS:15.0, name:iPhone 13 mini }
{ platform:iOS Simulator, id:493495F3-2F78-4A60-B937-FDDA6A533282, OS:13.5, name:iPhone SE }
{ platform:iOS Simulator, id:9731F210-9C16-43AB-AC99-22C2E55F1F86, OS:13.5, name:iPhone SE (2nd generation) }
{ platform:iOS Simulator, id:6B410509-2517-4909-8174-F42CBEE974B8, OS:15.0, name:iPhone SE (2nd generation) }
{ platform:iOS Simulator, id:D0C1C85A-C505-4902-ADCA-BA9408964D2C, OS:13.5, name:iPhone X }
{ platform:iOS Simulator, id:CAF4BBDC-BEB9-4C23-B947-F1A0CE626012, OS:15.0, name:iPod touch (7th generation) }
{ platform:iOS, id:dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder, name:Any iOS Device }
{ platform:iOS Simulator, id:9BF4625F-142F-427D-A9D1-8A831C62E63B, OS:13.5, name:iPad (7th generation) }
{ platform:iOS Simulator, id:3745BC92-4688-4B75-9D92-25EF2FCC52DB, OS:15.0, name:iPad (9th generation) }
{ platform:iOS Simulator, id:6AB2E356-D8D1-42A4-B2B7-BA18DCA7F543, OS:13.5, name:iPad Air (3rd generation) }
{ platform:iOS Simulator, id:350A8457-97C3-440D-B521-BD9BD067F3CB, OS:15.0, name:iPad Air (4th generation) }
{ platform:iOS Simulator, id:3FA72A11-0536-4BDC-B113-503D31731401, OS:13.5, name:iPad Pro (9.7-inch) }
{ platform:iOS Simulator, id:67CD5DF7-5037-4B80-8711-8BD3692A18E9, OS:15.0, name:iPad Pro (9.7-inch) }
{ platform:iOS Simulator, id:68CD4C92-AD3D-4F55-B258-E8FF6B557E8A, OS:13.5, name:iPad Pro (11-inch) (2nd generation) }
{ platform:iOS Simulator, id:9ABE2EC3-245C-4189-AD56-13D8FC0D808E, OS:15.0, name:iPad Pro (11-inch) (3rd generation) }
{ platform:iOS Simulator, id:CF04F4B8-6B81-4DC3-9FF0-0C5FE3465587, OS:13.5, name:iPad Pro (12.9-inch) (4th generation) }
{ platform:iOS Simulator, id:F1B64316-868F-409B-8932-03A8570279B9, OS:15.0, name:iPad Pro (12.9-inch) (5th generation) }
{ platform:iOS Simulator, id:D9D361CC-479C-4856-A560-699C5D1A91A1, OS:15.0, name:iPad mini (6th generation) }
info Installing "/Users/babu/Library/Developer/Xcode/DerivedData/MyApp-axbsjlkepgdnjucdpwvjpiaqcuef/Build/Products/Debug-iphonesimulator/MyApp.app"
An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=405):
Unable to lookup in current state: Shutdown
info Launching "org.myapp.ios.dev"
error Failed to launch the app on simulator, An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=405):
Unable to lookup in current state: Shutdown
like image 385
Babu Avatar asked Sep 22 '21 12:09

Babu


2 Answers

I faced this issue after updating my Xcode to version 13.0, this is due to Xcode caches. You can clear the DerivedData folder to fix this

You can try following these steps to resolve the issue:

  1. Open Xode and select Preferences > Locations. 1
  2. Once the preference pane is open, click on the arrow next to /Xcode/DerivedData. This should open a finder window. 2
  3. Delete all sub-directory within the DerivedData folder
  4. Close Xcode and clean build app to install on iOS device
yarn ios

This should launch the iPhone simulator automatically and fix your issue. Incase it doesn't you can also try delete Xcode processes: Build error domain=com.apple.CoreSimulator.SimError, code=405

like image 61
Ravi Jayaraman Avatar answered Oct 11 '22 09:10

Ravi Jayaraman


tl;dr: Manually launch a second sim through the simulator tool, and then run your run-ios command with matching --simulator flag to target the sim you just opened.

I tried Ravi's advice as well as the advice in the thread he linked, as well as the advice in the apple dev thread linked in the thread he linked, not sure why but I'm still experiencing it myself.

In my case, attempting a second run-ios command when a sim is already running gives me OP's error. To avoid this error I:

  1. Manually launch a second sim via: xcode -> open developer tool -> simulator -> file -> open simulator -> simName.
  2. yarn run-ios command with flag --simulator="simName".

(To be sure you're pointing at the right sim with the right ios version, you can give your sim a descriptive name via: xcode -> window -> devices & simulators -> simulators -> click a name on the left panel to rename)

like image 36
sweetBabyD Avatar answered Oct 11 '22 07:10

sweetBabyD