I have an NSMutableString which I append other strings to.
When I print the String I get null.
in the .h file
NSMutableString *name;
@property(nonatomic, retain) NSMutableString *name;
in the .m file
@synthesize name;
-(IBAction) a {
if (uppercase == 1) {
[name appendString:@"A"];
NSLog(@"name: %@", name);
}
else
[name appendString:@"a"];
NSLog(@"name: %@", name);
}
I get the following print out when triggering the action.
name: (null)
Why is this returning null?
My guess is that you never initialized it. Something like:
… to ensure that you have a valid object to work with?