I declare an object in the beginning of M file as follows:
NSMutableString *SomeString;
And in a method I try to init it:
SomeString = [NSMutableString stringWithFormat:@"%c",'0'];
NSMutableString *SomeOtherString = [NSMutableString stringWithFormat:@"%c",'0'];
When I debug after the above line, I see that SomeOtherString holds the string "0" but SomeString remains empty. What am I doing wrong?
I think that's because
stringWithFormatreturns an autorelease object while yourSomeStringis a global variable , soSomeStringis out of scope and released.try this :