0

我的代码有问题,应用程序因错误而崩溃

由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“-[__NSCFDictionary setObject:forKey:]:尝试插入零值(键:app_ver)” *第一次抛出调用堆栈:(0x874022 0x257acd6 0x81ca48 0x81c9b9 0x8732da 0x8c473 0x750419 0x750477 4c7x08d8 0x82670 0x13eda49 0x13ebe84 0x13ecea7 0x13ebe3f 0x13ebfc5 0x1330f5a 0x2f1ca39 0x2fe9596 0x2f13120 0x2fe9117 0x2f12fbf 0x84894f 0x7abb43 0x7ab424 0x7aad84 0x7aac9b 0x133040f 0x82a35 0x12fc4d6 0x12fc447 0x99595ed9 0x995996de) terminate called throwing an exception

4

2 回答 2

0

You are trying to set a dictionary object without any key (nil).

Check this for more details: setObject:ForKey: crash?

于 2012-07-24T08:31:49.967 回答
0

您尝试插入一个 nil 对象。先测试一下。

if(anObject){
    [myDictionary setValue:anObject forKey:kAnKey];
}
于 2012-07-24T07:34:37.437 回答