繁体   English   中英

- [__ NSCFDictionary JSONRepresentation]:发送到实例的无法识别的选择器

[英]-[__NSCFDictionary JSONRepresentation]: unrecognized selector sent to instance

我正在使用github上提供json-famework 我在项目中添加了项目的引用,在我的viewController中添加了一个头文件搜索路径和导入的JSON.h文件。 我试图实现以下代码,它给了我这个错误,JSONRepresentation是一个无法识别的NSDictionary对象选择器。 我在这种情况下做错了什么。 请指导我。

NSDictionary * profileDictionary = [NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:user.userId, user.userVia, user.userName, user.firstName, user.lastName, user.emailId, user.contactNumber, user.gender, user.alternateNumber, user.weight, user.height, user.city, user.loginId, user.imageType, user.imageFileName, user.dob,nil] 
                                                               forKeys:[NSArray arrayWithObjects:@"Id", @"UserVia", @"UserName", @"FirstName", @"LastName", @"EmailID", @"ContactNumber", @"Sex", @"AlternateNumber", @"weight", @"Height", @"City", @"LoginId", @"ImageType", @"ImageFileName", @"DOB", nil]];



NSString *jsonString = [profileDictionary JSONRepresentation]; 

你是否已将.m文件编译到你的项目中?

只包含.h文件只允许代码编译。 如果没有编译.m文件,它将在运行时因您看到的错误而崩溃。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM