---
title: "requestHistoricalLocations(purposeKey:sampleCount:completionHandler:)"
framework: corelocation
role: symbol
role_heading: Instance Method
path: "corelocation/cllocationmanager/requesthistoricallocations(purposekey:samplecount:completionhandler:)"
---

# requestHistoricalLocations(purposeKey:sampleCount:completionHandler:)

## Declaration

```swift
func requestHistoricalLocations(purposeKey: String, sampleCount: Int, completionHandler handler: @escaping @Sendable ([CLLocation], (any Error)?) -> Void)
```

```swift
func historicalLocations(purposeKey: String, sampleCount: Int) async throws -> [CLLocation]
```

## Discussion

Discussion important: You can call this method from synchronous code using a completion handler, as shown on this page, or you can call it as an asynchronous method that has the following declaration: func historicalLocations(purposeKey: String, sampleCount: Int) async throws -> [CLLocation] For information about concurrency and asynchronous code in Swift, see Calling Objective-C APIs Asynchronously.
