在UIDevice currentDevice上引导我

use*_*878 1 iphone iphone-sdk-3.0

我使用以下代码来设置设备方向

[[UIDevice currentDevice] setOrientation:UIInterfaceOrientationLandscapeRight];
Run Code Online (Sandbox Code Playgroud)

当我使用我得到警告,我发现以下代码来解决该警告.

@interface UIDevice (MyPrivateNameThatAppleWouldNeverUseGoesHere)
- (void) setOrientation:(UIInterfaceOrientation)orientation;
@end
Run Code Online (Sandbox Code Playgroud)

现在我想知道的是......

应用程序商店是否可以接受此代码在应用程序中?

谢谢你的帮助!.

Ben*_*ieb 6

天啊,不.你得到的警告是因为这不是一个readwrite属性; 仅添加声明方法的类别将不允许您设置方向.AppStore不仅不会接受它,它会在第一次调用时崩溃,因为没有访问器.(好吧,它可能会崩溃.这里可能有一个未记录的API,在这种情况下你只能被拒绝).