# iOS

### Summary

* Improvements with new IMSBluetooth and Devices modules
* Support for named driver api
* Improvements on wedge trip detection
* Fetch average scoring and aggregate scoring using vehicle id

### New features

* Named driver api and Scoring api with vehicle id
* **AppMisuse:**
  * Needs to update customer’s Info.plist file for using the Background scheduler implemented in SDK for app misuse event.
    * **Required permissions and configuration**

      * **Permissions:**
        * Background app refresh required

      ```xml
      <key>BGTaskSchedulerPermittedIdentifiers</key>
      <array>
      <string>com.ims.appMisuseBgTaskScheduler</string>
      </array>
      ```

      * Also need to add background fetch to background modes

      ```xml
      <array>
      <string>fetch</string>
      </array>
      ```
  * Needs to call `AppMisuseManager.enableAppMisuse()` in didFinishLaunching of AppDelegate.swift to enable the scheduler
    * **Limitations:**
      * Doesn’t give 100% result due to OS restrictions of allowing the background task to be executed every time.
* **Log scheduler:**
  * Needs to update customer’s Info.plist file if need to enable log scheduler
    * **Required permissions and configuration**
      * **Permissions:**

        * Background app refresh required

        ```xml
        <key>BGTaskSchedulerPermittedIdentifiers</key>
        <array>
        <string>com.ims.logUploaderBgTaskScheduler</string>
        </array>
        ```
      * Also need to add background processing to background modes

        ```xml
        <array>
        <string>processing</string>
        </array>
        ```
  * Needs to call TripDetectionManager.enablelogScheduler() in didFinishLaunching of AppDelegate.swift to enable the scheduler
    * **Bug/Limitations:**
      * Doesn’t upload logs most of the times due to OS restriction and interval hours set 24 hours.

### Breaking changes

* iOS minimum version is 13 now, 12 no longer supported
* The invitation api has changed for responding to the invitation.
  * Now accepts two more parameters in the api call → vehicleId and accountId. It's optional so can be passed nil. If both passed nil then it will use default query with InvitationType=ACCOUNT

<pre class="language-swift" data-overflow="wrap"><code class="lang-swift">InvitationService.respondToInvitation(toUserId userId: String,
                                      invitationId: String,
<strong>                                      vehicleId: String? = nil,
</strong>                                      accountId: String? = nil,
                                      response: Invitation.Response,
                                      then completionHandler: @escaping ResultHandler&#x3C;Void>)
</code></pre>
