Post

Replies

Boosts

Views

Activity

Reply to [Orientation] BUG IN CLIENT OF UIKIT: Setting UIDevice.orientation is not supported. Please use UIWindowScene.requestGeometryUpdate(_:)
**Use below code on rotation and after that do write code of UI update with delay of 0.5 or 1.0 **  @try { #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 160000 // Xcode 14 and iOS 16, or greater             [vc setNeedsUpdateOfSupportedInterfaceOrientations];             [vc.navigationController setNeedsUpdateOfSupportedInterfaceOrientations]; #endif     } @catch (NSException *exception) {         NSLog(@"UpdateOrientationForiOS16 catch error: %@", [exception description]);     } **Force attempt Orientation - attemptRotationToDeviceOrientation ** // requiredMask = UIInterfaceOrientationMaskPortrait @try { #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 160000 // Xcode 14 and iOS 16, or greater             NSArray *array = [[[UIApplication sharedApplication] connectedScenes] allObjects];             UIWindowScene *scene = (UIWindowScene *)array[0];             [vc setNeedsUpdateOfSupportedInterfaceOrientations];             [vc.navigationController setNeedsUpdateOfSupportedInterfaceOrientations];             UIWindowSceneGeometryPreferencesIOS *geometryPreferences = [[UIWindowSceneGeometryPreferencesIOS alloc] initWithInterfaceOrientations:requiredMask];             [scene requestGeometryUpdateWithPreferences:geometryPreferences errorHandler:^(NSError * _Nonnull error) {                 //draw design again after orinetation changed                 errorCompletion([error description]);                 //NSLog(@"requestGeometryUpdateWithPreferences error: %@", [error description]);             }]; #endif     } @catch (NSException *exception) {         NSLog(@"UpdateForceAttemptOrientationForiOS16 catch error: %@", [exception description]);     }
Nov ’22