【发布时间】:2014-07-24 14:48:00
【问题描述】:
基于本教程Simple iOS Alarm Clock Tutorial 我已经实现了一个闹钟应用程序。 通知很好,但没有声音。
为了解决这个问题,我尝试过: Fix-1 并取消选中/选中我的 MacOS 声音设置。
我能做些什么来获得一个简单的闹钟声音? (信息:Youtube-Sound 作品@Simulator)
代码:
-(void)scheduleLocalNotificationWithDate:(NSDate *)fireDate
{
[[UIApplication sharedApplication] cancelAllLocalNotifications];
UILocalNotification *notification = [UILocalNotification new];
notification.fireDate = fireDate;
notification.soundName = UILocalNotificationDefaultSoundName;
notification.alertBody = @"Wake-up... !!!";
notification.alertAction = @"OK";
//[notification setApplicationIconBadgeNumber:-1];
notification.applicationIconBadgeNumber = 1; // increment
[[UIApplication sharedApplication] scheduleLocalNotification:notification];
}
【问题讨论】:
标签: ios objective-c xcode ios-simulator uilocalnotification