[英]How to avoid that a deprecated method is called in Xamarin iOS?
willRotateToInterfaceOrientation:duration
is deprecated since iOS 8. So the WillRotate
is also deprecated in Xamarin iOS. 从iOS 8开始,将不再使用
willRotateToInterfaceOrientation:duration
。因此,在Xamarin iOS中也将不再使用WillRotate
。 But WillRotate
will still be called on iOS 8. 但是
WillRotate
仍将在iOS 8上被调用。
How can I assure that this method is not called by an iOS 8 device? 如何确保iOS 8设备不会调用此方法? Do I need something like a compiler directive?
是否需要类似编译器指令的内容?
RespondsToSelector
will not work here. RespondsToSelector
在这里不起作用。
由于不建议使用,并且您使用最新的SDK目标编译了应用,因此不会调用它。
This functionality depends on the method being implemented or not. 此功能取决于是否实施方法。 While many APIs were deprecated, the functionality is still present for backwards compatibility.
尽管不推荐使用许多API,但该功能仍然存在以实现向后兼容。
What this means in this particular case is that if you implement the method (or any of the other supporting methods in the family), the method will be invoked. 在这种特殊情况下,这意味着如果实现该方法(或该系列中的任何其他支持方法),则将调用该方法。 If you do not implement it, the new methods will be called.
如果不实现,则将调用新方法。
Which ones depend on what exactly the underlying framework is using to probe for. 哪些取决于底层框架到底要使用什么来进行探测。 They are likely using RespondsToSelector() and based on presence/absence of a method execute one code path or another.
他们可能使用RespondsToSelector()并根据一种方法的存在/不存在执行一个代码路径或另一个代码路径。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.