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]; 

also please check these answer1, answer2


Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -