Request the one-time delivery of the user’s current location.
- iOS 9.0+
- tvOS 9.0+
- watchOS 2.0+
This method returns immediately. Calling it causes the location manager to obtain a location fix (which may take several seconds) and call the delegate’s
location method with the result. The location fix is obtained at the accuracy level indicated by the
desired property. Only one location fix is reported to the delegate, after which location services are stopped. If a location fix cannot be determined in a timely manner, the location manager calls the delegate’s
location method instead and reports a
Use this method when you want the user’s current location but do not need to leave location services running. This method starts location services long enough to return a result or report an error and then stops them again. Calling the
allow method cancels any pending request made using this method. Calling this method while location services are already running does nothing. To cancel a pending request, call the
If obtaining the desired accuracy would take too long, the location manager delivers a less accurate location value rather than reporting an error.
When using this method, the associated delegate must implement the
location methods. Failure to do so is a programmer error.