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?

I'm having the same issue. Did you get this sorted out?


I'm also trying to share data between my app and today extension targets via

UserDefaults
/ app groups.

I'm seeing the same thing. Did anyone find a workaround?

I still see this warning in beta 3, but as far as I can tell, as long as the app group config is correct the functionality still works - i.e. I can get/put settings with both the app and extension and both can see what the other did.

Seeing similiar issues. Trying to share information between an iMessage Extension, and my App.

I'm still seeing this in beta 3. When the extension is first launched, I cannot read user defaults from the app group at all - but if I try again later, sometimes I'm able to read the values written to the defaults. I'm seeing this in the iPhone app as well - sometimes when I launch the app, the user defaults from the app group just aren't there, but if I relaunch the app then they reappear.


Submitted a radar: 27582964

I'm seeing this still with XCode 8 beta 4.


Things have been working fine despite the warning, however now my phone extension has stopped working when trying to access the shared defaults.

I have the same issue on Xcode beta 4.

Although Today extension and the application can share user defaults most of the times, it sometimes fails ( changes in Today extension sometimes do not take effects on the shared defautls.)


Also synchronize always returns 'false', but actually it succeeds mostly.

  let ud = UserDefaults(suiteName: "APP GROUP IDENTIFIER")
  if ud?.synchronize() != true { 
 // synchronize() always fails
  }

I'm having the same issue. It's occuring on my device so it doesn't seem to be a Simulator issue (as I've seen other threads say).

I have same issue on device (Apple Watch) only, not happening on sim with XCode 8b5.


Greg

I'm having this issue too. XCode 8b6(8S201h) with an iMessage Extension

I also have this issue, too. Xcode8 beta6. with Siri

I have the same problem. Impossible to work on my app now 😟

Same here for a 10.12 Mac app, crashes at launch. Can't work! Latest 10.12 beta didn't fix it either. What might be the problem?

It seems after I disabled all my Handoff related code in the app, the app suddenly started working again without throwing this error! Not sure why but for now at least I can continue after days of waiting for Apple to fix.

+1


I'm running Xcode 8 Beta 6 and iOS 10 Beta 8 and have the application group properly set on both iOS container app and notification container extension. The app is built and signed properly.


Running the app on device results in the following error when I try to either read or write to a NSUserDefaults instance instantiated with initWithSuiteName:


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

If I am writing then I get the following additional error:


[User Defaults] Attempt to set a non-property-list object {

8400 = 1;

} as an NSUserDefaults/CFPreferences value for key kUserDefaultsFeatureTrackingKey


However the object I am writing to NSUserDefaults is a standard NSDictionary with NSNumber as key and NSString as value.


Did anyone succeed in getting NSUserDefaults with App Groups working properly on iOS 10?


Thanks!

Hi, everyone!

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


Change from

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

to

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


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.xxx.xxx" not "nnnnnnnnnn.group.com.xxx.xxx".

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.xxx.com"];,this code reset default userDefault. Actually,the correct code is : [[NSUserDefaults alloc] initWithSuiteName:@"group.xxx.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: xxx, 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