Xcode debug on iOS15 - blank white screen and minutes delay before App starts

Viewed 1189

Since upgrading my iPhone to iOS 15 and upgrading to Xcode 13 on my Mac, I have a problem with testing/debugging ANY SwiftUI app using Xcode. Even a new Xcode project with the simple "hello world" example behaves this way when the Xcode "Start" button is pressed (whether or not the target is a simulator or my physical iPhone with iOS 15).

The app seems to be correctly uploaded to the target but the target then displays a blank white screen for more than a minute (minutes) before displaying app screen.

When Xcode debugger is disconnected after that and the app is manually started on the target (whether simulator or physical iPhone), it seems to work fine (without any white screen appearing first).

Same behavior with all my SwiftUI apps (& simple Xcode Swift "Hello World" example)which have worked for a long time without any problems.

I still have Xcode 12.5 installed & it now exhibits the same behavior (even when target OS is iOS 14.5) and app is uploaded to my iOS 15 iPhone.

It is basically impossible to test & debug apps with this problem.

Has anyone else had this problem?

Any known solution or suggestions?

Thanks!

4 Answers

Just installed iOS v15.0.2 on my iPhone (Model: X). The problem was magically resolved after this iOS update!

When I reconnected my iPhone (to xCode on Mac) after this latest iOS update, I had to wait a few minutes for Xcode to complete "Fetching iPhone debug symbols from iPhone". Once that completed, Xcode once again launched any App (& connected it to debugger) immediately (as was the case before my iOS 15.0 update to iPhone) - without any blank screen and no more minutes long delay! So my whole Xcode development environment seems to be back to normal after this iOS update.

So the frustration & irritation seems to be over!

Try to delete iOS DeviceSupport folder, it must help debug on real device.

rm -r ~/Library/Developer/Xcode/iOS\ DeviceSupport

It depends on the mobile OS version, not Xcode

extension UIApplication {
    func getKeyWindow() -> UIWindow? {
        if #available(iOS 13.0, *) {
            return connectedScenes
                .filter { $0.activationState == .foregroundActive }
                .compactMap { $0 as? UIWindowScene }
                .flatMap { $0.windows }
                .first { $0.isKeyWindow }
        } else {
            return keyWindow
        }
    }
}

I'm wondering if it's because on iOS15, the keywindow is obtained when the app starts, .activationState == .foregroundInactive

If so, just remove the line

.filter { $0.activationState == .foregroundActive }

Related