Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Flutter and app store releases

UserDefaults logs 'Failed to read values in CFPrefsPlistSource' for an app group

ErrorFailed to read values in CFPrefsPlistSource

Short answer

This log comes from the preferences system when UserDefaults is opened for an app group's suite. Shared defaults are meant for apps and extensions that belong to that group. Dump the signed entitlements, then check three things: the App Groups capability on every target, a suite name identical to the group identifier, and on macOS a matching team ID.

  • Applies to Xcode 26, Swift 6, iOS 26, macOS 26
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Print the entitlements the built app is signed with, then do the same for each extension inside it. The group list there must hold the exact identifier your code passes to UserDefaults(suiteName:).

    codesign --display --entitlements - --xml MyApp.app | plutil -convert xml1 -o - -
    codesign --display --entitlements - --xml MyApp.app/PlugIns/MyWidget.appex | plutil -convert xml1 -o - -
  2. 2Match what you see, then jump to its fix

    1. 1The dump of one target (the app, a widget or another extension) has no com.apple.security.application-groups key, while another target's dump has it.The App Groups capability is missing on the target that reads the defaultsFix
    2. 2The dump shows group.com.example.mygroup, but the code passes a different string: a typo, a missing group. prefix, the app's own bundle ID or the global domain.The suite name does not match the registered group identifierFix
    3. 3A Mac app uses an identifier of the form TEAMID.name, and the team in its signature is another team.On macOS the group's team prefix and the signing team disagreeFix

What does the error look like?

  • Failed to read values in CFPrefsPlistSource
  • Settings saved by the app are not visible to its extension, widget or sibling app that share the group

Cause 1 of 3

The App Groups capability is missing on the target that reads the defaults

1Check

An app group lets apps from one team share containers, and it also covers sharing data between an app extension and its host app. Each target that touches the shared defaults needs the entitlement itself. Run the first-step dump on every one of them.

codesign --display --entitlements - --xml MyApp.app/PlugIns/MyWidget.appex | plutil -convert xml1 -o - - | grep -A2 application-groups

2Fix

In Xcode select the target, open Signing & Capabilities, add the App Groups capability and tick the group. On iOS the entitlement must also be allowed by the provisioning profile, so with manual signing create a new profile after the group is registered.

# Xcode: target > Signing & Capabilities > + Capability > App Groups > tick group.com.example.mygroup

3Verify

Rebuild and dump the target again. The key and the group identifier should now be in the output.

codesign --display --entitlements - --xml MyApp.app/PlugIns/MyWidget.appex | plutil -convert xml1 -o - - | grep -A2 application-groups

Confirmed by developer.apple.com

Did this fix it?

Cause 2 of 3

The suite name does not match the registered group identifier

1Check

UserDefaults(suiteName:) takes the app group identifier to read and write shared settings. Apple says not to pass the global domain or the app's own bundle identifier. An iOS group identifier starts with group. and then a custom string.

grep -rn "suiteName" --include=*.swift --include=*.m .

2Fix

Keep the identifier in one constant that every target compiles, and pass exactly the string shown in the App Groups capability.

enum Shared {
    static let groupID = "group.com.example.mygroup"
}

let defaults = UserDefaults(suiteName: Shared.groupID)
defaults?.set("ok", forKey: "probe")

3Verify

Write a value from the app, then read it from the extension. It should print the value, not a missing marker.

// in the extension or widget
print(UserDefaults(suiteName: Shared.groupID)?.string(forKey: "probe") ?? "missing")

Confirmed by developer.apple.com

Did this fix it?

Cause 3 of 3

On macOS the group's team prefix and the signing team disagree

1Check

macOS also allows group identifiers written as the team ID, a dot and a group name. For these, macOS checks that the code signature of every process that opens the container carries the same team ID as the identifier.

# Xcode: target > Signing & Capabilities > Team
# compare it with the prefix of the group identifier in the code

2Fix

Make the prefix equal to the team that signs every app and helper in the group, or register an identifier that starts with group. and use that instead. Sign every member with the same team.

// identifier built from the signing team
let defaults = UserDefaults(suiteName: "ABCDE12345.mygroup")   // ABCDE12345 = your team ID

3Verify

Rebuild all members, run them and read the shared value back from the second app.

print(UserDefaults(suiteName: "ABCDE12345.mygroup")?.string(forKey: "probe") ?? "missing")

Confirmed by developer.apple.com

Did this fix it?

How do I stop it coming back?

  • Keep the group identifier in one shared constant, so the app and every extension use the same string.
  • When you add a widget or extension target, enable the App Groups capability on it straight away and tick the same group.
  • Never pass the app's bundle identifier or the global domain as the suite name.
  • Dump the entitlements of the archived build before release and compare them with the group list.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Mobile apps

InstanceID token() no longer works in a Swift Firebase app

Instance ID calls fail to compile after upgrading Firebase to 8.0.0 or later

Firebase removed the Instance ID dependency from Messaging in 8.0.0, so InstanceID.instanceID() calls no longer belong in a current app.

3 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.