-1

It crashes only one time and then it works normally.

Here is the project: http://www.mediafire.com/?p0dy7g5ozkl69jt

AmitK
  • 75
  • 1
  • 6

1 Answers1

0

You got a memory issue trying to access a released NSURL in your GetXML class... There:

- (void)main {
    [UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
    >> NSData *xml = [NSData dataWithContentsOfURL:url];
...

To diagnose these, make use of NSZombiesEnabled, explained there.

To fix your crash, make sure you retain or copy your url in your GetXML class :

- (id)initWithURL:(NSURL*)newURL delegate:(id <GetXMLDelegate>)newDelegate
{
    self = [super init];
    url = [newURL copy]; // there
    delegate = newDelegate;

    return self;
}

and to avoid a memory leak, make sure your release that URL

- (void)dealloc {
  [url release];
  [super dealloc];
}

Untested code, but should work... You should re-read Apple documentation about memory management... ;)

Community
  • 1
  • 1
Vincent Guerci
  • 14,379
  • 4
  • 50
  • 56