我有一个使用WkWebView从 Soundcloud 播放音频的应用程序,在 iOS 13 Beta 6 上,当应用程序不在前台时音频停止,即使Audio在Background Modes中打开也是如此。
开始播放时会抛出此断言:
Error acquiring assertion: <NSError: 0x282cf67c0; domain: RBSAssertionErrorDomain; code: 2; reason: "Required client entitlement is missing"> {
userInfo = {
RBSAssertionAttribute = <RBSLegacyAttribute: 0x1592432e0; requestedReason: MediaPlayback; reason: MediaPlayback; flags: PreventTaskSuspend | PreventTaskThrottleDown | WantsForegroundResourcePriority>;
}
进入后台状态后,抛出以下断言并暂停音频:
Can't end BackgroundTask: no background task exists with identifier 13 (0xd), or it may have already been ended. Break in UIApplicationEndBackgroundTaskError() to debug.
[ProcessSuspension] Background task expired while holding WebKit ProcessAssertion (isMainThread? 1).
这在 iOS 12 中不会发生,在该版本中,音频在后台正常播放。