In mapKit frame work, how to get current user location



In mapKit frame work, how to get current user location..

Answer / Dharmendra Kumar Singh

To get the current user's location in MapKit, you can use CLLocationManager. Here is a simple example:nn```swiftnimport MapKitnnclass ViewController: UIViewController {n let locationManager = CLLocationManager()nn override func viewDidLoad() {n super.viewDidLoad()nn locationManager.requestWhenInUseAuthorization()nn locationManager.delegate = selfnn if CLLocationManager.locationServicesEnabled() {n locationManager.startUpdatingLocation()n }n}n}n```nnYou should also adhere to the CLLocationManagerDelegate protocol and implement required methods such as locationManager(_:didUpdateLocations:) and locationManager(_:didFailWithError:).

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Apple iOS Interview Questions

Enlist frameworks for cocoa?

1 Answers  


Can viewdidload be called multiple times?

1 Answers  


What are the ios devices?

1 Answers  


Which language is used in ios?

1 Answers  


Explain difference between coredata & sqlite?

1 Answers  


What is the biggest change with ios 7?

1 Answers  


What is urlsession?

1 Answers  


What are all the difference between iOS3, iOS4 and iOS5?

1 Answers   UGC Corporation,


Whats the difference between frame and bounds?

1 Answers  


what are fetched properties?

1 Answers  


What is a serial queue?

1 Answers  


Explain the difference between copy and retain?

1 Answers  


Categories