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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:31:50+00:00 2026-05-13T11:31:50+00:00

I am currently developing an iPhone application which loads data from an RSS feed

  • 0

I am currently developing an iPhone application which loads data from an RSS feed and displays it in a Tab Bar Application in 2 UITableViews, which we we call TableViewA and TableViewB. In the AppDelegate we have the following method:

- (void)getDataWithContext:(NSManagedObjectContext *)context
{
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

    NSError *parseError = nil;

    [UIApplication sharedApplication].networkActivityIndicatorVisible = YES;

    XMLReader *xmlReader = [[[XMLReader alloc] initWithContext:context]autorelease];
    [xmlReader parseXMLFileAtURL:[NSURL URLWithString:@"http://example.com/rss.xml"] parseError:&parseError];
    [pool release];

    [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
}

In our applicationDidFinishLaunching: method we call detach a new thread with that selector:

if ([self isDataSourceAvailable] == NO) {
    UIAlertView *noConnection = [[[UIAlertView alloc] initWithTitle:@"Connection Unavailable" message:@"The connection to the database is unavailable. The information displayed may be outdated." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil] autorelease];
    [noConnection show];
}
else{
    [NSThread detachNewThreadSelector:@selector(getDatawithContext:) toTarget:self withObject:context];
}

TableViewControllerA is a UITableViewController

with the following methods that load the data and images for the TableView. When the thread of the XML reader from above exits, having placed all entries into CoreData, we receive the notification and reload the entries into the TableView from CoreData.

TableViewControllerB is a TableViewControllerA which inherits these same methods with a few changes to select different entries from the database.

- (IBAction)loadData: (id) sender{
    BroadwayAppDelegate *appDelegate = (BroadwayAppDelegate *) [[UIApplication sharedApplication] delegate];

    checkDate = [NSPredicate predicateWithFormat: @"date <= %@",
                        [NSDate date]];
    if ( [self.showsSegmentedControl selectedSegmentIndex] == UISegmentedControlNoSegment || 
            [self.showsSegmentedControl selectedSegmentIndex] == 0){
        self.listContent = [CoreDataHelper searchObjectsInContext :@"Entry" :self.checkDate :@"title" :YES :appDelegate.managedObjectContext];
    }
    else if ([self.showsSegmentedControl selectedSegmentIndex] == 1){
        self.listContent = [CoreDataHelper searchObjectsInContext :@"Entry" :self.checkDate :@"startDate" :NO :appDelegate.managedObjectContext];
    }
    else if ([self.showsSegmentedControl selectedSegmentIndex] == 2){
        self.listContent = [CoreDataHelper searchObjectsInContext :@"Entry" :self.checkDate :@"endDate" :YES :appDelegate.managedObjectContext];
    }
    else if ([self.showsSegmentedControl selectedSegmentIndex] == 3){
        self.listContent = [CoreDataHelper searchObjectsInContext :@"Entry" :self.checkDate :@"type" :YES :appDelegate.managedObjectContext];
    }

    // create a filtered list that will contain products for the search results table.
    self.filteredContent = [NSMutableArray arrayWithCapacity:[self.listContent count]];

    // restore search settings if they were saved in didReceiveMemoryWarning.
    if (self.savedSearchTerm)
    {
        [self.searchDisplayController setActive:self.searchWasActive];
        [self.searchDisplayController.searchBar setSelectedScopeButtonIndex:self.savedScopeButtonIndex];
        [self.searchDisplayController.searchBar setText:savedSearchTerm];

        self.savedSearchTerm = nil;
    }

    NSError *error;
    [appDelegate.managedObjectContext save:&error];


    [self.tableView reloadData];

}

 - (void)viewDidLoad {
     [super viewDidLoad];
     [self loadData:nil];
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(threadExited) name:@"NSThreadWillExitNotification" object:nil];

     dateFormatter = [[NSDateFormatter alloc]init];
     [dateFormatter setDateStyle: NSDateFormatterMediumStyle];
     self.title = @"Entries";

 }

- (void)threadExited{
    [self loadData:nil];
    [[NSNotificationCenter defaultCenter] removeObserver:self];
    [NSThread detachNewThreadSelector:@selector(loadImages) toTarget:self withObject:nil];
}
- (void) loadImages{

    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
    NSArray *coreDataEntries = [CoreDataHelper getObjectsFromContext:@"Entry" :@"title" :NO :appDelegate.managedObjectContext];
    [UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
    for (Entry *s in coreDataEntries){
        if (s.image == nil) {
            NSString *URLString = [[Entry imageURLFromLink:s.link withExtension:@".jpg"]absoluteString];
            NSURL *imageURL = [NSURL URLWithString:URLString];
            NSData *imageData = [NSData dataWithContentsOfURL:imageURL];
            s.image = [UIImage imageWithData:imageData];
        }
    }
    [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
    [self.tableView reloadData];
    [pool release];
}

The application crashes if the user is scrolling either tableview when the data is reloaded or possibly when the XML reader exits. Why is this happening and how can we fix it? We have used the provided tools to check for memory leaks and things of that sort, and we did not find any relevant to the crash.

  • 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-13T11:31:51+00:00Added an answer on May 13, 2026 at 11:31 am

    Run with debug mode! When application is crashes click on “Show Debugger” button

    alt text
    (source: gyazo.com)

    and look at the problem

    or look on video

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

Sidebar

Ask A Question

Stats

  • Questions 493k
  • Answers 493k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Something like this: collection.Remove(collection.OrderBy(c => c.Location.Y).First()); The ordering is quite… May 16, 2026 at 10:41 am
  • Editorial Team
    Editorial Team added an answer use call e.g. in the calling batch file: call batch1.bat… May 16, 2026 at 10:41 am
  • Editorial Team
    Editorial Team added an answer Example on an online interpreter. 1) Search the position of… May 16, 2026 at 10:41 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I am developing an iPhone application in which I am fetching data from a
all iphone developers I am currently developing an iphone application in which I am
I'm currently developing a simple iPhone application using a UITabBar and table views for
I am currently developing a charting application (for the iPhone, although that is largely
I am developing an iPhone application . I have tested it on iPhone simulator
I'm currently developing a web application for a particular niche. The point is that
I am currently developing a Wordpress site, and everytime a comment, page or article
I'm currently developing the front end of a new CMS for a digital streaming
I'm currently developing a new feature for SharePoint 2010. Along with the deployment of
I'm currently developing a Safari extension that uses an injected script to further inject

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.