I have this:
if (soapResults != nil) {
soapResults = [soapResults stringByAppendingString:@"\n"];
}
But I get a warning:
Assignment from distinct Objective-C type on build.
When I run it on device I get:
Program received signal: "EXC_BAD_ACCESS".
from gdb.
Any ideas how to append a newline to an NSString without getting a warning or error?
Any help appreciated // :)
An alternative is: [NSString stringWithFormat: @"%@\n", soapResults]
even if the logic is the same!
However, even in the case of stringByAppendingString, it returns a new string but it doesn't change the target, so you have to assign the new string to a new instance of the class NSString.
You can try this, it works for me:
NSString *content1 = [messageObject valueForKey:@"content"];
NSString *seprator = @"\n----------------------\n";
NSString *myString = [NSString stringWithFormat:@"%@\n%@\n",seprator,content1];
content = [content stringByAppendingString:myString];
`
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With