Ram
Ram

Reputation: 406

UiLocalNotifications Based on Id's

Is there any tutorial on storing UIlocalNotifications based on there Id's and cancelling the notifications based on there Id's

Upvotes: 0

Views: 1493

Answers (1)

Rahul Juyal
Rahul Juyal

Reputation: 2144

in local notification u have userdictionary by this dictionary u cancele your notification.

use this code

in the time set local notification u set the id in user info.

NSMutableArray *SheduleArray=[[NSMutableArray alloc] initWithArray:[[UIApplication sharedApplication]scheduledLocalNotifications]];
for(int s=0;s<[SheduleArray count];s++){
    UILocalNotification *Not=[SheduleArray objectAtIndex:s];
    int getId=[[Not.userInfo valueForKey:@"Id"] intValue];
    if(getId==yourId)
        {
            [[UIApplication sharedApplication] cancelLocalNotification:Not];
        }
}

Upvotes: 3

Related Questions