CloudikeContactsKit
SDK for backing up and syncing Cloudike contacts.
Applies to CloudikeContactsKit 1.5.15+
Installation
Cloudike SDKs for iOS are distributed through CocoaPods as prebuilt dynamic XCFrameworks from Cloudike's private pod repository.
1. Set up access (once per machine). Cloudike provides you with a username and a deploy token. Add them to ~/.netrc — both git (to fetch the pod specs over HTTPS) and curl (which CocoaPods uses to download the framework archives) read credentials from this file:
machine git.cloudike.com login <username> password <token>
Make the file readable only by you:
chmod 600 ~/.netrc
2. Add the SDK to your Podfile. Declare the Cloudike pod repository as a source and add CloudikeContactsKit and its required CloudikeCoreKit dependency:
source 'https://git.cloudike.com/cloudike-ios/pod_spec_binary.git'
source 'https://cdn.cocoapods.org/'
platform :ios, '13.0'
use_frameworks!
target 'YourApp' do
pod 'CloudikeContactsKit'
pod 'CloudikeCoreKit'
end
- The
https://cdn.cocoapods.org/source is needed for the SDKs' third-party dependencies (for example, Kingfisher used by CloudikeDocumentWalletKit). use_frameworks!is required — the SDKs are shipped as dynamic frameworks.- The minimum supported iOS version is 13.0.
3. Install the pods:
pod install
Initialization
import UserNotifications
import CloudikeCoreKit
import CloudikeContactsKit
let apiBaseUrl = URL(string: "https://your-api-endpoint.example.com")! // your Cloudike API endpoint
let core = CloudikeCore(apiBaseUrl: apiBaseUrl)
core.applyUser(apiToken: apiToken, userId: userId, deviceId: deviceId) // values from your sign-in flow
let configuration = ContactsConfiguration(
backupNotes: true,
eventDispatcher: nil,
allowRequestPermissions: true,
competition: .init(mode: .standalone, appGroupId: nil, lastActivityMaxInterval: 60),
plannedBackupNotificationId: "com.example.app.contacts-planned-backup", // unique among your app's notifications
// plannedBackupNotificationMinHour / plannedBackupNotificationMaxHour omitted: defaults 10 and 20
plannedBackupNotificationBuilder: { _ in
let content = UNMutableNotificationContent()
content.title = "Back up your contacts"
content.body = "Open the app to back up your contacts."
return content
}
)
CloudikeContacts.shared.configure(core: core, configuration: configuration)
Creates a CloudikeCore session and authenticates it, then configures the CloudikeContacts singleton with it. allowRequestPermissions: true lets the SDK request system Contacts access itself when needed.
plannedBackupNotificationId and plannedBackupNotificationBuilder are required: they define the local notification that reminds the user about a planned (automatic) backup. The ID must be unique among your app's notifications, and the builder returns the notification content for the current backup frequency each time the SDK schedules the notification.
The optional plannedBackupNotificationMinHour and plannedBackupNotificationMaxHour (local hours, defaults 10 and 20) limit the time of day the notification can fire.
To turn on planned backup and request notification permission, see Step 6 of the Backup guide.
First API Call
CloudikeContacts.shared.checkContactsAccess { granted in
print("Contacts access granted:", granted)
}
Requests system access to Contacts (since allowRequestPermissions was set to true) and reports whether the user granted it — the simplest call available right after configure(core:configuration:).