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!