Portal iCloud backup storage

The @portal-hq/icloud-storage package contains a storage adapter intended for use with the @portal-hq/core package.

This storage adapter allows end users to save backup MPC shares to their iCloud filesystem.

Note: This storage provider is only supported on iOS devices, so should not be used as your sole backup storage adapter unless you are explicitly releasing an iOS-only app.

Note: you will need a paid developer account to use iCloud backup

Basic usage

Install the package in your React Native project.

yarn add @portal-hq/icloud-storage

Import the package into the component where you initialize the Portal class

import Portal from '@portal-hq/core'
import ICloudStorage from '@portal-hq/icloud-storage'

Register your storage adapter and initialize the Portal class

const portal = new Portal({
  // ...your other config options
  backup: {
    icloud: new ICloudStorage(),

Check if the user is connected to iCloud

// Returns one of the following:
// "available", "not_signed_in", "no_access"
await portal.backup[BackupMethods.iCloud].getAvailability();

Setting up iCloud Backups in your iOS app

  1. Open your project in XCode.

  2. Navigate to Signing & Capabilities:

  3. Click the + Button right below it, scroll down and select iCloud.

  4. Under iCloud Services select Key-value storage.

Last updated