简体   繁体   English

为什么我不赞成使用“ shouldAutorotateToInterfaceOrientation:”警告

[英]Why don't i get a deprecated warning for “shouldAutorotateToInterfaceOrientation:”

i'm trying to update an application for iOS 6. So i run it with the 6.0 Simulator to see if i get any errors or warnings, but there aren't any. 我正在尝试为iOS 6更新应用程序。因此,我使用6.0模拟器运行它,以查看是否收到任何错误或警告,但是没有任何错误或警告。 But in fact i was expecting to get a warning for shouldAutorotateToInterfaceOrientation: because it's deprecated in iOS 6. Why don't i get a warning? 但是实际上,我原本希望收到对shouldAutorotateToInterfaceOrientation:的警告shouldAutorotateToInterfaceOrientation:因为它在iOS 6中已弃用。为什么我没有收到警告? Do i need to do something else than running it with a 6.0 simulator? 除了使用6.0模拟器运行之外,我还需要做其他事情吗?

Thanks guys! 多谢你们!

deprecated warning comes when you call deprecated function byself. 当您自己调用不推荐使用的函数时,就会出现不推荐使用的警告。 as shouldAutorotateToInterfaceOrientation: is in view hierarchy in iOS5 but not in iOS6 so when you build app for iOS6 this function behave like normal view controller function and not consider in view life cycle. 就像应该shouldAutorotateToInterfaceOrientation:在iOS5中处于视图层次结构中,但在iOS6中不处于视图层次结构中一样,因此当您为iOS6构建应用程序时,此函数的行为类似于常规视图控制器函数,而不考虑视图生命周期。 That's why warning not shown by xCode. 因此,xCode不会显示警告。

The warning won't come in the Simulator, it will come in Xcode. 该警告不会出现在模拟器中,而是会出现在Xcode中。 Try setting your "Deployment Target" to 6.0 in Xcode and the warning should appear. 尝试在Xcode中将“部署目标”设置为6.0,然后会出现警告。

如果您的应用仅适用于iOS6的部署,您将看到警告,否则,你应该实现这两种方法( shouldAutorotateToInterfaceOrientation预iOS6的& shouldAutorotate为iOS6的)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM