Plato
Plato

Reputation: 89

"PerformSelector names a selector which retains the object" error and ARC

Ok with ARC how do we solve this gracefully?

The problem is the code created with WSDL2OBJC.. I fixed all other problems but this one eludes me..

if ([super respondsToSelector:@selector(initWithCoder:)] && ![self isKindOfClass:[super class]]) {
    self = [super performSelector:@selector(initWithCoder:) withObject:decoder];
} else {
    self = [super init];
}

In WSDL2OBJC they resolved this problem here like this:

"In Targets->Build Phases-> Compile Sources For all the wsdl2objc sources add: -fno-obcj-arc"

But this is actually not a fix on the code.. Only prevents ARC on WSDL2OBJC sources..

Upvotes: 2

Views: 2049

Answers (3)

steven yu
steven yu

Reputation: 29

try this solution:

self = [super performSelector:NSSelectorFromString(@"initWithCoder:") withObject:aDecoder];

Upvotes: 2

Plato
Plato

Reputation: 89

I decided to give up ARC on WSDL2OBJC and use compiler flag

Upvotes: 0

zoul
zoul

Reputation: 104065

If you know the superclass, can’t you simply drop this mess and call the appropriate initializer directly?

Upvotes: 0

Related Questions