Failed to read values ​​in CFPrefsPlistSource iOS 10

I upgraded my Xcode 8 to beta 2 today and am trying to exchange data between App and Today Extension. I came across this log warning:

2016-07-08 18: 00: 24.732472 ProjetctX [941: 42801] [Custom defaults] Failure to read values ​​in CFPrefsPlistSource <0x1700f1280> (Domain: group.xpto, User: kCFPreferencesAnyUser, ByHost: Yes, Container: (null )): Using kCFPreferencesAnyUser with a container is allowed only for system containers, disconnecting from cfprefsd

Can anybody help me?

+43
ios xcode ios10 ios-app-group
Jul 08 '16 at 21:06
source share
6 answers

This is actually a false warning that appeared in iOS 10 and macOS 10.12. (Source: https://twitter.com/Catfish_Man/status/784460565972332544 )

Tip on adding your team ID will disable the warning, but will also create new empty user-defined defaults. This will cause any previously saved data to be unreadable.

Currently, the solution is to simply ignore it.

In addition, an Apple CFM employee on the forums :

The recorded message is false if you are not doing very specific things that, I think, are not possible without using private functions (it was added to catch the incorrect use of these functions, but, unfortunately, also fell into the usual use case).

+22
Oct 07 '16 at 18:39
source share

Here's how to use NSUserDefaults with application groups to transfer data between your main application and your extension:

  • In the main application, select your project in the Project Navigator.

  • Select the target of your main application and select the Features tab.

  • Switch the application group switch to the ON position. This will contact the Developer Portal to create a set of rights.

  • Create a new container. According to Apple, your container identifier should start with "group", so a name like "group.io.intrepid.myapp" is perfect.

  • Select the extension target and repeat the process to enable the Groups application. Do not create a new application group, just select the group that was just created in the main target application.

  • When reading or writing NSUserDefaults in an application or in your extension application, do not refer to NSUserDefaults.standardUserDefaults (). Use NSUserDefaults instead (package name: "group.io.intrepid.myapp"). Note. The package name is the name of your application group container created in step 4.

Make sure the group is enabled and using the same group ID for both the extension section and the applications!

Credit is sent http://blog.intrepid.io/ios-app-extensions

+3
Jun 12 '17 at 10:32 on
source share

I have to face the same problem when I try to use initWithSuiteName. This seems to be a bug from Apple. The only solution / workaround I found was to reset all device settings. Go to Settings β†’ General β†’ reset β†’ reset All settings.

This does not delete any content on the iPhone, it just removes all settings. After resetting, everything worked fine. Let me know if this helps you too.

+1
03 Oct. '16 at 7:12
source share

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

0
Sep 27 '16 at 8:05
source share

if you suffer from this problem when trying to save data in APP extensions using userDefault , you may have written this code:

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

This code reset to default userDefault .

Actually, the correct code is:

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

http://www.jianshu.com/p/e782104c3bc3

-one
Oct 24 '16 at 5:22
source share

Change

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

to

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

Where nnnnnnnnn is the number of your team that you use to sign the code.

Tested under Xcode 8 GM and iOS 10 GM and works!

-5
Sep 08 '16 at 5:46 on
source share



All Articles