iPhone的performSelector改变对象类型
我有一个带有方法 -(void)fire
的回调类,它调用[目标performSelector:selector withObject:dictionary];
就在该行之前,我添加了 NSLog(@"%@", [[dictionary class] description]);
以查看对象更改的位置,调试时它返回 NSCFDictionary。
所以一切都很好。接下来,我添加了类似的行来获取被调用方法内的参数类型。现在,在调试时,它返回 NSCFString,而回调记录 NSCFDictionary。
一旦我调用performSelector,这个对象就会变成NSString,有什么原因吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您使用performSelector:withObject:,则只能将一个参数传递给您的方法。
查看performSelector:withObject:withObject: 或使用NSInitation。
You can only pass one argument to your method if you use performSelector:withObject:.
Check out performSelector:withObject:withObject: or use NSInvocation.