如何处理协议函数覆盖的@available()? [英] How do I handle @available() for protocol function-overrides?

查看:24
本文介绍了如何处理协议函数覆盖的@available()?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

场景:
我正在尝试通过
过滤掉 iOS 10 代码@available() &
if #available().

我将 @available() 用于更高范围的: &扩展.
但是我遇到了覆盖函数的编译器错误:

Scenario:
I'm trying to filter out iOS 10 code via
@available() &
if #available().

I using @available() for the higher-scope: classes & extensions.
But I'm getting compiler errors for the override functions:

有什么解决办法吗?

Any solution?

推荐答案

查看 UIPresentationController 标头,presentationTransitionWillBegin 从 iOS 8 开始可用,因此编译器是被您声明您的覆盖从 10 开始可用,而它覆盖的方法从 8.0 开始感到困惑.

Looking at the UIPresentationController headers, the presentationTransitionWillBegin is available as of iOS 8, so the compiler is confused by your declaration that your override is available as of 10, whereas the method it's overriding is as of 8.0.

这篇关于如何处理协议函数覆盖的@available()?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆