Error = Device orientations are not supported in Mac Catalyst processes

Error = Device orientations are not supported in Mac Catalyst processes

Got this error when selecting the Destination = "My Mac (designed for iPad".

I tried using the following Code Snippet in my GameViewController, but it did not work. Can anyone provide some guidance?:

#if os(iOS) && !targetEnvironment(macCatalyst)
    
    // for rotation Landscape <-> Portrait = iOS,
    // but *not* for Mac (built for iPad)
    override func viewDidLayoutSubviews() {
        
        super.viewDidLayoutSubviews()
        
        showScene()
        
    }   // viewDidLayoutSubviews

#endif
Answered by JohnLove in 768902022

A very, very interesting observation:

In my iPad Computer Game already uploaded to the App Store, I don't have any code that calls:

targetEnvironment(macCatalyst)

Yet, when in the distant past, this previous iPad Game of mine became available for download from the App Store, just on a whim, I downloaded it to my iMac Desktop to see what would happen. It worked with Ventura and Sonoma. ASAMOF, in its Supported Destinations, I just had iPad with zero mention of Mac (Designed for iPad).

SO, I eliminated any testing for targetEnvironment(macCatalyst) in the above #if and set the Product's Destination to My Mac (Designed for iPad)

AND IT WORKED!

Bottom Line = apparently I don't need to test for targetEnvironment.

Anyway, sorry to bother you folks with what turned out to be a very simple correction.

Accepted Answer

A very, very interesting observation:

In my iPad Computer Game already uploaded to the App Store, I don't have any code that calls:

targetEnvironment(macCatalyst)

Yet, when in the distant past, this previous iPad Game of mine became available for download from the App Store, just on a whim, I downloaded it to my iMac Desktop to see what would happen. It worked with Ventura and Sonoma. ASAMOF, in its Supported Destinations, I just had iPad with zero mention of Mac (Designed for iPad).

SO, I eliminated any testing for targetEnvironment(macCatalyst) in the above #if and set the Product's Destination to My Mac (Designed for iPad)

AND IT WORKED!

Bottom Line = apparently I don't need to test for targetEnvironment.

Anyway, sorry to bother you folks with what turned out to be a very simple correction.

Error = Device orientations are not supported in Mac Catalyst processes
 
 
Q