1

Hi I wanna fix the bug which occur in IOS16 for rotation screen I refer to this article, but it's still not working....

BTW we used the Object-c instead of Swift

Reference

    UIWindowScene  *windowScene  = ( UIWindowScene  *)[[[ UIApplication sharedApplication] connectedScenes]      allObjects].firstObject;
     UIWindowSceneGeometryPreferencesIOS  *perference  = [[ UIWindowSceneGeometryPreferencesIOS alloc]  init];
    perference.interfaceOrientations  =  1  < deviceOrientation;
    [windowScene requestGeometryUpdateWithPreferences:perference errorHandler: ^( NSError  * _Nonnull error) {
         NSLog(@ "error--%@", error);
    }];
Ymorp
  • 13
  • 2

1 Answers1

0

Calling

 self.setNeedsUpdateOfSupportedInterfaceOrientations()

before requesting the geometry update fixes it for me.

DenseCrab
  • 1,273
  • 11
  • 22
  • Could you please provide the obj-c implementation as i'm from RN background and new to obj-c/swift including the one you mentioned above. Kindly advise as i'm a need to fix this as the first this year as there is no one around at my end to help me out. – Brad Jan 11 '23 at 00:49