i have now since a while a systematic problem with NSStrings and appending these to another. I searched in the web, but i couldn’t find something witch satisfied me.
I have a string declared like this in the header and properly syntesized in the implementation:
@property (nonatomic, retain) NSString *dataString;
I am refreshing every 200 ms data. I want to put this into a string (NSData would be more nice i guess) after the old one recursive. The string should grow every 200ms then.
dataString = [dataString stringByAppendingString:superString];
NSLog(@"%@",dataString);
But my code is is breaking here!
LOG DATA:
2011-07-05 12:40:54.039 Acceleration[1658:307] /AccelerationApp2011-07-05_12:40.txt
2011-07-05 12:40:56.825 Acceleration[1658:307] Acceleration:
X-axis: -0.036224
Y-axis: -0.036224
Z-axis: -0.941833
Global Acc: 0.9 g
(gdb)
…then i get program received signal: EXC_BAD_ACCESS
Is the Problem that the string may be too long?
You need to retain the return value from stringByAppending… or assign it to your property: