0

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.

Brian
  • 3,571
  • 7
  • 44
  • 70
  • 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:]. – Brian May 11 '11 at 16:26
  • 1
    Glad you solved it! Please consider taking a moment to post the solution as an answer and accept it; this way the question will not show up as "Unanswered". – jscs May 12 '11 at 03:53

1 Answers1

0

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:].

Brian
  • 3,571
  • 7
  • 44
  • 70
  • I am facing same issue, but cant resolve it. Can you please explain what was it that was causing the issue? I have tried, [[[NSNumber alloc] initWithInt:] autorelease] as well as [NSNumber numberWithInt:], but as soon as setArgument:atIndex: is done, the retain count for same becomes -1. – PushpRaj Oct 09 '12 at 12:56