It crashes only one time and then it works normally.
Here开发者_运维问答 is the project: http://www.mediafire.com/?p0dy7g5ozkl69jt
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... ;)
精彩评论