2012-08-16 59 views

回答

2

這是如何刪除本地通知:

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

相關問題