I am parsing the xml file and I was trying to cross out the whitespace in my currentElementValue because it messed up a couple of things.
I can see in my output window that a couple of carriage returns and tabs are present
(gdb) po string Keep the arms on the side, and lift your leg. (gdb) po currentElementValue Keep the arms on the side, and lift your leg. (gdb)
This is my foundCharacters function, and I, unfortunately, have used the stringByTrimmingCharactersInSet application without success.
- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string { if(!currentElementValue) currentElementValue = [[NSMutableString alloc] initWithString:string]; else { [currentElementValue appendString:string]; currentElementValue = [currentElementValue stringByTrimmingCharactersInSet: [NSCharacterSet newlineCharacterSet]]; NSString *instructions = @"instructions"; [directions setValue:string forKey:instructions];
I get this error *** The application terminated due to the unannounced exception "NSInvalidArgumentException", reason: "Attempting to change an immutable object using appendString:" Which is strange, since my currentElementValue is NSMutableString .. So what's wrong? Does anyone have a clue or idea?
jovany
source share