我从 NSMuableDictionary 中提取数据到 NSString 并尝试像这样对 String 进行比较:
NSDictionary *error = [[NSDictionary alloc]init];
NSString *errorCode = [[NSString alloc]init];
error = [sing.globalCallsDitionary valueForKey:@"Error"];
NSLog(@"error code %@",[error valueForKey:@"error_code"]);
errorCode = [error valueForKey:@"error_code"];
if ([errorCode isEqualToString:@"-1"]) {
当执行 if 语句时,我得到这个关于数组的错误,错误如下所示:
2012-04-27 06:34:49.686 CallBiz[10319:707] error code (
"-1"
)
2012-04-27 06:35:00.602 CallBiz[10319:707] -[__NSArrayI isEqualToString:]: unrecognized selector sent to instance 0x16fc10
2012-04-27 06:35:00.608 CallBiz[10319:707] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayI isEqualToString:]: unrecognized selector sent to instance 0x16fc10'
*** First throw call stack:
(0x3541f88f 0x36846259 0x35422a9b 0x35421915 0x3537c650 0xb2a3 0x353793fd 0x32458faf 0x32458f6b 0x32458f49 0x32458cb9 0x324595f1 0x32457ad3 0x324574c1 0x3243d83d 0x3243d0e3 0x3667222b 0x353f3523 0x353f34c5 0x353f2313 0x353754a5 0x3537536d 0x36671439 0x3246be7d 0x2e61 0x28fc)
terminate called throwing an exception
就像 xCode 看着我NSString *errorCode = [[NSString alloc]init];
的一样NSArray
,有人可以帮我解决这个问题吗?