What must I do to never see this xCode "Could not launch... No Such File or directory..." error again?

I’m building and running on an iPhone. It compiles fine, it installs fine, it tries to run- and then fails, saying it can’t find a file in the derived data folder. I can then manually launch the app on the iPhone with no problems, but xCode doesn’t recognize that it’s running.

I’ve found all these possible things that could cause this and ways to hopefully make it go away, usually including throwing out the contents of the DerivedData folder, but it still happens again ALL THE *&^%$#@ TIME and I don’t really know what I’m doing to finally get it to go away when it does. It seems like I can build and run a few times with the debugger connected and then it will start giving this stupid error again. Why, xCode? Why?

First, fix the problem causing the dialog. Close Unity and delete ALL of the Unity-iPhone projects in Xcode.
Next, make sure you don’t have any of the DerivedData directories you see in the error dialog - if you must go into a terminal window or Finder and move them to Trash.

To keep this from happening again follow these steps while you make changes and test your game on a device:

  1. Always hit “Stop” in Xcode, and Quit Xcode prior to killing your game on the device.
  2. On your device, force quit the game, then delete it.
  3. Then, you should be able to go into Unity, make any change you like, and rebuild/rerun the game without seeing the above problem.

I hope that helps you - it sure worked for me!