It shouldn't be
myString = @"This is a string";
but this:
self.myString = @"This is a string";
both in -applicationDidFinishLaunching:
and in -setDefault:
. Don't forget to specify self in your NSLog statements as well. You'd probably like to specify a different string in -setDefault:
so that you can actually see that a change is taking place.
One other thing: You're effectively saying that you want to assign to myString, but that's not appropriate for an object. Instead of:
@property NSString *myString;
you should instead use
@property (copy) NSString *myString;
or at least
@property (retain) NSString *myString;
The former is preferred because passing a NSMutableString
instance effectively copies it as a NSString
, while passing a NSString
instance simply retains it.
Good luck to you in your endeavors.