2016-10-06 62 views
0

我有一个webview html5页面does not work in ios 10我不加载用户位置,在ios9及以下工作的应用程序。我没有在ios10的safari上找到我的位置http://html5demos.com/geo,我尝试了3种不同的手机,我是否错过了或为ios 10做了些改变?见下文ios 10 webview xcode swift geolocation

import UIKit 
import CoreLocation 

class ViewController: UIViewController, CLLocationManagerDelegate { 


    let locationManager = CLLocationManager() 

    @IBOutlet weak var webview: UIWebView! 


    override func viewDidLoad() { 
     super.viewDidLoad() 

     self.locationManager.delegate = self 
     self.locationManager.desiredAccuracy = kCLLocationAccuracyBest 
     self.locationManager.requestWhenInUseAuthorization() 
     self.locationManager.startUpdatingLocation() 


     let url = NSURL (string: "http://html5demos.com/geo"); 
     let requestObj = NSURLRequest(url: url! as URL); 
     webview.loadRequest(requestObj as URLRequest); 
    } 





    override func didReceiveMemoryWarning() { 
     super.didReceiveMemoryWarning() 
     // Dispose of any resources that can be recreated. 
    } 
} 
+0

嘿科里,你有没有解决这个问题? – MattJHoughton

回答

0

代码由于可用于SSL连接的iOS 10 HTML5地理位置(HTTPS)只。例如,你可以尝试

let url = NSURL (string: "https://maps.google.com")

,它应该为你工作。

相关问题