Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AppDelegates function "supportedInterfaceOrientationsFor" does not get called on iPads

In my AppDelegate I am using a function to rotate my device and lock the orientation.

iPhone shall be portrait only, and iPad landscape only.

It works on iPhones, but the following function does never get called on iPads:

func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
    print("Test")
    return AppDelegate.orientationLock
}

I think it was working on iPads before I switched to "SwiftUI Life Cicle" but I am not absolutely sure if this was the point of time, where it stopped working:

 @UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate

The info.plist is also set to "Landscape only" for iPads, but the app starts in portrait mode anyway, which is strange too:

info.plist

like image 434
Kuhlemann Avatar asked Sep 06 '26 11:09

Kuhlemann


1 Answers

I also faced this issue in iPad, And got solution.

In your Info.Plist make this setting. enter image description here

or In your Project > General

enter image description here

like image 140
Kudos Avatar answered Sep 08 '26 06:09

Kudos



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!