views:

337

answers:

1

I have a callback class with the method -(void)fire and it calls
[target performSelector:selector withObject:dictionary];
Just before that line I added NSLog(@"%@", [[dictionary class] description]); to see where the object changed, when debugging it returns NSCFDictionary.

So that was all fine. Next I went and added a similar line to get the arguments type inside the method being called. Now, when debugging, it returns NSCFString, whilst the callback logs NSCFDictionary.

Is there any reason why this object is becoming an NSString once I call performSelector?

+1  A: 

You can only pass one argument to your method if you use performSelector:withObject:.

Check out performSelector:withObject:withObject: or use NSInvocation.

gerry3
Oh, actually, I do apologise, I haven't got my code near me. The actual selector is assigned using @selector(TokenHandler:)
woody993
And the first parameter has type (NSDictionary*)? But inside the method the object identifies itself as an NSString?
gerry3
It is actually (id), but yes it is identified as NSString. I just thought and it can probably become (NSDictionary *), though it would be nice to know why it is doing this and to keep it as (id)
woody993
id is fine, I was just curious. I think you are going to have to post more of your code. I agree that your problem is very odd.
gerry3
thanks, I get home in 2-3 hours, so i'll post it then
woody993