gpt4 book ai didi

ios - UILocalNotification - 打开应用程序后继续播放提示音

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:40:50 26 4
gpt4 key购买 nike

一旦用户从锁定屏幕打开应用程序(滑动推送警报 - 应用程序处于后台模式),通知声音就会继续播放。

如果用户从主屏幕打开应用程序(点击推送警报 - 应用程序处于后台模式),通知声音会按预期停止。

请告知,如何在第一个描述的场景中停止推送警报声音。

谢谢。

时间表

UILocalNotification *localNotif = [[UILocalNotification alloc] init];
localNotif.fireDate = [calendar dateFromComponents:components];
localNotif.timeZone = [NSTimeZone defaultTimeZone];
localNotif.alertBody = @"GET THE FLOCK UP!";
localNotif.repeatInterval = 0;
localNotif.hasAction = YES;
localNotif.alertAction = @"GET UP";
localNotif.soundName = @"snooze_wake_push.aif";
localNotif.applicationIconBadgeNumber = 1;
[app scheduleLocalNotification:localNotif];

在应用委托(delegate)中处理

- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {

[[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];
[[UIApplication sharedApplication] cancelAllLocalNotifications];

}

最佳答案

不确定,但 99% 这是不可能的,因为它是 Apple 的内置功能,所以最好的方法就是停止与它抗争。并且可能这个问题只发生在模拟器中而不是在真实设备中首先在真实设备上检查。

关于ios - UILocalNotification - 打开应用程序后继续播放提示音,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20283782/

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