gpt4 book ai didi

ios - UIBackgroundModes 不起作用的广告

转载 作者:可可西里 更新时间:2023-11-01 05:42:41 29 4
gpt4 key购买 nike

我修改了有关 UIBackgroundModes 的 Apple 文档,下面是它的内容:

When this key is present, the system’s audio frameworks automatically prevent your application from being suspended when it moves to the background. As long as it is playing audio, the application continues to run in the background to support that audio.

但是我有一个使用 AVPlayer 类播放音频流的应用程序,但它无法使用它。这个 key 应该在那里为我们省去显式实现 Audio Session 的工作。谁能告诉我为什么这不起作用?有没有人使用它并使它起作用?

最佳答案

在播放音频之前尝试执行以下操作:

NSError *sessionError = nil;
AVAudioSession *session = [AVAudioSession sharedInstance];
[session setCategory:AVAudioSessionCategoryPlayback error:&sessionError];

关于ios - UIBackgroundModes 不起作用的广告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5059787/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com