Reputation: 4921
Hi i am new to iphone development,can any one help how to append string to mutable string. im trying to string By appending String Format .application Is crashes...
Upvotes: 5
Views: 9331
Reputation: 11053
There is a crash when you try to append nil to a NSMutableString
- check that.
Also while it does not crash during append - if your NSMutablestring
is not initialized - then nothing works and your app might crash later in the code because there is nothing in your string.
Post the crash report, I am sure it will tell you what is going wrong.
Upvotes: 1
Reputation: 6401
Sample code NSMutableString:
NSMutableString* mutString = [[NSMutableString alloc] init];
for(int index=0;index<10;index++)
{
[mutString appendString:[NSString stringWithFormat:@"%d",index]];
}
NSLog(@"Content in MutableString: %@",mutString);
Regarding crash: post your code that crashes. What does it say ?
Upvotes: 6