[__NSCFNumber length]: unrecognized selector sent to instance 0x8b3c310
2014-12-04 10:26
429 查看
出现这种问题一般是你把int类型的数值赋给了NSString。 比如: 你定义了一个NSString类型的属性sex,但是服务端返回的sex字段实际上是NSNumber类型, 你直接把NSNumber类型的值赋给了sex,然后把这个sex赋给了_sexLabel.text,这时就会出现这种错误。
使用Plist文件时遇到这种错误也可以按照这个方法来检查。
如果出错的地方是一大块代码: 可以一个个代码块注释起来测试。
//求职状态 NSString *qzzt; if (![dict[@"qzzt"] isEqual:[NSNull null]]) { NSDictionary *tempDict = [UserDataTools getMyInfoJobStatusDict]; qzzt = [tempDict objectForKey:[NSString stringWithFormat:@"%@",dict[@"qzzt"]]]; } else { qzzt = @"请选择"; } [self setControlsTextWithTag:13 text:qzzt]; //工作年限 NSString *years; if (![dict[@"gznx"] isEqual:[NSNull null]]) { years = [UserDataTools getYearsTextWithId:dict[@"gznx"]]; } else { years = @"请选择"; } [self setControlsTextWithTag:16 text:years]; //目标地点 NSString *area; if (![dict[@"area"] isEqual:[NSNull null]]) { area = [UserDataTools getAreaTextWithId:dict[@"area"]]; } else { area = @"请选择"; } [self setControlsTextWithTag:18 text:area]; //期望薪资 NSString *money; if (![dict[@"money"] isEqual:[NSNull null]]) { money = [UserDataTools getSalaryTextWithId:dict[@"money"]]; } else { money = @"请选择"; } [self setControlsTextWithTag:20 text:money]; //学历 NSString *education; if (![dict[@"education"] isEqual:[NSNull null]]) { education = [UserDataTools getEducationTextWithId:dict[@"education"]]; } else { education = @"请选择"; } [self setControlsTextWithTag:15 text:education];//工作经验(公司名) [self setControlsTextWithTag:21 text:dict[@"companyname"]]; //自我介绍 [self setControlsTextWithTag:24 text:[NSString stringWithFormat:@"%@",dict[@"zwpj"]]]; //联系电话 [self setControlsTextWithTag:14 text:[NSString stringWithFormat:@"%@",dict[@"phone"]]]; //居住地 [self setControlsTextWithTag:17 text:[NSString stringWithFormat:@"%@",dict[@"jzd"]]];
相关文章推荐
- [__NSCFNumber length]: unrecognized selector sent to instance 0x8b3c310
- '-[__NSArrayM enqueue:]: unrecognized selector sent to instance 0x60000024ef40'
- -[__NSCFNumber length]: unrecognized selector sent to instance 0x12465980 崩溃分析及解决方法
- BugList: Objective C What does -[NSURL length]: unrecognized selector sent to instance 0x
- unrecognized selector sent to instance 0x81de740
- unrecognized selector sent to instance 0x81de740
- 关于使用JSON库的时候,出现[NSCFString JSONValue]: unrecognized selector sent to instance的问题
- '-[UIDevice uniqueGlobalDeviceIdentifier]: unrecognized selector sent to instance 0x68170c0
- NSDictionary内部数据类型与unrecognized selector sent to instance 错误类型
- unrecognized selector sent to instance出现的原因和解决方案
- iOS:编译错误[__NSDictionaryM objectAtIndexedSubscript:]: unrecognized selector sent to instance 0xa79e61
- unrecognized selector sent to instance 遇到的问题
- unrecognized selector sent to instance解决方案
- UNRECOGNIZED SELECTOR SENT TO INSTANCE 问题快速定位的方法
- iOS中的crash防护(一)unrecognized selector sent to instance
- [__NSCFString containsString:]: unrecognized selector sent to instance 0x17d68490
- 利用objc的runtime来定位次线程中unrecognized selector sent to instance的问题
- -[__NSCFNumber rangeOfCharacterFromSet:]: unrecognized selector sent to instance 0x7fa5216589d0
- xcode 运行出现类似-[__NSCFString objectForKey:]: unrecognized selector sent to instance的调试方法
- CRASH: -[NSNull length]: unrecognized selector sent to instance错误的处理办法