Delete a UILocalnotification at a certain indexpath

半腔热情 提交于 2019-12-11 06:17:57

问题


I have a bunch of UILocalNotifications but I only want to delete a certain one at a given indexpath, therefor

[[UIApplication sharedApplication] cancelAllLocalNotifications];

wont work out for me. I know I can use

[[UIApplication sharedApplication] cancelLocalNotification:UILocalNotification];

but how do I get the UILocalNotification from the given NSIndexPath?

Thanks.


回答1:


You can get an array of scheduled notification from: @property(nonatomic,copy) NSArray *scheduledLocalNotifications

Get the one you want by the index number of your choosing and then pass the UILocalNotification* to - (void)cancelLocalNotification:(UILocalNotification *)notification.



来源:https://stackoverflow.com/questions/5545292/delete-a-uilocalnotification-at-a-certain-indexpath

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!