ios - NSData return nil when parse html -
i want information website "http://phim14.net/". use code :
nsurl *url = [nsurl urlwithstring:@"http://phim14.net/"];      nserror *error;      nsdata *htmldata = [nsdata datawithcontentsofurl:url options:nsdatareadinguncached error:&error];      tfhpple *parser = [tfhpple hpplewithhtmldata:htmldata]; at beginning code working , can info. after several times trying met error "htmldata" return nil, think website down can connect webpage using firefox. try parse other website it's still ok? try print out error , said that
`"error nserror *   domain: @"nscocoaerrordomain" - code: 256   0x00007fbb224023c0"` someone please me figure out problem??
it seems errorcode 256 doesn't have description. safe way data url,  use method  sendsynchronousrequest:returningresponse:error: nsurlconnection.
nsdata* data = [nsurlconnection sendsynchronousrequest:[nsurlrequest requestwithurl:url cachepolicy:nsurlrequestreloadignoringcachedata timeoutinterval:30] returningresponse:nil error:&error]; 
Comments
Post a Comment