objective-c EXC_BAD_ACCESS in my code...
Posted
by Mark
on Stack Overflow
See other posts from Stack Overflow
or by Mark
Published on 2010-04-25T05:58:36Z
Indexed on
2010/04/25
6:03 UTC
Read the original article
Hit count: 483
objective-c
|exc-bad-access
I'm new to objective-c and Im trying to write a little sample app that gets some XML from a remote server and outputs it to the console, but when I do it I get a EXC_BAD_ACCESS which I dont understand:
NSString *FeedURL = @"MYURLGOESHERE";
NSURLRequest *theRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:FeedURL]];
NSURLResponse *resp = nil;
NSError *err = nil;
NSData *response = [NSURLConnection sendSynchronousRequest: theRequest returningResponse: &resp error: &err];
NSString *theString = [[NSString alloc] initWithData:response encoding:NSUTF8StringEncoding];
NSLog(@"Response: %@", theString);];
[resp release];
[err release];
When I comment out the [resp release]
line I dont get it anymore, can someone please explain this to me :)
Thanks
© Stack Overflow or respective owner