Search code examples
devicelaunchios14xcode12

Unable to launch iOS 14 app on device while connected to Xcode 12


Having an issue running any app with Xcode 12 on a physical device (device running 14.0.1)

Starting with a new project, the simple Hello World app will not launch on my device while connected to Xcode.

The screen remains black with the white bottom home bar showing. Xcode shows app is running, no warnings, no errors.

struct ContentView: View {
    var body: some View {
        Text("Hello, world!").foregroundColor(.red)
            .padding()
            .onAppear {
                print("Working....")
            }

    }
}

It works fine on the simulator, and thus prints out the debug text.

But, on my device, I do not get the debug text - so the launch process has failed.

However, if I stop the project on Xcode and then run the installed app on my device the app runs as expected!!

I changed the font color a couple of times, and it correctly installs the app to the device but fails to run when connected to Xcode, but works when running the app on the phone

I unpaired my device that didn't help.

No sure what to try next...

Thanks for any suggestions


Solution

  • I pass on this solution, which fixed this issue for me:

    1. Go to Xcode -> Preferences -> Locations.
    2. Tap the little arrow under the Derived Data section to open the Xcode directory in the Finder: enter image description here
    3. Quit Xcode.
    4. In that folder, go to the folder "iOS DeviceSupport": enter image description here
    5. Delete all the folders within the "iOS DeviceSupport" folder.
    6. Restart Xcode.
    7. If you use wireless debugging you'll probably have to reconnect your device to your computer to re-establish the connection.
    8. Build your project.

    Of course, it probably helps to be on the latest Xcode (12.0.1 as of writing) for this.