Swift Tutorial: An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2)

I'm going through the Swift tutorial, on the "Handling Error" section: https://developer.apple.com/tutorials/app-dev-training/handling-errors

One of the step asks you to input xcrun simctl get_app_container booted com.example.apple-samplecode.Scrumdinger data into the Terminal to get the location of the App Sandbox.

When I do this, I get the following error:

An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):
The operation couldn’t be completed. No such file or directory
No such file or directory

I've tried 2 things but neither worked:

  1. Command-Shift-K in Xcode to clean the build
  2. "Erase all Content and Settings" in Simulator to reset it

I'm using the Xcode 14.2, running on M2 Macbook Air.

Hey, I you might have this error because your package name (app name/ bundle identifier) is different than the one used in the tutorial. If you click on the Scrumdinger at the top left, then go to tagers -> Scrumdinger you will be able to check your bundle identifier. Change it in your prompt.

Hi Valachio,

I encountered the same roadblock as you and after digging through a few information here and there I was able to get through this. Hope this helps.

  1. At the top "View" -> "Navigator" -> "Show Navigator" (Alternatively you can also open this using the shorthand ⌘+0)

  2. Clicked on the root of the folder (which may be named for you as "Scrumdinger" with the app store icon on the left)

  3. There will be "PROJECTS" and "TARGETS" click on the "Scrumdinger" at the "TARGETS"

  4. There will be "Identity" row and there you will find your "Bundle Identifier"

  5. Copy that (*********) whatever name it is there.

  6. xcrun simctl get_app_container booted (com.example.apple-samplecode.Scrumdinger) data replace the ( ) to the (*********)

which will look like this "xcrun simctl get_app_container booted (*********) data"

Swift Tutorial: An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2)
 
 
Q