UILocalNotification 声音未播放
我试图在应用程序启动后一分钟安排 UILocalNotification
。这是我使用的代码,
-(void)scheduleNotification{
UILocalNotification *localNotif = [[UILocalNotification alloc] init];
localNotif.timeZone = [NSTimeZone defaultTimeZone];
localNotif.fireDate = [NSDate dateWithTimeIntervalSinceNow:60];
localNotif.alertBody = @"Test";
localNotif.alertAction = @"View";
localNotif.soundName=UILocalNotificationDefaultSoundName;
[[UIApplication sharedApplication] scheduleLocalNotification:localNotif];
[localNotif release];
}
alertView 在适当的时间后显示,但没有播放声音。 我错过了什么吗?
提前致谢
编辑 我现在正在模拟器上测试
I am trying to schedule a UILocalNotification
one minute after the application is launched. This is the code i use,
-(void)scheduleNotification{
UILocalNotification *localNotif = [[UILocalNotification alloc] init];
localNotif.timeZone = [NSTimeZone defaultTimeZone];
localNotif.fireDate = [NSDate dateWithTimeIntervalSinceNow:60];
localNotif.alertBody = @"Test";
localNotif.alertAction = @"View";
localNotif.soundName=UILocalNotificationDefaultSoundName;
[[UIApplication sharedApplication] scheduleLocalNotification:localNotif];
[localNotif release];
}
The alertView is showed after the appropriate time, but sound is not being played.
Am i missing something ?
Thanks in advance
Edit
I am testing it on the simulator now
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试重新设置 Mac 声音 - 打开“系统偏好设置”并选择“声音”。在那里取消选中然后重新选中“播放用户界面声音效果”-这可以解决我的类似问题。
Try re-setting your Mac sound - open the System Preferences and choose Sounds. In there uncheck and then re-check the 'Play user interface sound effects' - this worked to solve my similar problem.