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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T06:55:57+00:00 2026-05-21T06:55:57+00:00

I’m trying to share data between various viewControllers, I’m using a property declared in

  • 0

I’m trying to share data between various viewControllers, I’m using a property declared in the appDelegate. I set the property in my first viewController and when I print out the contents, everything looks fine, but after I call a custom class method, the property gets set to some random value that seems to change every time I run the app. See code below:

appDelegate .h

NSDate *lastUpdated;

@property (nonatomic, retain) NSDate *lastUpdated;

viewController .m

AppDelegateClassName *appDelegate = (AppDelegateClassName *)[[UIApplication sharedApplication] delegate];
[appDelegate setLastUpdated:[NSDate date]];

After I set the property, I then call the following custom class method with a reference to the viewController as a parameter:

viewController .m

ForceData *forceData = [[ForceData alloc] init];
[forceData queryServiceWithParent:self];

If I try and display the contents of the appDelegate property within my custom class, it returns a random value. Once the custom class returns to the viewController, the appDelegate property stays as the random value.

I can’t see what’s going wrong. Can anyone help?

Thanks.

UPDATE

Here is the code within the queryServiceWithParent method:

- (void)queryServiceWithParent:(UIViewController *)controller {

    viewController = (ForcesTableViewController *)controller;
    responseData = [[NSMutableData data] retain];

    NSString *url = [NSString stringWithFormat:@"http://example.com"];
    theURL = [[NSURL URLWithString:url] retain];
    NSURLRequest *request = [NSURLRequest requestWithURL:theURL];
    [[NSURLConnection alloc] initWithRequest:request delegate:self];

}

I’m still having this problem so any help is much appreciated.

UPDATE:

I’ve spent some more time looking at this and I can display the contents of lastUpdated anywhere within the queryServiceWithParent (just above) and it displays fine. But if I display the same property in the connectionDidFinishLoading, it’s reset. Very stuck with this one!

  • 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-21T06:55:58+00:00Added an answer on May 21, 2026 at 6:55 am

    The way this sounds to me is that your NSDate property is autoreleased at some point, even though your memory management sounds fine the way you describe it.

    Can you try to add an extra retain to your NSDate, as in:

    appDelegate.lastUpdated = [[NSDate date] retain]

    If that helps than we need more information about your code to find out where your memory management has errors. i.e. the complete header and main file of your appDelegate and viewController.

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

Sidebar

Related Questions

We're building an app, our first using Rails 3, and we're having to build
I'm making a simple page using Google Maps API 3. My first. One marker
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am trying to loop through a bunch of documents I have to put
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this

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.