【问题标题】:Xcode 11 beta - playbackState is only available in iOS 13.0 or newerXcode 11 beta -playbackState 仅在 iOS 13.0 或更新版本中可用
【发布时间】:2019-07-15 10:09:54
【问题描述】:

我收到错误:'playbackState' 仅适用于 iOS 13.0 或更高版本

MPNowPlayingInfoCenter.playbackState 在我的 iOS 11 应用中使用。

这是 iOS 13 的问题?我现在可以处理吗?

在 iOS11 中:

@available(iOS 5.0, *)
open class MPNowPlayingInfoCenter : NSObject {

    open class func `default`() -> MPNowPlayingInfoCenter

    open var nowPlayingInfo: [String : Any]?

    open var playbackState: MPNowPlayingPlaybackState
}

现在在 iOS 13 中:

@available(iOS 5.0, *)
open class MPNowPlayingInfoCenter : NSObject {

    open class func `default`() -> MPNowPlayingInfoCenter

    open var nowPlayingInfo: [String : Any]?

    @available(iOS 13.0, *)
    open var playbackState: MPNowPlayingPlaybackState
}

【问题讨论】:

  • 刚刚安装了 Xcode 11 beta 3 并在我的代码库中得到了完全相同的错误。你解决了吗?
  • 有人有这方面的更新吗?
  • 黄金大师套件仍然存在。此外,在文档 cmets 中,他们评论“此属性仅适用于 macOS”。这怎么可能。

标签: ios swift xcode11


【解决方案1】:

我向 Apple 提交了错误报告,以下是 Apple Engineering 的回复:

此 API 仅在 macOS 和 Catalyst 上受支持。它在以前的版本中被错误地标记为可用,但已更正。我们被要求不要将此 API 标记为专为 Catalyst 提供,但 macOS 平台是此 API 唯一可用的地方。

【讨论】:

  • 不管响应如何,似乎需要设置 playbackState 才能让 CarPlay 在 iOS 13 之前的 iOS 版本上按预期工作,正如当时所记录的那样。 docs 也表示 iOS 11+
猜你喜欢
  • 2020-03-07
  • 1970-01-01
  • 2020-01-25
  • 1970-01-01
  • 2021-11-26
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多