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

标签 iphone ios notifications ios7 geofencing

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

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

准确地说是 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/

相关文章:

ios - 如何在iOS中创建ByteBuffer?

iphone - iPhone开发有多难?

iphone - 如何在 iPhone sdk 中获取当前日期的下一个和更早的日期

wpf - 从模型更新 ViewModel 中的属性的正确方法

java - 将数据从通知发送到已关闭的 Activity

email - 以机器可读的格式从 Google 电子表格更改通知中获取更改的单元格的详细信息

iphone - 没有网页的 OAuth 2.0 到 Salesforce

ios - 调用父类(super class)指定的初始化程序调用子类

ios - 饼图文本显示不正确?

ios - 我的自定义字体未显示