Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6353597
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:26:22+00:00 2026-05-24T22:26:22+00:00

I have this code for local notification, and I have a scheduleNotification and clearNotification

  • 0

I have this code for local notification, and I have a scheduleNotification and clearNotification using my own method. These are the codes:

- (void)clearNotification {
   [[UIApplication sharedApplication] cancelAllLocalNotifications];
}

- (void)scheduleNotification {
   [reminderText resignFirstResponder];
   [[UIApplication sharedApplication] cancelAllLocalNotifications];

   Class cls = NSClassFromString(@"UILocalNotification");
   if (cls != nil) {
      UILocalNotification *notif = [[cls alloc] init];
      notif.fireDate = [[datePicker date] dateByAddingTimeInterval:-30];
      notif.timeZone = [NSTimeZone defaultTimeZone];

      notif.alertBody = @"Evaluation Planner";
      notif.alertAction = @"Details";
      notif.soundName = UILocalNotificationDefaultSoundName;
      notif.applicationIconBadgeNumber = 1;

     NSDictionary *userDict = [NSDictionary dictionaryWithObject:reminderText.text forKey:kRemindMeNotificationDataKey];
     notif.userInfo = userDict;
     [[UIApplication sharedApplication] scheduleLocalNotification:notif];
     [notif release];
    }
}

These codes works well, but now I want to know how do I know which notification object will it delete. I would like to create an ID for a notification, meaning, one ID is equivalent to one notification. But I don’t know at which part I should do that. Plus I need to find a way to include all this to be in a plist.

Hope somebody can help me. Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T22:26:23+00:00Added an answer on May 24, 2026 at 10:26 pm
    NSArray *notifications = [[UIApplication sharedApplication] scheduledLocalNotifications];
    for (UILocalNotification *not in notifications) {
        NSString *dateString=[not.userInfo valueForKey:@"EndDate"];
        if([dateString isEqualToString:@"CompareString"])
        { 
            [[UIApplication sharedApplication] cancelLocalNotification:not];
        }
    }
    
    1. Give user info whenever you create local notification (this is a key-value pair).
    2. Iterate through notifications (it contains All Local Notifications) and compare value for the known key. In the above example I am using EndDate as the key and CompareString as the value.

    Its Working Fine With Me.

    Cheers..

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code: if (include_once(dirname(__FILE__).'/file.php') || include_once(dirname(__FILE__).'/local/file.php') ) { This causes an
I have this code #include <iostream> using namespace std; int main(int argc,char **argv) {
If I have this code local f = io.open(../web/, r) print(io.type(f)) -- output: file
I have this line of code: double seconds = new DateTime(2006,7,6,12,1,0,DateTimeKind.Local).Subtract(new DateTime(1970,1,1,0,0,0,DateTimeKind.Local).TotalSeconds; This was
I have successfully scheduled local notifications in my app using the code below: Class
I have this code: #!/usr/local/bin/python """ USAGE: apache_logs.py """ import sys import os if
I have this code: public byte[] SerializeToBlob() { using (var buffer = new MemoryStream())
I have this code, and all works well in my local server. The email
hello everyone I have this snippet of the code: local helper(f, i, j) =
hello everyone I have this snippet of the code: local fun NTimesF(f, n:int) =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.