# DeviceConnect: IOS
DeviceConnect IOS SDK enables the collection of anonymized, non-PII data from user devices, ensuring compliance with privacy policies by obtaining explicit user consent before initiating data sync processes.
# Requirements
Device Connect IOS SDK works on IOS 16.1 and Xcode 14.1.
# Adding Dependency
Add the SDK to the application using Swift Package Manager (Preferred) or Cocopods.
- Swift Package Manager
- CocoaPods
In Xcode, select File > Add Packages...
Enter the Risk Manager URL (opens new window) for this repository
NOTE
Following will be shared by FinBox team at the time of integration:
CLIENT_API_KEY
# Create User
To create a user, call the createUser method with the following arguments:
- Client API Key
- Customer ID
IMPORTANT
CUSTOMER_IDMust be alphanumeric (no special characters).- Should not exceed 64 characters.
- Must not be
nullor an empty string"".
The response to this method (success or failure) can be captured using the callback.
- Swift
Finbox.createUser(apiKey: "API_KEY", customerId: "CUSTOMER_ID") { token in
// Authentication is success
} error: { code in
// Authentication failed
}
You can read about the errors in the Error Codes section.
# Start Periodic Sync
The startPeriodicSync method should be invoked only after receiving a successful response from the createUser method callback. This method initiates background syncing for all data sources based on the permissions granted by the user. Data is synced at regular intervals in the background, ensuring continuous and seamless data collection.
- Swift
let finbox = FinBox()
finbox.startPeriodicSync()
RECOMMENDATION
To handle cross-login scenarios:
When a user logs back into the app with fresh credentials:
- Call the
createUsermethod to register the new user. - Follow it by
startPeriodicSyncto resume data syncing for the new user. Even though the SDK automatically adapts to a new user, this approach minimizes potential delays in syncing during the first session
# Cancel Periodic Sync
Make sure to cancel data synchronization tasks when the user logs out of the app by using the stopPeriodicSync method. This ensures that no background sync operations continue unnecessarily, maintaining data security.
- Swift
finbox.stopPeriodicSync()
# Handle Sync Frequency
By default sync frequency is set to 8 hours, you can modify it by passing preferred time in seconds as an argument to setSyncFrequency method once the user is created.
- Swift
finbox.setSyncFrequency(12 * 60 * 60)
# Reset User Data
If you need to clear a user's data stored on the device and initiate a fresh data sync, use the resetData method. This ensures that all previous data is removed, and syncing starts from scratch.
- Swift
FinBox.resetData()
# Forget User
If a user requests to be forgotten, use the forgetUser method. This will delete all user details from our system, ensuring this meets digital guidelines for right to be forgotten.
- Swift
FinBox.forgetUser()
← Web Error Codes →