- [__ NSCFNumber isEqualToString]错误 [英] -[__NSCFNumber isEqualToString] error

查看:237
本文介绍了 - [__ NSCFNumber isEqualToString]错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了这次崩溃,但是,在我的代码中我使用了一个字符串。我已经在这一段代码上工作了2个小时,我只是看不到我错过的东西!有什么想法?

I'm getting this crash, but, in my code I am using a string. I've been working on this one piece of code for 2 hours now and I just can't see what I'm missing! Any ideas?

 NSString *codeR = [NSString stringWithFormat:@"%@", [[object objectForKey:@"code"] stringValue]];

    if([codeR isEqualToString:@"200"])

错误:


由于未捕获的异常'NSInvalidArgumentException'终止应用程序,原因:' - [__ NSCFNumber isEqualToString:]:无法识别的选择器发送到实例0x181cf0'

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFNumber isEqualToString:]: unrecognized selector sent to instance 0x181cf0'

我会非常感激输入,这让我感到困惑!

I would be very grateful input, this is confusing the hell out of me!

谢谢。

推荐答案

摆脱愚蠢的冗余,看看会发生什么。

Get rid of silly redundancy, see what happens.

NSString *codeR = [[object objectForKey:@"code"] stringValue];
// mysterious missing code
if ([coreR isEqualToString:@"200"]) // etc

另外,你确定你发布的 if 语句会引发错误吗?它可能来自其他地方。

Also, are you sure the error is raised from the if statement you posted? It could be coming from elsewhere.

这篇关于 - [__ NSCFNumber isEqualToString]错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆