hi,
I was just trying to use NSInvocation, but I'm not getting it right.
I need to use this because I want to use a timer for a method that takes several arguments. The method signature of the method I want to call is:
After trying around a bit, it seems NSInvocation cannot take non-objects for arguments (it gives me "incompatible type for setArgument:atIndex:"). Because of that I created this method:
anyway, here is the code with NSInvocation which results in a crash and a EXC_BAD_ACCESS error on the line with NSInvocation *moveToPositionInvocation
I guess the rest doesn't really matter because the code stops at the NSInvocation *moveToPositionInvocation line ... I just set the arguments after that and then pass the invocation to a timer.
ideas why my app crashes here?
I was just trying to use NSInvocation, but I'm not getting it right.
I need to use this because I want to use a timer for a method that takes several arguments. The method signature of the method I want to call is:
Code:
-(void)moveToPosition:(CGPoint)newPosition animate:(BOOL)animate deckView:(UIView *)deckView;
After trying around a bit, it seems NSInvocation cannot take non-objects for arguments (it gives me "incompatible type for setArgument:atIndex:"). Because of that I created this method:
Code:
-(void)moveToPositionAtX:(NSNumber *)xPos Y:(NSNumber *)yPos animate:(NSNumber *)animate deckView:(UIView *)deckView {
[self moveToPosition:CGPointMake([xPos floatValue],[yPos floatValue]) animate:[animate boolValue] deckView:deckView];
}
anyway, here is the code with NSInvocation which results in a crash and a EXC_BAD_ACCESS error on the line with NSInvocation *moveToPositionInvocation
Code:
SEL moveToPositionSelector = @selector(moveToPositionAtX:Y:animate:deckView:);
NSMethodSignature *moveToPositionSignature = [NSObject instanceMethodSignatureForSelector:moveToPositionSelector];
NSInvocation *moveToPositionInvocation = [NSInvocation invocationWithMethodSignature:moveToPositionSignature];
[moveToPositionInvocation setTarget:self];
[moveToPositionInvocation setSelector:moveToPositionSelector];
...
ideas why my app crashes here?