LogoLogo
ProductsUse casesDocsSupport
  • Introducing DriveKit
  • DriveKit Guides
  • Get started with drivekit
    • Trip recording lifecycle
    • iOS
      • 🚀Quick start
      • Advanced configurations
      • References
      • iOS DriveKit Demo App
    • Android
      • 🚀Quick start
      • Advanced configurations
      • References
      • Android DriveKit Demo App
      • Android 15 Migration guide
      • Android 14 Migration guide
      • Troubleshooting
  • Trip analysis
    • Introduction
    • iOS
      • Permissions
      • Trip management
      • TripListener
      • Crash Detection
      • Beacon usage
      • Bluetooth usage
      • Custom metadata
      • References (iOS)
    • Android
      • Runtime permissions
      • Trip management
      • TripListener
      • Crash Detection
      • Beacon usage
      • Bluetooth usage
      • Custom metadata
      • References (Android)
    • User interface
      • iOS
        • Get started
        • Working hours
        • Driver alert in case of crash
        • Trip recording widget
        • Location sharing
      • Android
        • Get started
        • Working hours
        • Driver alert in case of crash
        • Trip recording widget
        • Location sharing
    • REST services
      • Trip
      • References
    • Trip Simulator
      • iOS
      • Android
  • PERMISSIONS UTILS
    • Introduction
    • User interface
      • iOS
        • Get started
        • Main configurations
      • Android
        • Get started
        • Main configurations
  • COMMON UI
    • Introduction
    • iOS
      • Get started
    • Android
      • Get started
    • References
  • DRIVER DATA
    • Introduction
    • iOS
      • Get started
      • References (iOS)
    • Android
      • Get started
      • References (Android)
    • User interface
      • iOS
        • Get started
        • Advanced configurations
        • Trips widgets
        • My Synthesis
        • My Driver Profile
      • Android
        • Get Started
        • Advanced configurations
        • Trips widgets
        • My Synthesis
        • My Driver Profile
  • Driver Data Timeline UI
    • Introduction
    • iOS
      • Get started
    • Android
      • Get started
  • Vehicle
    • Introduction
    • iOS
      • Get started
      • Vehicle management
      • Beacon management
      • Bluetooth device management
      • Odometer
      • References (iOS)
    • Android
      • Get started
      • Vehicle management
      • Beacon management
      • Bluetooth device management
      • Odometer
      • References (Android)
    • User interface
      • iOS
        • Get started
        • Main configurations
        • Advanced configurations
      • Android
        • Get started
        • Main configurations
        • Advanced configurations
  • DRIVER ACHIEVEMENT
    • Introduction
    • iOS
      • Get started
    • Android
      • Get Started
    • User interface
      • iOS
      • Android
  • CHALLENGE
    • Introduction
    • Important challenge rules
    • iOS
      • Get started
      • References (iOS)
    • Android
      • Get started
      • References (Android)
    • User interface
      • iOS
        • Get started
      • Android
        • Get started
  • GROUP
    • Introduction
    • iOS
      • Get started
    • Android
      • Get started
  • React Native
    • Get started
    • Integration
  • Flutter
    • Get started
    • Integration
  • Push services
    • Introduction
    • Push Trip Data
    • Push Deleted trip
    • Push Crash Data
    • Push Diagnosis Data
  • ADMIN SERVICES
    • Beacon
      • Add
      • Replace
      • Delete
      • Configuration
    • Challenges
      • List of challenges
      • Challenge details
      • Registered users
      • Challenge ranking
      • Users' progress
      • Definitions
    • Customer
      • Activity timeline
    • Driver
      • Timeline
      • Synthesis
      • Identity
      • Status
      • Add or update a metadata
      • Vehicles
      • Profile
      • Application diagnoses
    • Drivers
      • Account
      • Statistics
      • Ranking
      • Expired accounts
    • Group
      • Timeline
      • Synthesis
    • Trips
      • Add or update a metadata
      • Delete a metadata
    • Vehicle
      • Create
      • Characteristics
      • Configuration
      • Statistics
      • Update mileage
      • Tire and brake wear update
      • References
  • Crashes
    • Annotate a crash
    • Revoke crash location URL
  • ENTERPRISE SERVICES
    • Introduction
    • Teams
      • Create a team
      • List of teams
      • Enable or disable a team
    • Hyper-admins
      • Create a hyper-admin
      • List of hyper-admins
      • Delete a hyper-admin
    • Monitoring
      • Get a push trip data report
      • Get a push crash data report
      • Request to retry failed trips
      • Request to retry failed crashes
      • Get the status of a task
  • Release notes
    • Changelog
      • iOS
      • Android
      • UI iOS
      • UI Android
Powered by GitBook
On this page
  • DriveKitDelegate
  • UpdateUserIdStatus
  • RequestError
  • DeleteAccountStatus
  • DKWeather

Was this helpful?

Export as PDF
  1. Get started with drivekit
  2. iOS

References

PreviousAdvanced configurationsNextAndroid

Last updated 1 year ago

Was this helpful?

DriveKitDelegate

DriveKitDelegate is a protocol that can be passed as a parameter during the . It gives useful events about the user lifecycle.

protocol DriveKitDelegate: AnyObject {
    func driveKitDidConnect(_ driveKit: DriveKit)
    func driveKitDidDisconnect(_ driveKit: DriveKit)
    func driveKit(_ driveKit: DriveKit, didReceiveAuthenticationError error: RequestError)
    func userIdUpdateStatusChanged(status: UpdateUserIdStatus, userId: String?)
    func driveKit(_ driveKit: DriveKit, accountDeletionCompleted status: DeleteAccountStatus)
}
Method
Description

driveKitDidConnect(_ driveKit: DriveKit)

The user has been successfully logged

driveKitDidDisconnect(_ driveKit: DriveKit)

The user has been disconnected (manual logout or the account is disabled/deleted)

driveKit(_ driveKit: DriveKit, didReceiveAuthenticationError error: RequestError)

The login has failed due to a RequestError

userIdUpdateStatusChanged(status: UpdateUserIdStatus, userId: String?)

The update userId request has been processed with a UpdateUserIdStatus state value

onAccountDeleted(status: DeleteAccountStatus)

The delete account request has been processed with a DeleteAccountStatus state value.

UpdateUserIdStatus

UpdateUserIdStatus is an enum that explains the request status after a userId has asked to be changed.

public enum UpdateUserIdStatus: Int {
    case updated
    case failedToUpdate
    case invalidUserId
    case alreadyUsed
    case savedForRepost
}
Value
Description

updated

The userId has been successfully updated

failedToUpdate

Occurs when DriveKit is not configured yet or if the new userId is the same as the old one

invalidUserId

Error returned when the new userId is blank

alreadyUsed

The new userId is already taken by another user

savedForRepost

The request failed but a retry will be done

RequestError

RequestError is an enum that describes the error type of a DriveKit request.

public enum RequestError: Int {
    case noNetwork
    case unauthenticated
    case forbidden
    case serverError
    case clientError
    case limitReached
    case unknownError
}
Value
Description

noNetwork

The user has no connection or a bad one during the request.

unauthenticated

A request has been launched but the user is not logged (401 error).

forbidden

A 403 error occurred. You might don't have access to call that service. Please contact the DriveQuant to learn more.

serverError

Drivequant's backend responds with a 500 server error.

clientError

Drivequant's backend responds with a 400 error different than unauthenticated, forbidden and limitReached

unknownError

An unknown error occurred, please contact the Drivequant team to investigate the issue.

limitReached

The DriveKit API key has reached the accounts number limit. Please contact the Drivequant team.

DeleteAccountStatus

DeleteAccountStatus is an enum that describes the deletion status. It can have 3 values:

  • success: Account deleted successfully

  • failedToDelete: Account not deleted, an error has occurred

  • forbidden: Account deletion not activated for this team

DKWeather

DKWeather is an enum that describe each category of weather during a trip. It can have these values:

  • unknown

  • sun

  • cloud

  • fog

  • rain

  • snow

  • ice

DriveKit Core module initialization