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 8383275
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:07:30+00:00 2026-06-09T17:07:30+00:00

I am trying to implement an alarm type app that sets a UILocalNotification from

  • 0

I am trying to implement an alarm type app that sets a UILocalNotification from a UIDatePicker (only time, no date). I kind of have it working except for the fact that lets assume it is 5:00 PM when the user tries to set the alarm. If they try to set the alarm for 4:45 PM
(let us assume they are doing this for the following day) it wont set the UILocalNotification. I am sure that it is because of my code and specifically the “setHour” or “setMinute” or the way I have the my nsdates with the calendar. If anyone can tell me what I need to do to get it work, it would be appreciated.

the name of the UIDatePicker is

   datePick

Thanks!

UILocalNotification *futureAlert;
futureAlert = [[UILocalNotification alloc] init];
NSCalendar *calendar = [NSCalendar autoupdatingCurrentCalendar];
NSDateComponents *dateComps = [[NSDateComponents alloc] init];
//[dateComps setDay:item.day];
//[dateComps setMonth:item.month];
//[dateComps setYear:item.year];
[dateComps setHour:11];
[dateComps setMinute:46];
NSDate *itemDate = [calendar dateFromComponents:dateComps];
futureAlert.fireDate = [datePick date];    
futureAlert.timeZone = [NSTimeZone defaultTimeZone];
futureAlert.alertBody= @"time to wake up";
[[UIApplication sharedApplication] scheduleLocalNotification:futureAlert];
[futureAlert release];
  • 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-06-09T17:07:32+00:00Added an answer on June 9, 2026 at 5:07 pm

    Try use this code lines:

    double interval = [datePick.date timeIntervalSinceNow]; // time interval
    if (interval < 0) // if time is earling at this time
      interval += 86400; // for set this time at next day
    futureAlert.fireDate = [[NSDate date] dateByAddingTimeInterval: interval];
    futureAlert.timeZone = [NSTimeZone systemTimeZone];
    

    where interval in your case will equal to 85500 secs. In 24 hours a 86400 secs, 15 min – 900 secs, then a 23 hours 45 min – 85500 secs (86400 – 900).

    So, you can calc a interval seconds and use it

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

Sidebar

Related Questions

I have this weird kind of error. I am trying implement basic Euclidean algorithm
I'm trying to update the alarm time that is set when calendar events are
I am trying to implement a location alarm kind of application. But whenever my
Trying to implement a timer for my game that I'm making. I have a
Trying to implement a simple print in SL4. I have a DataGrid that I
Trying to implement page turning animation exactly as the flipboard ipad app. I have
Trying to implement google C2DM service. registrationIntent.putExtra(app, PendingIntent.getBroadcast(context,0,new Intent(), 0)); registrationIntent.putExtra(sender,example@gmail.com); context.startService(registrationIntent); Almost every
Trying to implement a UITableView of names similar to the built-in Contacts iPhone app
Trying to implement the decorator pattern in C# from the code in the Head
Trying to implement some nested loops that are spitting out good old nested html

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.