Unable to write JSONValue in NSDictionary – JSON Framework does not work

综合技术 Hello, buddy! (源链)

I am using JSON to receive response and then trying to save it in NSDictionary
. I am using same code in almost 12 clones of same app and its working great. But, in one of my app, I am unable to do this.

NSDictionary *resultsDictionary = [jsonString JSONValue];
    NSString *statusString = [resultsDictionary objectForKey:@"status"];

This a simple two line code and works fine normally, but I don’t know whats going on this time. May be my JSON Framework is not working properly. But I am getting this in JSONValue
:

{
"status": "Success",
"data": [
    {
        "userName": "[email protected]",
        "first_name": "ABC",
        "last_name": "XYZ",
        "gender": "male",
        "userid": 1,
        "membershipStatus": "Active",
        "Saldo": 499.749,
        "Avatar": "no_photo.gif",
        "uniqueCode": "abc234abc234",
        "registerKey": "abc543abc534",
        "eMail": "[email protected]"
    }
]

}

Still, when I execute it, I get this error:

[__NSCFConstantString objectForKey:]: unrecognized selector sent to instance

Because resultDictionay
is empty.

Why resultDictionay
is empty? Any suggestion?

[jsonString JSONValue];

set target dependencies in your project follow by this link

Parsing json in an iOS app

JSONValue is thridParty libiary from SBJson. Apple have in-built framework for convert json use this approach

use this

NSDictionary *response = [NSJSONSerialization JSONObjectWithData:responseData options:kNilOptions error:&error];

您可能感兴趣的

Sending JSON over websockets in Rust I like the JSON format but I feel it’s important to contain it to the job of passing a message from one system to another. Ideally the sender generat...
Getting ‘ bad_request invalid_json’ er... I'm trying to insert a document into CouchDB. While executing this code CouchDB returns the following error: STATUS: 400 BODY: {"error...
AS3 Problem with PHP JSON decoding I am able to pull JSON data from PHP into my Flex application just fine with the following bit of code: public function httpResult(event:ResultEvent...
Golang: Working with JSON We previously wrote an introductory blog post onGolangdescribing why and how the language is gaining traction quickly. Go aka Golang is being used...
Manipulate JSON With SQL And PLSQL Part 3 This post discusses the INSTEAD-OF trigger to imitate updates on a view containing a JSON column. Here is the view and data. -- This is the names vi...
Hello, buddy!责编内容来自:Hello, buddy! (源链) | 更多关于

阅读提示:酷辣虫无法对本内容的真实性提供任何保证,请自行验证并承担相关的风险与后果!
本站遵循[CC BY-NC-SA 4.0]。如您有版权、意见投诉等问题,请通过eMail联系我们处理。
酷辣虫 » Unable to write JSONValue in NSDictionary – JSON Framework does not work



专业 x 专注 x 聚合 x 分享 CC BY-NC-SA 4.0

使用声明 | 英豪名录