我有一个使用WkWebView从Soundcloud播放音频的应用程序,在iOS 13 Beta 6中,当应用程序不在前台时,音频会停止播放,即使在后台模式中打开了Audio。开始播放时,会引发以下断言:
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中不会出现这种情况,即使应用在后台运行时音频也会正常播放。