> For the complete documentation index, see [llms.txt](https://docs.drivequant.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.drivequant.com/stolen-vehicle-locator/ios.md).

# iOS

## Prerequisite

Before integrating this module, ensure the following are in place:&#x20;

* The DriveKit SDK is initialized and a user has been created.
* The Trip Analysis component is strongly recommended, as iBeacon detection is significantly enhanced during trip analysis — the scan mode is more efficient and the coverage range is greater.&#x20;

Additionally, iBeacon and location detection require Always On exact location access, as well as the Location and Bluetooth sensors to be enabled on the device. <br>

## Integration

To add the Stolen Vehicle Locator module to your app using **Swift Package Manager**, add `DriveKitStolenVehicleLocator` from repository: `https://github.com/DriveQuantPublic/drivekit-sdk-spm.git` as dependency.

{% hint style="info" %}
The Stolen Vehicle Locator module is available on iOS starting with DriveKit version 3.2.0.
{% endhint %}

## Initialization

If you have [disabled the SDK auto-initialization](/get-started-drivekit/ios/advanced-configurations.md#manually-initialize-the-sdk), an initialization phase is required to use the feature included in the Stolen Vehicle Locator module. In the application's AppDelegate file, import `DriveKitStolenVehicleLocator`:

```swift
import DriveKitStolenVehicleLocatorModule
```

Then, to initialize Stolen Vehicle Locator module in your app, you must call the initialization method in `didFinishLaunchingWithOptions` method of your AppDelegate file.

```swift
import DriveKitCoreModule
import DriveKitTripAnalysisModule
import DriveKitStolenVehicleLocatorModule

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    DriveKit.shared.initialize()
    ...
    DriveKitStolenVehicleLocator.shared.initialize()
    ...    
}
```

## Configure UUIDs

The module scans for iBeacon proximity UUIDs.

Up to 5 UUIDs can be registered. UUIDs must be added one at a time.

UUIDs can be added or removed at any time — an active scan restarts automatically with the updated list.

{% hint style="info" %}
&#x20;iOS enforces a hard limit of 20 regions (UUIDs) per app, shared across all sources. To preserve this capacity for other uses within your app, the Stolen Vehicle Locator component limits the number of registered UUIDs to 5.&#x20;
{% endhint %}

### Add a UUID

Registers a new UUID in the scan list.

{% code overflow="wrap" %}

```swift
public func addUuid(_ uuid: String, completion: @escaping (_ result: DKAddUuidResult) -> Void)
```

{% endcode %}

It takes an uuid parameter in String format, and triggers a callback which is a Swift enum named DKAddUuidResult with associated values:

<table><thead><tr><th width="269.875">Value</th><th>Description</th></tr></thead><tbody><tr><td>success</td><td>UUID is valid and added to the list.</td></tr><tr><td>error(DKAddUuidErrorType)</td><td>UUID could not be added. See error type below.</td></tr></tbody></table>

**DKAddUuidErrorType**

<table><thead><tr><th width="269.75">Value</th><th>Description</th></tr></thead><tbody><tr><td>driveKitNotInitialized</td><td>DriveKit has not been initialized yet.</td></tr><tr><td>invalidUuidFormat</td><td>The provided UUID has an invalid format.</td></tr><tr><td>uuidAlreadyAdded</td><td>This UUID is already in the list.</td></tr><tr><td>totalUuidLimitReached</td><td>The 5-UUID maximum has been reached.</td></tr></tbody></table>

{% hint style="info" %}

* Only the UUID is required — no Major or Minor values are needed. Stolen vehicle management is handled entirely server-side: once a smartphone detects a beacon matching a monitored UUID, the backend cross-references the beacon's Major and Minor values to identify the vehicle and trigger the appropriate alerts.
* UUIDs must follow the standard format defined by Apple for iBeacon proximity regions: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx (8-4-4-4-12 hexadecimal characters, separated by hyphens). See [Apple's CLBeacon.uuid documentation](https://developer.apple.com/documentation/corelocation/clbeacon/uuid) for details.
* Letters must be lowercase. If uppercase letters are provided, they will be automatically converted before the UUID is stored.
  {% endhint %}

### Remove a UUID

Removes a UUID from the scan list. If the list becomes empty, scanning stops automatically.

{% code overflow="wrap" %}

```swift
public func removeUuid(_ uuid: String, completion: @escaping (_ result: DKRemoveUuidResult) -> Void)
```

{% endcode %}

It takes an uuid parameter in String format, and triggers a callback which is a Swift enum named DKRemoveUuidResult with associated values:

<table><thead><tr><th width="269.875">Value</th><th>Description</th></tr></thead><tbody><tr><td>success</td><td>UUID is valid and removed from the list.</td></tr><tr><td>error(DKRemoveUuidErrorType)</td><td>UUID could not be added. See error type below.</td></tr></tbody></table>

**DKRemoveUuidErrorType**

<table><thead><tr><th width="269.75">Value</th><th>Description</th></tr></thead><tbody><tr><td>driveKitNotInitialized</td><td>DriveKit has not been initialized yet.</td></tr><tr><td>invalidUuidFormat</td><td>The provided UUID has an invalid format.</td></tr><tr><td>uuidNotFound</td><td>This UUID is not in the list.</td></tr></tbody></table>

### Get the UUID list

Retrieves the current list of registered UUIDs.

{% code overflow="wrap" %}

```swift
public func getUuids(completion: @escaping (_ result: DKGetUuidListResult) -> Void)
```

{% endcode %}

Returns a DKGetUuidListResult enum via callback:

<table><thead><tr><th width="269.5">Value</th><th>Description</th></tr></thead><tbody><tr><td>success([String])</td><td>UUID list retrieved successfully. The array may be empty if no UUIDs have been registered.</td></tr><tr><td>error(DKGetUuidListErrorType)</td><td>List could not be retrieved. See error type below.</td></tr></tbody></table>

**DKGetUuidListErrorType**

<table><thead><tr><th width="269.75">Value</th><th>Description</th></tr></thead><tbody><tr><td>driveKitNotInitialized</td><td>DriveKit has not been initialized yet.</td></tr></tbody></table>

## Configure iBeacon search

### Enable iBeacon search

Enable the search for iBeacon signals matching the registered UUID list.

{% code overflow="wrap" %}

```swift
public func enableScan(completion: @escaping (_ result: DKEnableScanResult) -> Void)
```

{% endcode %}

**DKEnableScanResult**

<table><thead><tr><th width="269.875">Value</th><th>Description</th></tr></thead><tbody><tr><td>success</td><td>Scan successfully enabled.</td></tr><tr><td>error(DKEnableScanErrorType)</td><td>Scan could not be enabled. See error type below.</td></tr></tbody></table>

**DKEnableScanErrorType**

<table><thead><tr><th width="269.75">Value</th><th>Description</th></tr></thead><tbody><tr><td>driveKitNotInitialized</td><td>DriveKit has not been initialized yet.</td></tr><tr><td>userNotConnected</td><td>No authenticated user found.</td></tr><tr><td>scanAlreadyEnabled</td><td>The scan has already been enabled.</td></tr></tbody></table>

### Disable iBeacon search

Disable the search for iBeacon signals matching the registered UUID list.

{% code overflow="wrap" %}

```swift
public func disableScan(completion: @escaping (_ result: DKDisableScanResult) -> Void)
```

{% endcode %}

**DKDisableScanResult**

<table><thead><tr><th width="269.875">Value</th><th>Description</th></tr></thead><tbody><tr><td>success</td><td>Scan successfully enabled.</td></tr><tr><td>error(DKDisableScanErrorType)</td><td>Scan could not be enabled. See error type below.</td></tr></tbody></table>

**DKDisableScanErrorType**

<table><thead><tr><th width="270.375">Value</th><th>Description</th></tr></thead><tbody><tr><td>driveKitNotInitialized</td><td>DriveKit has not been initialized yet.</td></tr><tr><td>userNotConnected</td><td>No authenticated user found.</td></tr><tr><td>scanAlreadyDisabled</td><td>The scan has already been disabled.</td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.drivequant.com/stolen-vehicle-locator/ios.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
