The following code is causing me some problems. The third line causes a program crash… it doesn’t happen the first time I step through but somehow later on in the program. If I comment out that third line, the program runs smoothly.
NSString *myRequestString = @"text";
int i = 1;
myRequestString = [myRequestString stringByAppendingString:[NSString stringWithFormat: @"t=%d", i]];
That code causes this exception:
*** -[CFString release]: message sent to deallocated instance 0xb4c43fe0
On a side note, can anyone tell me how to concatenate strings in objective-c like any other normal language… I can’t believe that there is no concatenation operator.
Any and all help is greatly appreciated.
It sounds like you’re releasing
myRequestStringat some point without retaining it, which is not correct according to the memory management rules.And no, there’s no concatenation operator. There isn’t one in C either.