Back up your end users device's key shares to iCloud.
This is how you set up iCloud backups in your iOS app.
-
Open your project in XCode.
-
Navigate to Signing & Capabilities.
- Click the + button right below, scroll down, and select iCloud.
- Under iCloud Services, select Key-value storage.
-
If you are using the React Native SDK add to your project:
import { backupKeyset, CloudBackupOptions, BackupProvider, } from '@fordefi/wallet-sdk-react-native';
-
Using for backup:
const backupOptions: CloudBackupOptions = { backupProvider: BackupProvider.iCloud, }; const result = await backupKeyset(keysetId, backupOptions);
import FordefiSdk import FordefiBackupCloudProvidersSdk class ViewController: UIViewController { private var fordefi: Fordefi private let keysetID = "<KEYSET_ID>" override func viewDidAppear(_ animated: Bool) { ... FordefiBackupCloudProviders.getInstance().initialize( configuration: FordefiBackupCloudProvidersConfiguration()) do { self.fordefi = try Fordefi.getInstance(configuration: FordefiConfiguration( baseURL: "https://api.fordefi.com" )) } catch let error { print("Failed to initialize Fordefi. Error: \(error.localizedDescription)") return } self.fordefi?.backupKeyset(keysetID: self.keysetID, backupCloudProvider: FordefiBackupCloudProvider.iCloud, completionHandler: { error in self.handleBackupKeyset(error: error) }) } private func handleBackupKeyset(error: FordefiError?) { if error != nil { print("Faield to backup keyset. Error: \(error!.errorDescription!)") return } }