robbiehanson/KissXML — Issue #12: Cannot use insertChild method
Author: jos4ua
Created: 2012-01-29 04:34:07+00:00
State: open

Hi,
I have a problem when I tried to use the insertChild method. I keep getting the same error.
Here's the code I used (I took it from an online tutorial) :

DDXMLDocument *document = [[DDXMLDocument alloc] initWithXMLString:@"" options:0 error:nil];
DDXMLElement *root = [document rootElement];
[root insertChild:[DDXMLNode elementWithName:@"address" stringValue:@"Some Address"] atIndex:0];

The error showing in the log is :

2012-01-29 11:20:50.401 MathTutor[900:f803] -[__NSCFConstantString xmlChar]: unrecognized selector sent to instance 0x4a644
2012-01-29 11:20:50.614 MathTutor[900:f803] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFConstantString xmlChar]: unrecognized selector sent to instance 0x4a644'
*** First throw call stack:
(0x1725052 0x18b6d0a 0x1726ced 0x168bf00 0x168bce2 0x2f790 0x326bd 0x3a8ec 0xee61 0x3917 0x2fd2 0x25964e 0x1b9a73 0x1b9ce2 0x1b9ea8 0x1c0d9a 0x2a5e 0x1919d6 0x1928a6 0x1a1743 0x1a21f8 0x195aa9 0x160ffa9 0x16f91c5 0x165e022 0x165c90a 0x165bdb4 0x165bccb 0x1922a7 0x193a9b 0x2788 0x26e5)

I'm using XCode 4.2.1 with iOS SDK 5.0 (I use the latest KissXML which support ARC).
I'm really greatfull if you can help me resolve this issue because I'm new in iOS Programming. Thanks.