I get an "EXC_BAD_ACCESS" when I try to read a NSString...

Posted by micropsari on Stack Overflow See other posts from Stack Overflow or by micropsari
Published on 2010-04-17T20:04:57Z Indexed on 2010/04/17 20:13 UTC
Read the original article Hit count: 181

Filed under:
|
|

Hello !
This is a (very) simplified version of my iPhone code :

@interface x {
NSString * name1;
NSString * name2;
}

-init {
name1 = @"";
name2 = @"";
}

-(void) a {
name1 = @"uhuh";
name2 = [foo bar]; // return a (NSString *)
}

-(void) b {
NSLog(@"%@", name1); // it works
NSLog(@"%@", name2); // there I get an EXC_BAD_ACCESS...
}

Why I have this problem ? And how can I solve it ?
Thanks !

© Stack Overflow or respective owner

Related posts about iphone

Related posts about nsstring