cocoa-touchcocoacategoriesnsnumberclass-cluster

Error with NSNumber Category because of NSCFNumber


I am using WSDL2OBJC for an OS X project. Part of the code generated by WSDL2OBJC adds a category to NSNumber. While I'm using the code I attempt to call the new method on an NSNumber and get an error:

+[NSCFNumber xmlNodeForDoc:elementName:]: unrecognized selector sent to class 0x7fff70b6b8c8

I've read that NSNumber is a class cluster and has private classes and that NSCFNumber is the class for ints. How can I get this to work? I can't add the category to NSCFNumber since it is a private class. This same code works for an iPhone project that I have.


Solution

  • I got this working. It looks like the issue was a memory problem. I was passing the NSNumber to an [NSInvocation setArgument: atIndex:]. It worked in the iPhone app because I was creating a variable and passing it by reference. I believe it wasn't working for me because I removed creating a separate var and just did [NSNumber numberWithInt:].