HomeKit - App crash on call addAndSetupAccessories

Hi.
I have created a test application for HomeKit on iPad Mini (5th generation) with iOS 14.4 on Xcode 12.4.
The app is only for iPad, the supported orientation is landscape only and it's very basically : one view controller with one button when tapped execute the following code.

Code Block
HomeStore.shared.homeManager.primaryHome?.addAndSetupAccessories(completionHandler: { (error) in
            if error != nil
            {
                // DO SOMETHING
            }
            else
            {
                // DO SOMETHING ELSE
            }
        })


When the button is tapped the app crash with the following reason :


  • ** Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'Supported orientations has no common orientation with the application, and [HMSetupViewController shouldAutorotate] is returning YES'

I wan't to support the portrait orientation also, because I want the locked in landscape.

Is there a way to avoid the crash or is there a bug in HomeKit framework ?

I met the same issue, have you solved it?

HomeKit - App crash on call addAndSetupAccessories
 
 
Q