gpt4 book ai didi

iphone - 为什么我的本地通知在 iOS 7 中默认没有声音?

转载 作者:可可西里 更新时间:2023-11-01 03:58:16 25 4
gpt4 key购买 nike

我的应用使用地理围栏并发送通知。

默认情况下,设置 - 应用通知中的声音是关闭的。

准确地说是 iOS 7。

有人知道如何解决这个问题吗?

这是负责此的代码:

UILocalNotification *localNotif = [[UILocalNotification alloc] init];
localNotif.fireDate = [NSDate dateWithTimeInterval:5 sinceDate:[NSDate date]];
localNotif.timeZone = [NSTimeZone defaultTimeZone];
localNotif.alertBody = [NSString stringWithFormat:@"You are near %@. Don't forget to check in!",place.name];
localNotif.soundName = UILocalNotificationDefaultSoundName;
localNotif.applicationIconBadgeNumber = 0;
[[UIApplication sharedApplication] scheduleLocalNotification:localNotif];

最佳答案

如果在“设置”应用中为您的应用关闭了声音,那么您的通知将不会播放任何声音。用户不允许你这样做。

如果“设置”应用中的声音没有关闭,您发布的代码应该可以工作。

此外,如果用户将铃声关闭,则不会播放声音。

关于iphone - 为什么我的本地通知在 iOS 7 中默认没有声音?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19303796/

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