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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:07:09+00:00 2026-05-28T05:07:09+00:00

I wrote an app that allows the user to enter data in a UITextField,

  • 0

I wrote an app that allows the user to enter data in a UITextField, and one of them allows them to enter in a specific date. I’m trying to have an alert appear in the iPhones Notification Center when the date is 15 hours away, even when the app is not running at all.

EDIT: New code-

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
UILocalNotification *localNotif = [[UILocalNotification alloc] init];

NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"MMdd"];
NSDate *eventDate=[dateFormatter dateFromString:eventDateField.text];

localNotif.fireDate = [eventDate dateByAddingTimeInterval:-15*60*60];
localNotif.timeZone = [NSTimeZone defaultTimeZone];


localNotif.alertBody = @"Event Tomorrow!";

localNotif.alertAction = @"Show me";

localNotif.soundName = UILocalNotificationDefaultSoundName;
localNotif.applicationIconBadgeNumber = 0;
[[UIApplication sharedApplication]presentLocalNotificationNow:localNotif];

}

  • 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-28T05:07:09+00:00Added an answer on May 28, 2026 at 5:07 am

    Store the date obtained from the text field in a NSDate object, eventDate. You will want to set the date with time also. The reason you are getting that error is that dateByAddingTimeInterval: should be called on an NSDate object and is not an identifier in itself. Set the fireDate of your local notification as

    localNotif.fireDate=[eventDate dateByAddingTimeInterval:-15*60*60];
    

    This will return a date which is 15 hours before the event.

    EDIT: You need to create an NSDateFormatter object and set its format to how it is stored in meetingDateField. Then use the dateFromString: to get the NSDate from the text field.

    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    [dateFormatter setDateFormat:@"mm'/'dd'/'yyyy"];
    NSDate *eventDate=[dateFormatter dateFromString:meetingDateField.text];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wrote an app that allows users to enter in a date on a
I have an app that allows the user to cache data for offline use.
I wrote an app that allows users to store text articles in Core Data.
I'm writing a web app that at one point allows a user to upload
I have a Java Google App Engine web application that allows user upload of
I have an app that allows a user to transmit their location to a
i wrote a java app that communicates and stores data in oracle; my question
I have a simple Google App Engine app, that I wrote using ordinary strings.
I wrote an app that is mainly allowing the user to drag tags to
I wrote a simple web app to let user input data as they walk

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.