1

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

Neelesh
  • 3,673
  • 8
  • 47
  • 78
  • possible duplicate of [Play local notification default sound when displaying UIAlertView?](http://stackoverflow.com/questions/3277811/play-local-notification-default-sound-when-displaying-uialertview) – Brad Larson Aug 20 '11 at 15:29
  • and you may want to see this:http://stackoverflow.com/questions/23532706/why-doesnt-my-uilocalnotification-play-any-sound – frank Feb 27 '15 at 06:15

1 Answers1

0

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.

JanB
  • 904
  • 9
  • 14