Iphone 更改已设置的UILocalNotification的声音名称
对于尚未创建的通知(新通知),它会被更改,但是对于已经创建的通知,以前的声音会保持不变 我试过:Iphone 更改已设置的UILocalNotification的声音名称,iphone,ios,ipad,alert,uilocalnotification,Iphone,Ios,Ipad,Alert,Uilocalnotification,对于尚未创建的通知(新通知),它会被更改,但是对于已经创建的通知,以前的声音会保持不变 我试过: NSString *soundName = cell.titleLabel.text; NSArray *notifications = [[UIApplication sharedApplication] scheduledLocalNotifications]; for (UILocalNotification *notif in notifications) { notif.sou
NSString *soundName = cell.titleLabel.text;
NSArray *notifications = [[UIApplication sharedApplication] scheduledLocalNotifications];
for (UILocalNotification *notif in notifications) {
notif.soundName = [NSString stringWithFormat:@"%@.mp3", soundName];
}
但它不起作用…您必须重新安排已安排的通知。但是,请确保删除先前计划的项目
NSArray *notifications = [[UIApplication sharedApplication] scheduledLocalNotifications];
[[UIApplication sharedApplication] cancelAllLocalNotifications];
for (UILocalNotification *notif in notifications) {
notif.soundName = [NSString stringWithFormat:@"%@.mp3", soundName];
[[UIApplication sharedApplication] scheduleLocalNotification:notification];
}