ios - WebView not loading? -


i new objective c. learning segue's , prepareforsegue. have table view random links user has saved. want allow user click on link , taken web view view webpage. however, every time click on link webpage empty.

table view. m

-(void)prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender { if ([[segue identifier] isequaltostring:@"showarticle"]) {      nsindexpath *indexpath = [self.tableview indexpathforselectedrow];      nsstring *urlstring = [nsstring stringwithformat:@"http://%@", _todoitems[indexpath.row]];     [[segue destinationviewcontroller] seturl:urlstring]; 

webview.m

- (void)viewdidload { [super viewdidload];  nsurl *url = [nsurl urlwithstring:[self.url                                    stringbytrimmingcharactersinset:[nscharacterset whitespaceandnewlinecharacterset]]];  nsurlrequest *request = [nsurlrequest requestwithurl:url]; [self.webview loadrequest:[nsurlrequest requestwithurl:[nsurl urlwithstring:[nsstring stringwithformat:@"http://%@", request]]]]; // additional setup after loading view. 

}

add these keys info.plist. in ios 9 must use https:// instead of http://

info.plist

here link configuring app transport security app transport security

make sure urlstring return line must not nil. must valid url working in browser:

nsstring *urlstring = [nsstring stringwithformat:@"http://%@", _todoitems[indexpath.row]]; 

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -