Ios 目标C-背景中带有红色指示器的音频

Ios 目标C-背景中带有红色指示器的音频,ios,objective-c,avaudioplayer,Ios,Objective C,Avaudioplayer,当用户在应用程序上搜索其他活动用户时,“我的应用程序”当前播放mp3音频文件 在我的应用程序代理中,我要求有更多的后台时间继续执行搜索: - (void)applicationDidEnterBackground:(UIApplication *)application { self.backgroundTask = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^{

当用户在应用程序上搜索其他活动用户时,“我的应用程序”当前播放mp3音频文件

在我的应用程序代理中,我要求有更多的后台时间继续执行搜索:

- (void)applicationDidEnterBackground:(UIApplication *)application {

    self.backgroundTask = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^{
        NSLog(@"Background handler called. Not running background tasks anymore.");
        [[UIApplication sharedApplication] endBackgroundTask:self.backgroundTask];
        self.backgroundTask = UIBackgroundTaskInvalid;
    }];

}
当用户将应用程序发送到后台时,随着搜索算法继续工作,音频将继续播放

但是,我希望屏幕顶部有一个红色指示条,类似于在后台应用程序上执行VOIP呼叫时所看到的情况

这可能吗

这是我在SearchView.m中的音频播放器代码

NSString *path = [NSString stringWithFormat:@"%@/searchTune.mp3", [[NSBundle mainBundle] resourcePath]];

NSURL *soundUrl = [NSURL fileURLWithPath:path];

_audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:soundUrl error:nil];

[_audioPlayer play];

不,不可能。没有公共API,iOS内部使用私有API。它被称为脉动状态栏。

这是不可能的,因为这些都是系统警报,不会暴露给第三方应用程序,也会给通知增加太多复杂的含义。坦率地说,我不理解这里的用例。在搜索为什么需要播放歌曲时。您的web服务返回搜索结果需要多长时间?如果网络状况良好超过2到3秒,则在应用所有优化技术后尝试添加分页。