UILocalNotification *soundNotification = [[UILocalNotification alloc] init];
soundNotification.repeatInterval = NSCalendarUnitMinute;
soundNotification.soundName = @"alarm.mp3";
soundNotification.fireDate = [NSDate date];
soundNotification.timeZone = [NSTimeZone defaultTimeZone];
soundNotification.alertBody = @"alarm is ringing"; //commenting out this line stop callback.
[[UIApplication sharedApplication] scheduleLocalNotification:soundNotification];
问题是我不想为通知定义alertBody。但仍然打了回调
- (void)application:(UIApplication*)application didReceiveLocalNotification:(nonnull UILocalNotification *)notification
因为如果我没有点击回叫,即使你打电话也无法停止通知的声音
- (void)cancelLocalNotification:(UILocalNotification *)notification;
有没有办法在没有为通知定义alertBody的情况下停止UILocalNotification声音?