Warning : Unexpected version number in 'available' attribute for non-specific platform '*'
Asked Answered
C

1

8

I have this snippet code :

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

And since i've upgraded to swift5 and xcode 10.2 i get below warning :

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

And fixed with :

Replace ':3.0' with ''

What is this warning? what does it say?

Crinose answered 17/4, 2019 at 6:33 Comment(1)
I actually experienced the same thing when I was migrating to Swift 5. But such kind of warning went away after completely updating what needs to be updated, clean, and build.Austronesian
U
12

The documentation states that the asterisk cannot be used with Swift version numbers, but perhaps this wasn't enforced before Swift 5?

The equivalent attribute would be:

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

Even better would be:

@available(swift, deprecated:3.0, renamed:"activate()")
Ultraconservative answered 17/4, 2019 at 7:26 Comment(1)
In my case, this is inside a 3rd party library, and I cannot update the source code for this library as it is no longer maintained.. Is there a workaround where by such enforcement that * cannot be used, can be given an exception?Sension

© 2022 - 2024 — McMap. All rights reserved.