[英]NSInvalidArgumentException…why?
我有这段代码,其中self.currentSet.imagesPrefix是NSString,并且[attributeDict objectForKey @“ imagesPrefix”]是NSSTring
self.currentSet.imagesPrefix=[attributeDict objectForKey:@"imagesPrefix"];
但是在控制台中,我有这个问题:
2011-11-15 16:04:08.850 MyApp[8579:707] -[__NSCFString setImagesPrefix:]: unrecognized selector sent to instance 0x168600
2011-11-15 16:04:08.857 MyApp[8579:707] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString setImagesPrefix:]: unrecognized selector sent to instance 0x168600'
我的猜测是您尚未合成imagesPrefix来生成setImagesPrefix方法。
这意味着self.currentSet
不是您认为的对象。 无需链接属性,而是将其拉到单独的阶段,以便可以调试:
id firstpart = self.currentSet;
NSLog(@"%@", firstpart);
这将揭示出self.currentSet
实际上是什么。 准备一个惊喜。 然后就可以开始真正的调试,因为您必须弄清楚为什么它不是您认为的那样。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.