3
    UNMutableNotificationContent *content = [[UNMutableNotificationContent alloc] init];
    content.sound = [UNNotificationSound defaultSound];
    NSDateComponents *components = [[NSDateComponents alloc] init];
    components.hour = 0;
    UNCalendarNotificationTrigger *trigger = [UNCalendarNotificationTrigger triggerWithDateMatchingComponents:components repeats:YES];
    UNNotificationRequest *notificationRequest = [UNNotificationRequest requestWithIdentifier:kUserNotificationTag content:content trigger:trigger];
    [[UNUserNotificationCenter currentNotificationCenter] addNotificationRequest:notificationRequest withCompletionHandler:nil];

This is my code to post local notification in iOS10.When I set the sound is

[UNNotificationSound defaultSound]

or

[UNNotificationSound soundNamed:@""]

the sound of the notification is both the default sound.

but if I don't set the sound,the local notification will not work.

Does anybody have any ideas?Thanks so much!

kb920
  • 3,039
  • 2
  • 33
  • 44
Sean Lee
  • 59
  • 6

0 Answers0