objective c - Parsing JSON from PHP by SBJson -
now i'm trying post jpeg files mysql via php , mysql ios.
in method encode jpeg(as nsdata) , related data(ex. caption, timestamp) json on php script using json_encode().
{"caption":"(captiondata)","img":"(imagedata)","timestamp":"(timestampdata)"} then set datas array like,
[{"caption":"(captiondata)","img":"(imagedata)","timestamp":"(timestampdata)"}, {"caption":"(captiondata)","img":"(imagedata)","timestamp":"(timestampdata)"}, ......., {"caption":"(captiondata)","img":"(imagedata)","timestamp":"(timestampdata)"}] i believe can parse , json echo (json_encode ()) on php , sbjsonparser on ios nothing returns app. here's code in ios.(also use tturlrequest three20)
tturlrequest* request = [tturlrequest requestwithurl:url delegate:self]; request.cachepolicy = cachepolicy; tturljsonresponse* response = [[[tturljsonresponse alloc] init] autorelease]; request.response = response; [request send]; - (void)requestdidfinishload:(tturlrequest*)request { tturljsonresponse* response = request.response; nslog(@"%@",response); }
can print logs in requestdidfinishload:?
the response rootobject of tturljsonresponse.
- (void)requestdidfinishload:(tturlrequest*)request { tturljsonresponse *response = request.response; nsdictionary *dict = response.rootobject; nslog(@"dict : %@",dict); } in case,
- (void)requestdidfinishload:(tturlrequest*)request { tturljsonresponse* response = request.response; nslog(@"%@",response); } the response may <tturljsonresponse: 0x125398c0>
if still nothing returns, may check requestdidfinishload: been called , not cache issue.
Comments
Post a Comment