I have a check where I see if the delegate responds to a callback, then I try to performSelector:withObject:withObject:
if([delegate respondsToSelector:self.callback])
{
[delegate performSelector:callback withObject:object withObject:error];
}
When this is executed, I end up in the callback me开发者_Python百科thod of
-(void)thisIsMyCallBack {
//NSLog(@"object = ", object);
}
But I do not have access to the object.
I tried to create another method
-(void)thisIsMyCallBack:(NSObject *)object withObject:(NSObject *)error {
//NSLog(@"object = ", object);
}
but this is not called, and the callback goes to the first one.
How do I access the objects that I want to pass?
It looks like you need to set your callback property to:
@selector(thisIsMyCallBack:withObject:)
In Obj-C, the the bits that look like named parameters to a method are really part of the method's selector. thisIsMyCallBack:withObject:
is not the same as thisIsMyCallBack
.
精彩评论