> For the complete documentation index, see [llms.txt](https://docs.sentiance.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sentiance.com/a-complete-integration/ios-sdk/5.-enabling-detections.md).

# 5. Enabling Detections

After creating a Sentiance user, you can enable SDK detections. This will allow the Sentiance SDK to run in the background, and intelligently detect a user's real-world movements, while collecting sensor, location, and motion activity data.

```swift
Sentiance.shared.enableDetections { result, error in
    guard let result = result else {
        NSLog("Failed to enabled detections due to reason \(error!.failureReason)")
        return
    }
    
    NSLog("Successfully enabled detections")
}
```

After detections are successfully enabled, you can determine whether the SDK is able to detect, by checking the detection status:

```swift
switch result.detectionStatus { // or Sentiance.shared.detectionStatus
case .enabledAndDetecting:
    // Detections are enabled and running
case .enabledButBlocked:
    // Detections are enabled but blocked
default:
    // Other enum values don't apply for success scenarios
}
```

If detections are blocked, you can check the SDK status to see what's blocking them. Usually, this is caused by insufficient permissions or a disabled location tracking.

{% hint style="info" %}
**Enabling Detections Is Persistent**

When you enable detections, the SDK will remember this and automatically enable them the next time the app restart. Therefore, you do not need to enable them every time. You only need to make sure that you are [properly initializing the SDK](/a-complete-integration/ios-sdk/initialization.md) during every app startup.
{% endhint %}


---

# 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, and the optional `goal` query parameter:

```
GET https://docs.sentiance.com/a-complete-integration/ios-sdk/5.-enabling-detections.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
