【发布时间】:2019-12-22 21:36:13
【问题描述】:
我有一个应用程序使用 WkWebView 从 Soundcloud 播放音频,在 iOS 13 Beta 6 上,当应用程序不在前台时音频停止, 即使在背景模式中打开音频。
开始播放时抛出此断言:
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 中不会发生,音频在后台正常播放。
【问题讨论】:
-
这是iOS13 WebKit中的一个bug,在iOS14中修复bugs.webkit.org/show_bug.cgi?id=203293
标签: swift wkwebview avaudiosession ios13 ios-background-mode