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

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];
Hello, buddy!稿源:Hello, buddy! (源链) | 关于 | 阅读提示

本站遵循[CC BY-NC-SA 4.0]。如您有版权、意见投诉等问题,请通过eMail联系我们处理。
酷辣虫 » 移动开发 » Unable to write JSONValue in NSDictionary – JSON Framework does not work

喜欢 (0)or分享给?

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

使用声明 | 英豪名录