[英]'NSInvalidArgumentException', reason: '-[__NSCFString objectAtIndex:]: unrecognized selector sent to instance
Below is my code 下面是我的代码
nameLabel.text=[[[dict_Details objectForKey:@"unknown_object"] objectAtIndex:0] objectForKey:@"UserFullName"];
here is my response 这是我的回应
getUserReviewsResponse getUserReviewsResponse
{
"status_code" = 200;
"unknown_object" = "[{ID:227,ServiceProviderName:Dr.KarthikMendi,UserFullName:karthik,ReviewTemplateID:19,TotalScore:88.0,ServiceName:Doctor,Review:Very knowlegable doctor he understands the problem very well.,ServiceID:5,CommentsBySP:Thank you...,ServiceProviderID:0,CommentByAdmin:null,UserID:106,Status:true,CreatedDate:2016-05-06T18:30:08,Services:null,ServiceProviderTypes:null},{ID:168,ServiceProviderName:Dr.KarthikMendi,UserFullName:karthik,ReviewTemplateID:19,TotalScore:92.0,ServiceName:Doctor,Review:I am very impressed. Very organized and professional.\\r\\nI always leave feeling taken care of and medical needs met. \\r\\nNeed more Dr\U00e2\U0080\U0099s like him!\\r\\nGreat! He gave me sufficient time!\\r\\nVery friendly, informed and hospitable. \\r\\nVery nice \U00e2\U0080\U0093 didn\U00e2\U0080\U0099t feel like a number, but an actual person.,ServiceID:5,CommentsBySP:Thank you,ServiceProviderID:0,CommentByAdmin:null,UserID:84,Status:true,CreatedDate:2016-03-23T10:12:19.087,Services:null,ServiceProviderTypes:null}]";
}
The value for "unknown_object"
is a string, but you are assuming it's a dictionary as you are calling objectForKey:
on it. "unknown_object"
的值是一个字符串,但是您在调用objectForKey:
时假定它是字典。 Hence the exception. 因此,例外。
In general I would say that JSON is "broken" as it requires double-deserialization, which is less than useful. 总的来说,我会说JSON被“破坏”了,因为它需要双重反序列化,这没有用。
Please check your json data in http://jsoneditoronline.org/ correct or not. 请检查http://jsoneditoronline.org/中的json数据是否正确。
For example: Dr.KarthikMendi is string that include "Dr.KarthikMendi" (Double or single Quotation ). 例如:Dr.KarthikMendi是包含“ Dr.KarthikMendi”(双引号或单引号)的字符串。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.