iOS 10: Failed to read values in CFPrefsPlistSource

I've updated my Xcode 8 to beta 2 today and I'm trying to share data between App and Today Extension. I'm facing with this log warning:



2016-07-08 18:00:24.732472 ProjetctX[941:42801] [User Defaults] Failed to read values in CFPrefsPlistSource<0x1700f1280> (Domain: group.x.p.t.o, User: kCFPreferencesAnyUser, ByHost: Yes, Container: (null)): Using kCFPreferencesAnyUser with a container is only allowed for System Containers, detaching from cfprefsd



Anyone can help me?

Hi, everyone!

I have also encountered the same problem. And I finally figured it out!


Change from

[[NSUserDefaults alloc] initWithSuiteName:@"group.com.***.***"];

to

[[NSUserDefaults alloc] initWithSuiteName:@"nnnnnnnnnn.group.com.***.***"];


nnnnnnnnn is your team number, the one which you using to sign your code.


Tested under Xcode 8 GM and iOS 10 GM, and worked!

This certaintly gets rid of the original error, but the problem now is that it's not the correct version of the user defaults (at least not for me). It doesn't have any of the custom saved data that I need to access in my extension, since everything was saved to "group.com.***.***" not "nnnnnnnnnn.group.com.***.***".

I'm experiencing same issue, suing GM of Xcode and iOS 10. Using the mmmmmm. prefix does get rid of the warning, but the defaults are not present when I read them from my app extension. This was definitely working in earlier betas.


Has anyone figured out how to make this work?

The same story with GM of iOS 10. Application sometimes goes down with this error...

Build with Xcode 8.1 Beta and you will see the same warning, but you will also get the value.

It's unfortunate that there is a visible log message here, because it's unrelated to virtually all of the issues reported in this thread. The logged message is spurious unless you're doing very specific things that I don't think are possible without using private functions (it was added to catch misuse of those functions, but unfortunately also caught a normal usage case).


Any bugs you and other people in the thread seeing are separate, and fairly likely to be unrelated to each other as well. e.g. irregularly not seeing user defaults is almost certainly due to a bug in user defaults, not due to something your app is doing. Crashing is likely unrelated to user defaults entirely, and should be diagnosed via the crashlog, not the logged message.

So, why, in Xcode 8.1 beta 2 is this still not fixed given people have mentioned this since beta 2 of Xcode 8.0?

So embarrassing!The friend whose named who_young is my compay's account. Now,i write this answer again:

if you suffer this problem when you try to save data to extension APP by using userDefault,maybe you had written this code : [[NSUserDefaults standardUserDefaults] initWithSuiteName:@"group.***.com"];,this code reset default userDefault. Actually,the correct code is : [[NSUserDefaults alloc] initWithSuiteName:@"group.***.com"];http://www.jianshu.com/p/e782104c3bc3

I can't access the app group on my Apple Watch,too.

Xcode Version 8.3.2 (8E2002)

The console prints:

[User Defaults] Failed to read values in CFPrefsPlistSource<0x1567e3a0> (Domain: XXXXXXXXXXXXXXXXX, User: kCFPreferencesAnyUser, ByHost: Yes, Container: (null)): Using kCFPreferencesAnyUser with a container is only allowed for System Containers, detaching from cfprefsd

and I can not get the data.

May, 2022

For iOS SwiftUI Widget, I'm using App Group to share userDefaults between main app and widget, I saw same information like this, but only appear once, the second time widget retrieve info (via WidgetCenter.reloadTimelines) seems successful. Maybe we can define when read userDefaults failed, and treat this a Xcode log noise?

[User Defaults] Couldn't read values in CFPrefsPlistSource<0x2824ee900> (Domain: ***, User: kCFPreferencesAnyUser, ByHost: Yes, Container: (null), Contents Need Refresh: Yes): Using kCFPreferencesAnyUser with a container is only allowed for System Containers, detaching from cfprefsd

I have same issue today with Device Activity Report extension, did anyone find a solution ?

Couldn't read values in CFPrefsPlistSource<0x300a433c0> (Domain: group.com.xxxx.xxxx, User: kCFPreferencesAnyUser, ByHost: Yes, Container: (null), Contents Need Refresh: Yes): Using kCFPreferencesAnyUser with a container is only allowed for System Containers, detaching from cfprefsd

iOS 10: Failed to read values in CFPrefsPlistSource
 
 
Q