gpt4 book ai didi

ios - 获取异常 'NSInvalidArgumentException',原因 : '-[__NSCFString stringValue]

转载 作者:行者123 更新时间:2023-11-29 10:26:36 24 4
gpt4 key购买 nike

我已经准备好通过谷歌尝试多种解决方案,但我遇到了两种错误,通过解决方案我得到了这个

2015-08-06 18:52:33.110 FastFast[2824:110493] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString stringValue]: unrecognized selector sent to instance 0x7f89c1eb7e50' * First throw call stack:

但是当我没有应用任何解决方案时,我得到了这个

2015-08-06 19:09:24.473 FastFast[2933:117451] -[__NSCFNumber length]: unrecognized selector sent to instance 0xb000000000000003 2015-08-06 19:09:24.480 FastFast[2933:117451] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFNumber length]: unrecognized selector sent to instance 0xb000000000000003' * First throw call stack:

我从 1 天开始就在弄乱这段代码,但找不到真正的问题。但是当我对这个函数设置静态限制时,一切都很好。

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
NSLog(@"Number Of Row %lu",_AddressArray.count);
return 4; // when set static limit here like this all works fine
return [self.temporaryAddArray count];}

以下链接属于我的接口(interface)文件和实现文件

文件.h https://drive.google.com/file/d/0B85GTvLEHASFVDEwajA1YXp1aUE/view?usp=sharing

文件.m https://drive.google.com/file/d/0B85GTvLEHASFNEhzUnN1U25qaEk/view?usp=sharing

我们将不胜感激。

最佳答案

恐怕您的值(value)观不是您期望的类型。看起来“temporaryAddArray”是 NSNumber 而不是数组,其他东西不是 NSNumber 但它是 NSString。在使用 objectForKey: 从 JSON 分配值之前,通过显示检查它们的类型:

NSLog(@"%@", [variable class]);

并确保他们在您的 JSON 中有预期的类型,因为他们中的一些人没有。如果您粘贴从 API 获得的 JSON,那么我可以准确指出问题。

关于ios - 获取异常 'NSInvalidArgumentException',原因 : '-[__NSCFString stringValue],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31870499/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com