objective c - Facebook json data error, cocoa error 3840 -
i'm trying data facebook, i'm getting error when try parse data dictionary:
mistake: error domain=nscocoaerrordomain code=3840 "the operation couldn’t completed. (cocoa error 3840.)" (no value.) userinfo=0x144ad420
this code:
nsstring *query = @"select page_id, type page_fan uid = me() "; // set query parameter nsdictionary *queryparam = @{ @"q": query }; // make api request uses fql [fbrequestconnection startwithgraphpath:@"/fql" parameters:queryparam httpmethod:@"get" completionhandler:^(fbrequestconnection *connection, id results, nserror *error) { if (error) { nslog(@"error: %@", [error localizeddescription]); } else { bool can = [nsjsonserialization isvalidjsonobject:results]; nslog(@"can %d", can); nserror *mistake; nsdictionary *first = [nsjsonserialization jsonobjectwithdata:results options:0 error:&mistake]; if (mistake) { nslog(@"mistake: %@", mistake); } else { nslog(@"no mistake"); }
the can identifier returns '1' i'm assuming error not data facebook providing.
the data facebook returning fine, sample of results:
data = ( { "page_id" = 253370381511811; type = "public figure"; }, { "page_id" = 148389618201; type = "local business"; }, { "page_id" = 213631462169238; type = community; }
i don't know library, code wrote cannot possibly work.
isvalidjsonobject method checks whether have object can serialised json, nsarray or nsdictionary containing keys , values can serialised json.
jsonobjectwithdata method takes nsdata object , deserialises nsarray or nsdictionary.
since nsdata object fail in isvalidjsonobject, , nsdictionary or nsarray never valid input jsonobjectwithdata, 1 of these calls must fail.
Comments
Post a Comment