ios - 警告 : Unexpected version number in 'available' attribute for non-specific platform '*'

标签 ios swift snapkit swift5 xcode10.2

我有这段代码:

@available(*, deprecated:3.0, message:"Use activate().")
public func install() {
    self.activate()
}

自从我升级到 swift5xcode 10.2 之后,我收到以下警告:

Unexpected version number in 'available' attribute for non-specific platform '*'

并修复:

Replace ':3.0' with ''

这个警告是什么?它说什么?

最佳答案

documentation指出星号不能与 Swift 版本号一起使用,但也许这在 Swift 5 之前没有强制执行?

等效属性为:

@available(swift, deprecated:3.0, message:"Use activate().")

更好的是:

@available(swift, deprecated:3.0, renamed:"activate()")

关于ios - 警告 : Unexpected version number in 'available' attribute for non-specific platform '*' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55721287/

相关文章:

ios - 将照片应用程序添加到 "Open in"菜单 - IOS?

ios - 在 Objective-c 中更新和动画渐变

ios - 默认情况下 Alamofire 是否请求压缩响应?

ios - Swift - 在 TableViewCell 中使用不同大小的图像有困难

ios - 无法将模块 'Snapkit' 加载为 'Snapkit'

swift - 动画约束,如何在所需方向上增加高度

ios - 解析错误 : invalid login parameters (Code: 101, 版本 : 1. 10.0)

ios - MFMailComposeViewController 需要很长时间才能发送电子邮件

ios - 同一 View Controller 的 UI 的多种变体

ios - 插入后更改 CAGradientLayer 中的颜色