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

  • Home
  • SEARCH
  • 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 6021463
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:42:58+00:00 2026-05-23T03:42:58+00:00

I am developing an iPhone alarm app based on local notifications. On deleting an

  • 0

I am developing an iPhone alarm app based on local notifications.

On deleting an alarm, the related local notification should get cancelled. But how can I determine exactly which object from the array of local notifications is to be cancelled?

I am aware of [[UIApplication sharedApplication] cancelLocalNotification:notification] method but how can I get this ‘notification’ to cancel it?

  • 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-23T03:42:59+00:00Added an answer on May 23, 2026 at 3:42 am

    You can save a unique value for key in your local notification’s userinfo.
    Get all local notification, loop through the array and delete the particular notification.

    Code as follows,

    OBJ-C:

    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:@"uid"]];
        if ([uid isEqualToString:uidtodelete])
        {
            //Cancelling local notification
            [app cancelLocalNotification:oneEvent];
            break;
        }
    }
    

    SWIFT:

    var app:UIApplication = UIApplication.sharedApplication()
    for oneEvent in app.scheduledLocalNotifications {
        var notification = oneEvent as UILocalNotification
        let userInfoCurrent = notification.userInfo! as [String:AnyObject]
        let uid = userInfoCurrent["uid"]! as String
        if uid == uidtodelete {
            //Cancelling local notification
            app.cancelLocalNotification(notification)
            break;
        }
    }
    

    UserNotification:

    If you use UserNotification (iOS 10+), just follow this steps:

    1. When creating the UserNotification content, add an unique identifier

    2. Remove specific pending notification using removePendingNotificationRequests(withIdentifiers:)

    3. Remove specific delivered notification using removeDeliveredNotifications(withIdentifiers:)

    For more info, UNUserNotificationCenter

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

Sidebar

Related Questions

I am developing an alarm app in iphone. To set alarm I have to
I'm developing an iPhone app that uses the built-in SQLite database. I'm trying to
i am developing a iphone application in a view-based project,(not navigation) however i would
I've been developing an iPhone app that uses a UIToolbar (in the context of
Am looking into developing an iPhone native app using Titanium Developer Since this is
developing iphone app, I have used a UIImageview and i have set an image
guys. I'm developing iphone app. so, I want to read database of iphone calendar.
im new with objective-c. I have problem with memory leaking when developing iphone app.
I am developing an alarm clock application in iphone. I am not able to
I am developing iphone app which shares photos on social networks.For photo sharing I

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.