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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T11:28:54+00:00 2026-05-22T11:28:54+00:00

This is my second day programming in ObjectiveC so I apologize for the noob

  • 0

This is my second day programming in ObjectiveC so I apologize for the noob question.

I have a ViewController that does an API call using async and asihttprequest:

@synthesize loadingStatus;
- (void)loadStatsData
{
    [indicator setHidden:NO];

    loadingStatus = [NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"bad", nil] forKeys:[NSArray arrayWithObjects:@"amount", nil ] ];

    [RESTApiController request:@"/method.json" method:@"GET" options:[NSDictionary dictionaryWithObjects:[NSArray arrayWithObject:@"amount"] forKeys:[NSArray arrayWithObject:@"receiving"] ] parent:self];
}

and receiving it like this:

- (void)requestFinished:(ASIHTTPRequest *)request
{
    if (receiving == @"amount")
    {
      // do stuff
      [loadingStatus setValue:@"good" forKey:@"amount"];
    }

    if ([loadingStatus valueForKey:@"amount"] == @"good"]) 
      [indicator setHidden:YES];
}

The app crashes when it tries to use the loadingStatus variable in requestFinished(). I guess somehow the variable gets dellocated, but I’m unsure as how to approach this.

Two questions:
1) How can I keep loadingStatus’s state across methods calls so I can use it in the way I wrote the code
2) Is there a better way of achieving my goal of checking if API calls are completed and hiding the ActivityIndicator?

-M.

  • 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-22T11:28:54+00:00Added an answer on May 22, 2026 at 11:28 am

    Do it this way: refer to loadingStatus as self.loadingStatus

    self.loadingStatus = [NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"bad", nil] forKeys:[NSArray arrayWithObjects:@"amount", nil ] ];
    

    That way, it goes through the accessor, and does a retain on it (the @property part in .h file).

    Also, programming hint: break your lines into smaller statements so they are easier to debug.

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

Sidebar

Related Questions

I strugle with this for second day... I have an NSArray of ints, wrapped
Good day, This is more web service design than programming question I think. I'll
Alright, second question on SO in one day. Looks like Windows programming makes me
This has to be a common question that all programmers have from time to
I've got a Perl script that needs to execute another Perl script. This second
I've a application that must work after another application. This second application has a
This is a second-hand question from an OS development site, but it made me
This is my second question on Bamboo ( My First One ). My understanding
I hope it's the heat, this is the second question today and it's one
I have this in my class When the second function is called php errors

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.