Skip to main content

iOS Backup Service

Functions

createBackup

public func createBackup(
onSuccess: @escaping (String?) -> Void,
onError: @escaping ((Error) -> Void)? = nil
)

Creates a full JSON backup of all locally stored SDK data and returns it as a string.

Parameters:

  • onSuccess: (String?) → Void — Returns the generated JSON backup string.
  • onError: (Error) → Void — Called if the backup operation fails.

restore

public func restore(
json: String,
onSuccess: @escaping () -> Void,
onError: @escaping ((Error) -> Void)? = nil
)

Restores the SDK state from a backup JSON string. Returns true on successful restore.

Parameters:

  • json: String — Backup JSON string previously generated with createBackup.
  • onSuccess: () → Void
  • onError: (Error) → Void — Called when restore fails.