Method [UIDevice setOrientation:] - is it still denied?

﹥>﹥吖頭↗ 提交于 2019-11-30 09:23:36

问题


I've heard that using of [UIDevice setOrientation:] can be the reason to app rejection in Appstore. Is there any proofed info about it?


回答1:


That is correct - your app will get rejected when using this private method. We have done it, we have gotten rejected (and we found workarounds).




回答2:


The method is there to give you information about the physical orientation of the device, no amount of coding will change that physical orientation. It is set depending on the gyros/accelerometers it would make no sense for you to tell the device what its orientation is.

If you want to change the interface orientation then you should look into the UIViewController callbacks which allow you to define that:

  interfaceOrientation  property
– shouldAutorotateToInterfaceOrientation:
+ attemptRotationToDeviceOrientation
– rotatingHeaderView
– rotatingFooterView
– willRotateToInterfaceOrientation:duration:
– willAnimateRotationToInterfaceOrientation:duration:
– didRotateFromInterfaceOrientation:



回答3:


The current (iOS 5) definition is:

@property (nonatomic, readonly) UIDeviceOrientation orientation

So even if there is a setter (setOrientation: or .orientation =) it would be private API as the official documentation says it doesn't exist. And using private API will get you rejected.




回答4:


If a method is not documented, don't use it. Using undocumented methods will result in rejection. It is just as simple as checking the Apple documentation.

In this case the documentation states:

@property (nonatomic, readonly) UIDeviceOrientation orientation



回答5:


Use this:

  • (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation{ return UIInterfaceOrientationPortrait; }


来源:https://stackoverflow.com/questions/8257464/method-uidevice-setorientation-is-it-still-denied

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!