encountering a console warning when accessing NSUserDefaults within the willFinishLaunchingWithOptions method. However, it appears that all the key values are loading correctly despite the warning.

App initiates a App group based UserDefaults within the willFinishLaunchingWithOptions method and the same reference are used throughout the app life cycle

+ (NSUserDefaults *)appGroupUserDefaults
{
    if (_appGroupUserDefaults == nil)
    {
        NSString *appGroupIdentifier = [NSString stringWithFormat:@"group.%@",[[NSBundle mainBundle] bundleIdentifier]];
        NSUserDefaults *groupDefaults = [[NSUserDefaults standardUserDefaults] initWithSuiteName:appGroupIdentifier];
        if(groupDefaults != nil)
        {
            NSLog(@"[DB_ENCRYPTION] appGroupUserDefaults initialised");
            _appGroupUserDefaults = groupDefaults;
        }
        else
        {
            NSLog(@"<ALA_ERROR>: [CCF-OS] [DB_ENCRYPTION] %s Unable to create NSUSerDefaults with groupIdentifier", __func__);
            _appGroupUserDefaults = [NSUserDefaults standardUserDefaults];
        }
    }
    return _appGroupUserDefaults;
}

Doesn't have any issues on accessing the values but seen the below console error:

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

Does it require any action here ?

Answered by DTS Engineer in 852421022

Yeah, I am pretty sure that is a log noise that you can safely ignore.

Best,
——
Ziqiao Chen
 Worldwide Developer Relations.

Does the warning appear in the Xcode console with a yellow background?

I've seen this one before in my own apps, and I'm sure it's also been mentioned on these forums before, so please do a search first, but I think it's okay to ignore.

I believe it's an internal Apple warning. You can raise a Feedback report to them and they'll look at fixing the issue and removing the warning/logging: https://feedbackassistant.apple.com/ (post the FB number here if you do).

Accepted Answer

Yeah, I am pretty sure that is a log noise that you can safely ignore.

Best,
——
Ziqiao Chen
 Worldwide Developer Relations.

encountering a console warning when accessing NSUserDefaults within the willFinishLaunchingWithOptions method. However, it appears that all the key values are loading correctly despite the warning.
 
 
Q