SBJSON parsing NSString to NSDictionary

六眼飞鱼酱① 提交于 2019-12-06 14:17:48

The important part of the error message is this:

-[__NSCFString JSONValue]: unrecognized selector sent to instance 0x6ab7a40

The __NSCFString class is the private implementation class for the NSString interface, so you can just pretend it says NSString.

So we see that you are sending the JSONValue message to an NSString, and the NSString says it doesn't recognize that selector. The SBJson library adds a JSONValue method to the NSString class using a category.

So I deduce that you haven't linked NSObject+SBJson.o into your app. If you copied the SBJson source files into your app, make sure you copied in NSObject+SBJson.m, and make sure it is included in the “Compile Sources” build phase of your target.

If you built an SBJson library and are linked your app to that, you may need to add the -ObjC flag to your linker options, or even the -all_load flag.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!