'App installation failed. An unknown error has occurred.' When Debugging on iPhone with Xcode
What happened
When I tried to run an app on my iPhone using a MacBook Pro (2017) and Xcode 8.3, Xcode displayed “App installation failed. An unknown error has occurred.” and the app would not launch. Debugging had worked until then, but suddenly stopped working.

How did I solve it?
None of the following steps resolved the issue:
- Removing the app from the iPhone
- Clearing the Xcode cache
- Restarting the Mac
- Restarting the iPhone
The message only said “An unknown error has occurred.” I suspected a hardware issue, so I disconnected and reconnected the USB-C hub.

The hub appeared to be the cause. After reconnecting it, I could transfer the app to my iPhone and debug it with Xcode again. It took me about an hour to resolve the issue.
Additional Information
ios - Xcode 8 App installation failed, unknown error occurred - Stack Overflow