iphone - Difference between the UIWebView methods loadHTMLString: and loadRequest -


i have uiwebview , want load svg image it. contents of file pure svg i.e. <svg>...</svg>. file loads fine normal , mobile safari, , in uiwebview using loadrequest: doing following:

url = [nsurl fileurlwithpath:path]; nsurlrequest *req = [nsurlrequest requestwithurl:url]; [webview loadrequest:req]; 

however, if load contents of file string, , try load html string webview, nothing displays:

html = [nsstring stringwithcontentsoffile:path                                 encoding:nsasciistringencoding                                    error:nil]; [webview loadhtmlstring:html baseurl:nil]; 

is there reason between above 2 techniques? should not give same results? file pure ascii, don't think there encoding issue.

i guess can need done right using file, hate use filesystem non persistent data.

any appreciated!!!

thanks, ron

to solve issue have use loaddata:mimetype:textencodingname:baseurl: instead.

nsdata *data = [html datausingencoding:nsutf8stringencoding]; [webview loaddata:data mimetype:@"application/xhtml+xml" textencodingname:@"utf-8" baseurl:baseurl]; 

Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -