Saturday 15 August 2015

ios - NSJSONSerialization json object leads to annoying empty XCode debug variables -



ios - NSJSONSerialization json object leads to annoying empty XCode debug variables -

i'm using nsjsonserialization's jsonobjectwithdata method serialize json response info nsdictionary hierarchy, part of api handling in ios. works great. long standing tedious part when using xcode debugger, nested json info construction not viewable in variable watcher. can best seen in photo @ end. info accessible , navigable in code, isn't debugger.

is there way clean or serialize better?

[nsurlconnection sendasynchronousrequest:urlrequest queue:queue completionhandler:^(nsurlresponse *response, nsdata *data, nserror *error){ if (error){ nslog(@"request error: %@", [error localizeddescription]); if(completionhandler != nil){ completionhandler(nil,error); } } else { nserror *jsonerror = nil; nsdictionary *json = [nsjsonserialization jsonobjectwithdata:data options:0 error:&jsonerror]; if(jsonerror) { nslog(@"json serialize error: %@", [jsonerror localizeddescription]); if(completionhandler != nil){ completionhandler(nil,jsonerror); } } else { if(completionhandler != nil){ completionhandler(json,nil); // usual successful json route } } } }];

try using afneteorking serialization. https://github.com/afnetworking/afnetworking

it might help. if not can print ever need in console part of debugger using po.

po object

for illustration

ios json xcode debugging serialization

No comments:

Post a Comment