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.