4

I have a tvOS application with an accompanying topshelf extension.

For the main app and the extension to share UserDefaults, it is necessary to create an App Group with a unique identifier of the form group.com.organisation.app.identifier and to open not UserDefaults.standard but instead supply the app group name when opening UserDefaults, e.g. let defaults = UserDefaults(suiteName: "group.com.organisation.app.AppGroupTest1").

This works fine for sharing defaults between the app and its extension, but adding a Settings.bundle file so that the defaults can be set by the system settings panel will not work.

Apple's guidelines state that Root.plist of the Settings.bundle must contain the key ApplicationGroupContainerIdentifier set to the same app group identifier as used by the app, but when testing this even with the most minimal application setup, the group container identifier is not respected by the Settings.bundle, and all settings made by the Settings.bundle end up in UserDefaults.standard instead.

I have tried implementing the same minimal app+bundle project as an iOS project, and the settings are propagated into the app group's UserDefaults there, as expected. Have I encountered a tvOS bug in the implementation of settings bundles or is there an under-undocumented difference between the implementation in iOS and tvOS?

idrougge
  • 633
  • 5
  • 12

0 Answers0