Enum cases with associated values cannot be marked potentially unavailable

Dear,

In iOS 15, with Xcode 13, @available seems broken or changed. I get an error called: 'Enum cases with associated values cannot be marked potentially unavailable'

The problem is with this code:


     The service provider associated with the now-playing item.

     Value is a unique NSString that identifies the service provider for the now-playing item. If the now-playing item belongs to a channel or subscription service, this key can be used to coordinate various types of now-playing content from the service provider.

     */

    @available(iOS 11.0, *)

    case serviceIdentifier(String?)

    

How can I fix this?

Could you show the complete code of enum declaration ?

And test this:

     enum SomeContent {
          case cas1(val : Int)
          @available(iOS 11.0, *)
         case cas2(val : Int)
     }

Here's from a framework we are using. It barfs at the @available on the enum.

@available(macOS 11.0, iOS 14.0, tvOS 14.0, watchOS 7.0, *)

extension BNNS {

  public enum ActivationFunction {

    case identity

    case rectifiedLinear

    case leakyRectifiedLinear(alpha: Swift.Float)

    case sigmoid

    case logSigmoid

    case tanh

    case scaledTanh(alpha: Swift.Float, beta: Swift.Float)

    case abs

    case linear(alpha: Swift.Float)

    case clamp(bounds: Swift.ClosedRange<Swift.Float>)

    case softmax

    case geluApproximation(alpha: Swift.Float, beta: Swift.Float)

    case geluApproximation2(alpha: Swift.Float, beta: Swift.Float)

    case gumbel(alpha: Swift.Float, beta: Swift.Float)

    case gumbelMax(alpha: Swift.Float, beta: Swift.Float)

    case hardSigmoid(alpha: Swift.Float, beta: Swift.Float)

    case softplus(alpha: Swift.Float, beta: Swift.Float)

    case softsign

    case elu(alpha: Swift.Float)

    case selu

    case celu(alpha: Swift.Float)

    case clampedLeakyRectifiedLinear(alpha: Swift.Float, beta: Swift.Float)

    case linearWithBias(alpha: Swift.Float, beta: Swift.Float)

    case logSoftmax

    case hardShrink(alpha: Swift.Float)

    case softShrink(alpha: Swift.Float)

    case tanhShrink

    case threshold(alpha: Swift.Float, beta: Swift.Float)

    @available(macOS 12.0, iOS 15.0, tvOS 15.0, watchOS 8.0, *)

    case hardSwish(alpha: Swift.Float, beta: Swift.Float)

    @available(macOS 12.0, iOS 15.0, tvOS 15.0, watchOS 8.0, *)

    case silu

    public var bnnsActivation: Accelerate.BNNSActivation {

      get

    }

  }

I am having same problem, in my case with some code generated using sourcery that compiles in Xcode 12.5

Also running into this problem, with a React Native project that compiles fine in Xcode 12. Is this a Swift 5.5 change? An Xcode 13 issue?

Having the same problem here too. Even with Xcode 13 beta 2

Have same issue. Tested on Xcode 13 beta 2. I think we need to file an issue.

I too have this issue using xcode Beta 2 with a iOS15 device. Any solutions available?

Having the same issue with CocoaMQTT.

https://github.com/emqx/CocoaMQTT/blob/8be5c863b1f6adca4ce2212085d7473aa9e599f9/Source/CocoaMQTTTypes.swift#L66

Any update on this issue?

beta3 still has this issue.

Still same issue in Xcode 13 Beta Version.

So what do I do now? I am completely new to mac and xcode... (and I think am on the verge of a breakdown) for the past week trying to test a flutter app on simulator... ran into this issue. btw, can i assume that the app will run fine, if it runs fine on the simulator? I am sooo late with this project...

Also had the same problem (xCode 13.0 beta 5 (13A5212g) ) only with types that are available from iOS13. Managed to workaround it by increasing the iOS deployment target to 13 of submodule, which in turn asked to increase the project iOS version, which gave a lot of warnings but no errors, so I was able to build my App and test it.

This works for me now, but definitely not a right solution, just a temporary. Lets hope for the fix in the next release.

Why should we really use this forum if we'll get nothing from apple developers

I solved my issues in imported pods to raise iOS version for each target and pod to min 13.0 and also removed arm64 from excluded architecture. This is important on new M1 macs as you cannot run on simulator if you do not have arm64 architecture in build.

I hate threads like these where 20+ people repeat the same comment.

"Have same issue." & "Having the same problem here too"

If you have the same issue, why comment about it? This is what makes forums trashy stop spamming the threads.

Enum cases with associated values cannot be marked potentially unavailable
 
 
Q