iphone - uiwebview not loading the web page -


in program uiwebview not loading url address.when nslogged request object not null.however when nslog webview.request returns null.what may reason not loading

 - (void)viewdidload {         [super viewdidload];          self.web = [[uiwebview alloc] init];         nsstring *urladdress = @"http://www.google.com";         nsurl *url = [nsurl urlwithstring:urladdress];         nsurlrequest *requestobj = [nsurlrequest requestwithurl:url];          nslog(@"%@",requestobj);         [self.web loadrequest:requestobj];         [web setframe:cgrectmake(0, 0, 320, 370)];         nslog(@"%@   %@",self.web,self.web.request);       } 

the nslog results

<nsurlrequest http://www.google.com>  <uiwebview: 0xbb17ff0; frame = (0 0; 320 370); layer = <calayer: 0xbb12f20>>   (null) 

as per suggestions site changed ib , made code .i made class confirm uiwebview delegate..both webviewdidstart , webview did finish being called these nslog outputs these methods

webviewdidstart

webview-----><nsmutableurlrequest > webview-----><nsmutableurlrequest http://www.google.com> 

webview did finish

webview-finished----><nsmutableurlrequest http://www.google.com> webview-finished----><nsmutableurlrequest http://www.google.com> 

still nothing being called , think both these methods called twice

this working code, test out in application , let know outcome

in .h file, add uiwebviewdelegate

in .m file's viewdidload, add this:

uiwebview *webview=[[uiwebview alloc] initwithframe:cgrectmake(0.0,0.0,320.0,460.0)]; nsurl *url = [nsurl urlwithstring:@"http://www.google.com"]; nsurlrequest *requestobj = [nsurlrequest requestwithurl:url]; webview.delegate = self; [webview loadrequest:requestobj]; [self.view addsubview:webview]; 

now check in delegates if page loading or not:

- (void)webviewdidstartload:(uiwebview *)webview {         nslog(@"page loading");         }  -(void)webviewdidfinishload:(uiwebview *)webview {        nslog(@"finished loading");  } 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -