Amateur developer here again. If it's not one thing, it's another. I conceded defeat to setting up my own push notifications, but this new problem is a deal breaker. I'm using UIWebView to display an updated app page on my server. It looks just like a page in the app, but I'm using web view to easily update the page in the background from my server. On this page is an image map with a link to "http://maps.apple.com/?q=&daddr=xxxxxxxxxx&saddr=current,+location".
Opening from Safari on OS X and iOS both kick out to the Apple maps app like they should. However, inside of my UIWebView, the web version of google maps is loaded (with the wrong location). Why? I'm using Apple's maps link. I have no problem using google maps, but I would prefer to automatically kick out to Apple Maps. My code for this part looks like this:
Notice the 'if' statement on the end, which I got from stackOverflow, that is supposed to be handling my URL request and pushing it to apple maps, yes? Why isn't it doing what it's supposed to be doing?
I would be okay with using Google Maps the way it is, if the user's location was correct, but I've tried legitimate methods for using CoreLocation and they don't seem to affect UIWebView anyway. So I just want to kick out to Apple Maps from my webpage and make this easy on myself. How do I do it? What am I doing wrong? Why is UIWebView so finicky?
Opening from Safari on OS X and iOS both kick out to the Apple maps app like they should. However, inside of my UIWebView, the web version of google maps is loaded (with the wrong location). Why? I'm using Apple's maps link. I have no problem using google maps, but I would prefer to automatically kick out to Apple Maps. My code for this part looks like this:
Code:
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
NSURL *url = [NSURL URLWithString:@"http://xxxxxxxx.com/eesales/sample/index.html"];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[_webView loadRequest:request];
if (([url.scheme isEqualToString:@"http"] || [url.scheme isEqualToString:@"https"]) && [url.host isEqualToString:@"maps.apple.com"]) { //it's an apple maps app request
NSLog(@"Attempting Apple Maps app open");
[[UIApplication sharedApplication]openURL:url];
}
}
Notice the 'if' statement on the end, which I got from stackOverflow, that is supposed to be handling my URL request and pushing it to apple maps, yes? Why isn't it doing what it's supposed to be doing?
I would be okay with using Google Maps the way it is, if the user's location was correct, but I've tried legitimate methods for using CoreLocation and they don't seem to affect UIWebView anyway. So I just want to kick out to Apple Maps from my webpage and make this easy on myself. How do I do it? What am I doing wrong? Why is UIWebView so finicky?