NSInvocation making app crash

Posted by neha on Stack Overflow See other posts from Stack Overflow or by neha
Published on 2010-06-14T09:48:50Z Indexed on 2010/06/14 9:52 UTC
Read the original article Hit count: 172

Filed under:
|

Hi all,

I'm using NSInvocation as follows:

In my init, I'm writing this in my viewDidLoad:

SEL mySelector;
mySelector = @selector(initParsersetId:type:);

NSMethodSignature * sig = nil;
sig = [[self class] instanceMethodSignatureForSelector:mySelector];

myInvocation = nil;
myInvocation = [NSInvocation invocationWithMethodSignature:sig];
[myInvocation setTarget:self];
[myInvocation setSelector:mySelector];

SEL mySelector;
mySelector = @selector(initParsersetId:type:);

NSMethodSignature * sig = nil;
sig = [[self class] instanceMethodSignatureForSelector:mySelector];

myInvocation = nil;
myInvocation = [NSInvocation invocationWithMethodSignature:sig];
[myInvocation setTarget:self];
[myInvocation setSelector:mySelector];

And I'm calling it like this:

Idea *tempIdea = [[Idea alloc]init];
tempIdea = [genericArray objectAtIndex:indexPath.row];
idea.ideaId = tempIdea.ideaId;
[tempIdea release];

NSNumber *_id_ = [NSNumber numberWithInt:idea.ideaId];
[myInvocation setArgument:_id_ atIndex:2];  //CRASHING AT THIS LINE

My application is crashing at the indicated line. Can anybody please help me?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about nsinvocation