我在我的应用程序中有一个UIWebView,它加载了一个网站,该网站试图获取用户的当前GPS位置。在Safari中,它会弹出一个窗口询问是否要向该网站提供您的当前位置,但在我的UIWebView中却没有任何反应,我的网站无法获取用户的GPS位置。我该如何解决这个问题?我是iOS开发的新手,如果这很容易做到,请耐心等待,但我迄今为止找不到示例。
这是我目前所拥有的:
ViewController.h
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController {
IBOutlet UIWebView *_webView;
}
@end
ViewController.m
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
[_webView loadRequest:[[NSURLRequest alloc] initWithURL:[[NSURL alloc] initWithString:@"http://google.com"]]];
// Do any additional setup after loading the view, typically from a nib.
}
- (IBAction)goBack:(id)sender {
if ([_webView canGoBack]) {
[_webView goBack];
}
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end