开发者

-[__NSCFDictionary JSONRepresentation]: unrecognized selector sent to instance

I am using the json-famework available on github. I have added th开发者_如何学运维e reference for the project in my project, has added a header search path and imported JSON.h file in my viewController. I am trying to implement following code, where it gives me this error that JSONRepresentation is an unrecognized selector for NSDictionary object. Am I doing anything wrong in this case. Please guide me through.

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]; 


Have you compiled the .m file into your projct as well?

Just including the .h file only lets the code compile. Without the .m file compiled as well it will crash at runtime with the error you are seeing.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜