无声音频 空白音频 ios后台运行保活

1为了实现后台定时器继续循环  用到了 https://blog.csdn.net/qq_38520096/article/details/102626210 用播放音频的方法 播放无声音频实现

2功能实现了但是没找到无声音频 在这里直接提供无声音频链接

https://pan.baidu.com/s/1C4ug1IHdlsStIb6MGMicSg   提取码full

3 第一个实现了后台运行保活 但是会出现一些问题   蓝牙连接的时候 会停止播放正在播放的音乐

4找到新的代替方法  还是用的无声播放

5使用方法 导入网盘文件   

-(void)viewDidLoad{

    [super viewDidLoad];

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appWillEnterForeground) name:UIApplicationWillEnterForegroundNotification object:nil];

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appDidEnterBackground) name:UIApplicationDidEnterBackgroundNotification object:nil];

}

 

- (void)appWillEnterForeground {

 

    [[BackgroundTaskTool shareTool] stopBackgroundTask];

}

 

- (void)appDidEnterBackground {

 

    [[BackgroundTaskTool shareTool] startBackgroundTask];

    

}

 

 

posted @ 2023-01-30 15:34  代佳宏  阅读(473)  评论(0编辑  收藏  举报