0

In mi wsdl2objc generated code I have:

@interface tns6_EntityType : NSString  {

/* elements */
/* attributes */
    NSNumber * id_;
}

However, when I get an element of this type, I get the following error:

2011-03-26 21:23:02.428 Pez[47129:a0f] Exception detected while handling key input.

2011-03-26 21:23:02.428 Pez[47129:a0f] * -length only defined for abstract class. Define -[tns6_EntityType length]!

Does anyone know how to fix this?

Thanks

gideon
  • 19,329
  • 11
  • 72
  • 113
Radu Paise
  • 285
  • 1
  • 6
  • 16

2 Answers2

0

I had the same problem when generated wsdl code to objC.

You can find my solution for this problem here: https://stackoverflow.com/a/21331422/1891772.

In my example I used ARC. As I know wsdl2objc doesn't support ARC so you need change it my example:

  1. Change in "stringHolder" property "strong" to "retain"
  2. add "autorelease" to code line where property "stringHolder" initialized
  3. add "self.stringHolder = nil" in dealloc method
Community
  • 1
  • 1
Vlad Papko
  • 13,184
  • 4
  • 41
  • 57
0

It looks ilke you need to add your own implementation for -length on the class tns6_EntityType. Remember that in Objective-C, NSString is the abstract parent of a class cluster, and so subclassing it directly can sometimes have strange effects. If you continue to get errors like this, just read through the message and follow its directions.

Tim
  • 59,527
  • 19
  • 156
  • 165
  • Can you post your implementation (in your original question) for `[tns6_EntityType length]`? – Tim Mar 27 '11 at 02:02
  • Sorry for the late response. I modified the wsdl to have one NSString and one NSNumber. My implementation was return [super length], but it didn't work. – Radu Paise Mar 30 '11 at 14:07
  • That won't work for the same reason - if you're subclassing NSString directly, you likely won't have `[super length]` to fall back on, since NSString isn't a concrete string class. Try returning your member string's length instead (e.g. `return [str_ length]` if your member string is called `str_`). – Tim Mar 30 '11 at 14:54