Ankit jain
Ankit jain

Reputation: 13

How to cancel daily localnotification

i'm beginner in iphone can anybody help me.

I have add the daily notification functionality I want to cancel this notification on a specific date .

Upvotes: 1

Views: 89

Answers (1)

user387184
user387184

Reputation: 11053

this is how to remove a local notification:

    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];

    }

You just need to define yourCondition

Upvotes: 2

Related Questions