我是 iphone 的初学者,任何人都可以帮助我。
我添加了每日通知功能,我想在特定日期取消此通知。
这是删除本地通知的方法:
UIApplication *app = [UIApplication sharedApplication];
NSArray *eventArray = [app scheduledLocalNotifications];
for (int i=0; i<[eventArray count]; i++)
{
UILocalNotification* oneEvent = [eventArray objectAtIndex:i];
NSDictionary *userInfoCurrent = oneEvent.userInfo;
NSString *uid=[NSString stringWithFormat:@"%@",[userInfoCurrent valueForKey:@"someKey"]];
NSLog (@"deleteAllReminder: %@",uid);
if (yourcondition) [app cancelLocalNotification:oneEvent];
}
你只需要定义yourCondition