. 그래서 이슈는 변수 GMSMapView
과 CLLocationManager
의 초기화와 관련이 있습니다. 이것은 나를 위해 일한 방법은 다음과 같습니다
나는
private var locationManager: CLLocationManager!
private var googleMapView: GMSMapView!
아래와 같이 ViewController
클래스의 변수를 정의 그리고 viewDidLoad()
에 내가 메인 스레드에서 실행하는 DispatchQueue
을 소개했다.
DispatchQueue.main.async {
//adding mapView
self.googleMapView = GMSMapView()
self.view.addSubview(self.googleMapView)
self.googleMapView.translatesAutoresizingMaskIntoConstraints = false
//auto layout constraints
self.googleMapView.topAnchor.constraint(equalTo: self.view.topAnchor, constant: 0).isActive = true
self.googleMapView.rightAnchor.constraint(equalTo: self.view.rightAnchor, constant: 0).isActive = true
self.googleMapView.leftAnchor.constraint(equalTo: self.view.leftAnchor, constant: 0).isActive = true
self.googleMapView.bottomAnchor.constraint(equalTo: self.view.bottomAnchor, constant: 0).isActive = true
//location manager setup
self.locationManager = CLLocationManager()
self.locationManager.delegate = self
self.locationManager.startUpdatingHeading()
}
@ 존 Welliem ....이 링크 https://www.3pillarglobal.com/insights/blocks-ios-introduction-to-grand-central-dispatch –
이를 참조하시기 바랍니다 HTTPS를 참조하시기 바랍니다 : //www.appcoda.com/ios-concurrency/ –
좀 더 구체적 인 대답은 많이 감사하겠습니다. –