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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:17:31+00:00 2026-05-25T23:17:31+00:00

Im having a heck of a time. I have a datePicker setting start and

  • 0

Im having a heck of a time. I have a datePicker setting start and end dates, like the apple calendar. I am crashing with no messages whenever I click the datePicker multiple times. I’m guessing Im leaking memory but cannot find it. please help… ecause I need to access these in multiple methods, I made my UIDatePicker and NSDateFormatter into ivars. the BOOL’s are set when buttons are pressed and everything is set up to accept multiple touches in IB.

works fine if the datePicker is only clicked once or sometimes twice.

.h

IBOutlet UIDatePicker *datePicker;    
NSDateFormatter *dateFormatter;    
NSDateFormatter *timeFormatter;   

@property (nonatomic, retain) UIDatePicker *datePicker;    
@property (nonatomic, retain) NSDateFormatter *dateFormatter;
@property (nonatomic, retain) NSDateFormatter *timeFormatter;

.m

@synthesize datePicker;
@synthesize dateFormatter, timeFormatter;

viewDidLoad:

NSDate *now = [[NSDate alloc] init];

[datePicker setDate:now animated:NO];
//known bug - hopefully fixed in 4.3
//[datePicker setMinimumDate:now];
[now release];

self.dateFormatter = [[NSDateFormatter alloc] init];
[self.dateFormatter setDateStyle:NSDateFormatterMediumStyle];
[self.dateFormatter setTimeStyle:NSDateFormatterNoStyle];

formattedDateStringDate = [self.dateFormatter stringFromDate:datePicker.date];
NSLog(@"initdate %@", formattedDateStringDate);

self.timeFormatter = [[NSDateFormatter alloc] init];
[self.timeFormatter setDateStyle:NSDateFormatterNoStyle];
[self.timeFormatter setTimeStyle:NSDateFormatterShortStyle];

formattedDateStringTime = [self.timeFormatter stringFromDate:datePicker.date];
NSLog(@"initTime %@", formattedDateStringTime);

valueDidChange:

- (IBAction)changeDateInLabel:(id)sender
{
    formattedDateStringDate = [dateFormatter stringFromDate:datePicker.date];
    //NSLog(@"date %@", formattedDateStringDate);

    formattedDateStringTime = [timeFormatter stringFromDate:datePicker.date];
    //NSLog(@"time %@", formattedDateStringTime);

    if (isStartDateSet)
    {
        startDateLabel.text = formattedDateStringDate;
        startTimeLabel.text = formattedDateStringTime;
        newDate = formattedDateStringDate;
        newStartTime = formattedDateStringTime;
    }

    if (isEndDateSet)
    {
        endTimeLabel.text = formattedDateStringTime;
        newEndTime = formattedDateStringTime;
    }
}   

all three set to nil in viewDidUnload and all three released in dealloc.

  • 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-25T23:17:31+00:00Added an answer on May 25, 2026 at 11:17 pm

    You need to change some things before further investigation:

    • self.dateFormatter = [[NSDateFormatter alloc] init];

    After this the dateFormatter’s retain count is 2, 1 for the alloc and 1 for the property ‘retain’. Change it to just dateFormatter = [[NSDateFormatter alloc] init]; Same for the timeFormatter and probably the datePicker too.

    • After setting a member to nil, you cannot release it anymore. Do it the other way round.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having a heck of a time understanding C++/CLI syntax. I have a member
I'm having a heck of a time figuring this out. I have a WCF
I have been having a heck of a time getting Udp sockets working correctly
I am having one heck of a time with my implementation. We have a
I'm having a heck of a time setting a cookie in restlet, heres what
I am having a heck of time with something that seems rather straightforward but
I'm having a heck of a time trying to get a gridview to refresh
I am having a heck of a time taking the information in a tweet
I'm having a heck of a time getting ♥ type characters into my database
I am having one heck of a hard time trying to figure this out.

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.