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
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);
}];
Calling
self.setNeedsUpdateOfSupportedInterfaceOrientations()
before requesting the geometry update fixes it for me.