-(void)notifyMe
{
UILocalNotification *localNotification = [[UILocalNotification alloc] init];
localNotification.fireDate = [NSDate dateWithTimeIntervalSinceNow:0.1];
localNotification.timeZone = [NSTimeZone defaultTimeZone];
localNotification.alertBody = @"Alert";
localNotification.alertAction = @"Local notification";
localNotification.soundName = UILocalNotificationDefaultSoundName;
localNotification.alertLaunchImage = nil;
localNotification.userInfo = nil;
[[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
}
这是我调用本地通知的方法。这与其他应用程序运行良好。但在我的工作中,通知即将到来,但没有声音。
我猜应用程序设置有问题,但我无法找到它。
最佳答案
我发现你的问题,因为我遇到了同样的问题。事实证明,这对我来说是一个简单的修复,我的代码很好,我所要做的就是为我的应用程序启用推送通知(我已经完成了,但没有收到声音或角标(Badge)),然后切换 Badge App Icon
和Sound
至ON
.
我很惊讶这个问题在 6 个月内没有得到其他答案。
关于ios - iOS 中的本地通知没有任何声音,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19219140/