0
내 프로젝트가 시작될 때 사용자 위치에서 mapview를 사용하고 있었지만 시작시 사용자가 확대되지는 않습니다. 이 문제를 어떻게 해결할 수 있습니까? 코드는 내가 사용신속한 사용자 위치 문제
self.Locationmanager.delegate = self
self.Locationmanager.desiredAccuracy = kCLLocationAccuracyBest
self.Locationmanager.requestWhenInUseAuthorization()
self.Locationmanager.startUpdatingLocation()
self.Mapview.showsUserLocation = true
Mapview.setCenterCoordinate(Mapview.userLocation.coordinate, animated: true)
기능
func locationManager(manager: CLLocationManager, didUpdateLocations locations:[MKUserLocation]) {
let latitude = Locationmanager.location?.coordinate.latitude
let longitude = Locationmanager.location?.coordinate.longitude
let center = CLLocationCoordinate2D (latitude: latitude!, longitude: longitude!)
let region = MKCoordinateRegion (center: center, span: MKCoordinateSpan (latitudeDelta: 0.02, longitudeDelta: 0.02))
self.Mapview.setRegion(region, animated: true)
self.Locationmanager.stopUpdatingLocation()
과의 Info.plist
NSLocationWhenInUseUsageDescription
,691 클래스의 viewDidLoad에서
class MapViewController: UIViewController, MKMapViewDelegate, CLLocationManagerDelegate
var Locationmanager = CLLocationManager()
에서
음, 사용자 위치에 대한 권한을 요청해야합니다. 시도하고 제거하고 무슨 문제가 있는지 확인하십시오. – Adam
시작시 사용자 위치를 확대하지 못하고 있습니다 .. – Adam
Nope가 해결하지 못했습니다 .. 다른 사용자 위치를 찾는 코드? – Adam