ios14.6 The code for rotating the screen does not take effect

[UIDevice.currentDevice setValue:@(UIInterfaceOrientationPortrait) forKey:@"orientation"];

Setting the orientation property of UIDevice is not supported. Consider using the supportedInterfaceOrientations property of UIViewController to control orientations instead.

ios14.6 The code for rotating the screen does not take effect
 
 
Q