简体   繁体   English

如何避免在Xamarin iOS中调用不赞成使用的方法?

[英]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.

相关问题 如何避免Xamarin Forms iOS中显示和隐藏UI控件的波动? - How to avoid Fluctuation in show and hide UI controls in Xamarin forms iOS? 未调用Xamarin.iOS RegisteredForRemoteNotifications - Xamarin.iOS RegisteredForRemoteNotifications not called 在iOS 12.0中不推荐使用Delegate。 请采用WKWebView。 如何在Xamarin中解决此问题? - Delegate was deprecated in iOS 12.0. Please adopt WKWebView. How do I fix this in Xamarin? 借助 Mock,如何避免 xunit.net 中的基调用方法 - How to avoid base called method in xunit.net thanks to Mock 如何在iOS上使用Xamarin未公开的方法? - How can I use a method that is not exposed by Xamarin on iOS? 如何检查Xamarin iOS中是否存在某种方法/类/ API? - How to check if a certain method/class/API exists in Xamarin iOS? 如何使用从绑定库到Xamarin iOS项目的方法 - how to use a method from binding library into Xamarin iOS project Xamarin iOS中没有参数的绑定方法 - Binding method with no parameters in Xamarin iOS Xamarin.Forms - iOS RegisteredForRemoteNotifications 没有被调用 - Xamarin.Forms - iOS RegisteredForRemoteNotifications not getting called DidReceiveRemoteNotification 不在后台调用 - Xamarin iOS - 推送通知 - DidReceiveRemoteNotification is not called in background - Xamarin iOS - Push Notifications
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM