UiLocalNotifications Based on Id's

佐手、 提交于 2019-12-20 05:42:19

问题


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


回答1:


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

  • http://www.picksourcecode.com/ps/ct/161237.php
  • http://iphonesdkdev.blogspot.com/2010/04/local-push-notification-sample-code-os.html
  • http://useyourloaf.com/blog/2010/7/31/adding-local-notifications-with-ios-4.html

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


来源:https://stackoverflow.com/questions/7444487/uilocalnotifications-based-on-ids

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