---
title: "mapView(_:didFailToLocateUserWithError:)"
framework: mapkit
role: symbol
role_heading: Instance Method
path: "mapkit/mkmapviewdelegate/mapview(_:didfailtolocateuserwitherror:)"
---

# mapView(_:didFailToLocateUserWithError:)

Tells the delegate when an attempt to locate the user’s location fails.

## Declaration

```swift
optional func mapView(_ mapView: MKMapView, didFailToLocateUserWithError error: any Error)
```

## Parameters

- `mapView`: The map view that’s tracking the user’s location.
- `error`: An error object containing the reason why location tracking fails.

## See Also

### Tracking the user’s location

- [mapViewWillStartLocatingUser(_:)](mapkit/mkmapviewdelegate/mapviewwillstartlocatinguser(_:).md)
- [mapViewDidStopLocatingUser(_:)](mapkit/mkmapviewdelegate/mapviewdidstoplocatinguser(_:).md)
- [mapView(_:didUpdate:)](mapkit/mkmapviewdelegate/mapview(_:didupdate:).md)
- [mapView(_:didChange:animated:)](mapkit/mkmapviewdelegate/mapview(_:didchange:animated:).md)
