@capacitor/storage on iOS - Issue sharing data from Share Extension to Ionic App

I have an Ionic app and Share Extension set up in X Code (both in the same App Group called ‘group.com.myapp’) and I am trying to share data from the Share Extension to my Ionic app. I have added some test code to the Share Extension that adds data to UserDefaults but whenever I try to read the data in my Ionic app, the data is null.

Steps:

  1. Start X Code simulator.
  2. Open Share Extension to trigger creating test data.
  3. Open Ionic app. When I console.log the storage value, it’s always null.

My Share Extension code (using template generated by X Code) is below. Notice where I save test data to UserDefaults.

import UIKit
import Social

class ShareViewController: SLComposeServiceViewController {

    override func isContentValid() -> Bool {
        // Do validation of contentText and/or NSExtensionContext attachments here
        return true
    }

    override func didSelectPost() {
        // This is called after the user selects Post. Do the upload of contentText and/or NSExtensionContext attachments.
        let userDefaults = UserDefaults(suiteName: "group.com.myapp")
        userDefaults?.set("Testing group storage!", forKey: "groupStorageTest")
        // Inform the host that we're done, so it un-blocks its UI. Note: Alternatively you could call super's -didSelectPost, which will similarly complete the extension context.
        self.extensionContext!.completeRequest(returningItems: [], completionHandler: nil)
    }

    override func configurationItems() -> [Any]! {
        // To add configuration options via table cells at the bottom of the sheet, return an array of SLComposeSheetConfigurationItem here.
        return []
    }

}

And in my Ionic app I just try to log the storage value.

  const setOptions = async () => {
    await Storage.configure({ group: 'group.com.myapp' });
  };
  setOptions();
  const checkValue = async () => {
    const { value } = await Storage.get({ key: 'groupStorageTest' });
    console.log('storage:', value); // this always logs null; should be "Testing group storage!"
  };
  checkValue();