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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:58:23+00:00 2026-05-22T21:58:23+00:00

I have a parser class that is subclass of NSOperation. It is used to

  • 0

I have a parser class that is subclass of NSOperation. It is used to parse the xml and table view is reloaded when the parse is completed. I have a refresh UIBarButtonItem that is used to call the parser and parse the new xml from the link again.

-(void)refresh {
   [self.queue cancelAllOperations]; //cancel all the current operations
   [self.queue release];
   self.queue=nil;
   self.arrayOfAllPhotos = nil; // The array to load table view
   [self performSelectorOnMainThread:@selector(doItAgain) withObject:nil waitUntilDone:NO];

}

-(void)doItAgain {
   [tableView reloadData];
   NSURL *url = [NSURL URLWithString:@"some url"];
   NSURLRequest *request = [NSURLRequest requestWithURL:url];
   NSURLConnection *aconnection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
   self.myConnection = aconnection;
   [aconnection release];   

}

But, as press refresh button, the app crashes with no message. How do I release the NSOperationQueue and start a new parsing again to load data ?

  • 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-22T21:58:24+00:00Added an answer on May 22, 2026 at 9:58 pm

    Your memory management is broken. And you are violating encapsulation. You are calling [self.queue release]. That is reaching into self and breaking it by releasing something self owns.

    If I were to reach into your abdomen and release your liver, it might be all for the good of the country, but it probably would be bad for you. This concept is known as encapsulation. The concept is explained here.

    Violating encapsulation is bad for any number of reasons and it’s bad for self here.

    Instead just call self.queue = nil and the setQueue: method will release queue for you when it’s the right time (just like it does for arrayOfPhotos).

    [self.queue cancelAllOperations];
    self.queue = nil;
    self.arrayOfAllPhotos = nil;
    

    Taking a step back from the particulars of this issue it appears that you could also spend some time getting a deeper understanding of the MVC paradigm. The WWDC 2010 talk (Session Title: Model-View-Controller for iPhone OS) about it was fantastic and can be found here (you have to log in).

    Generally it is a bad idea to conflate networking with your table view controller.

    Good luck!

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

Sidebar

Related Questions

So I'm writing an android app, and I have an xml parser class that
I have a class to parse a matrix that keeps the result in an
I have a buggy xml that contains empty attributes and I have a parser
I have used the XML Parser before, and even though it worked OK, I
I have a class that uses libxml2. It has static members which are used
I have two Parser classes that inherit from a base class, BaseParser. I want
I have a class that looks like following. Class Parser{ private String fileName; Parser(String
I have created a class that parses some document from file. class Parser {
I have a class that parses very large file (that can't fit in memory)
I have the following methods in my simple Custom Parser Class, when I execute

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.