Vamshi Krishna Vamshi Krishna - 4 months ago 10
iOS Question

Maps not being shown in webview- iOS

I have a button in my view. On clicking it leads to a webview in which I want to show the maps. The code I am using is:

- (void)viewWillAppear:(BOOL)animated{
NSString *url = [@"" stringByAppendingString:self.address];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
NSURLRequest *metricsRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:url]];
_webViewForLocation.delegate = self;
[_webViewForLocation loadRequest:metricsRequest];
NSLog(@"Maps String: %@", url);

But the webview is blank. HOw do I show maps in it?



- (void)viewDidLoad
[super viewDidLoad];

[_webViewForLocation loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@""]]]];  // here pass your string

- (void)webViewDidStartLoad:(UIWebView *)webView
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;

- (void)webViewDidFinishLoad:(UIWebView *)webView


- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;

the output is

enter image description here

refers this document,