0
我试图添加一个启动按钮,开始了我的导航和找到我的当前位置,但在按下我的按钮后没有任何反应? 任何帮助将不胜感激!添加启动按钮位置服务[雨燕3.0 - Xcode中]
注:地图不加载,但的LocationManager函数什么都不做,它就像它没有被按下。
继承人我的代码:
import UIKit
import MapKit
import CoreLocation
class ThirdViewController: UIViewController , CLLocationManagerDelegate{
let manager = CLLocationManager()
func START(){
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
let location = locations[0]
let span:MKCoordinateSpan = MKCoordinateSpanMake(0.01,0.01) //shows the size of map screen
let myLocation:CLLocationCoordinate2D = CLLocationCoordinate2DMake(location.coordinate.latitude,location.coordinate.longitude)
let region:MKCoordinateRegion = MKCoordinateRegionMake(myLocation, span)
map.setRegion(region, animated: true)
self.map.showsUserLocation = true
}
}
@IBAction func STARTNAV(_ sender: UIButton) {
START()
}
您已经添加了'隐私的委托方法 - 位置当在您的info.plist中使用使用说明? –
是的,一切正常,直到我尝试用按钮操作它 –