Search code examples
iosxcodemetalmetalkitios14

iOS14 Autorotation bug with debugger


EDIT: I found the culprit. A single line in code freezes iOS 14 device autorotation in debugger. The XCode project is "dead" forever unless you delete it and create a new copy.

class ViewController: UIViewController {

public static let metalDevice:MTLDevice? = MTLCreateSystemDefaultDevice() //Freezes iOS 14 device

override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view.
}

}

I am seeing an unusual autorotation bug in iOS 14 (beta 3). I have an XCode project with some AVFoundation (AVCaptureSession) & Metal code to setup camera and rendering of camera frames. The code is huge, but here is the strange thing about bug.

  • Build the project with XCode 12 and run on iOS 14 device. The view controller doesn't autorotate when connected to debugger. When the app is opened without debugger, autorotation happens,

  • Once Autorotation is blocked in debugger, it gets blocked forever for the XCode project. Meaning, if I change the initial view controller to some dummy view controller, it too fails to autorotate!!! Only way is to make a new XCode project to reproduce the issue.

  • This does not happen on iOS 13 devices.

Reproducible test case is very difficult to make as there is lot of code. I tried trimming a lot of code but then it is not reproducible. And even to find the culprit code, I will need to make a new XCode project everytime as the project once dead is dead forever!

Is anyone aware of similar issue? Any inputs would be appreciated.


Solution

  • This is certainly a show stopper and very disabling bug in iOS 14. Either Disabling GPU frame capture or setting GPU frame capture to 'Metal' in the Scheme settings seems to fix it.