Does NSUserDefaults suite name require the team id?

We use NSUserDefaults -initWithSuiteName with suite named "group.com.example" to share data beween our app and extension, and with another app of ours. I just noticed a console msg in Xcode 8 GM seed (app running on iOS 10.0.1):


[User Defaults] Failed to read values in CFPrefsPlistSource. Using kCFPreferencesAnyUser with a container is only allowed for System Containers, detaching from cfprefsd


I know the solution is to prefix the team id to the group, however I can't find any documentation that says you *must* do this. It seems to be working fine, and we've already shipped another app that uses the non-prefixed suite name, so we'd have to rerelease that app if we change it for the new one.


Furthermore, when we were releasing an OS X app this summer we failed App Store validation with this error:


Invalid Code Signing Entitlements. Your application bundle's signature contains code signing entitlements that are not supported on Mac OS X. Specifically, value '[group.com.example]' for key 'com.apple.security.application-groups' is not supported. This value should be a string or an array of strings, each starting with your TEAMID followed by a dot '.' .


So on the Mac we were forced to prefix the team id, but our iOS validation is currently passing without it.


I'd really like to know before we release another app (where this working correctly is critical) whether this is a requirement, or highly recommended, or doesn't matter.


thanks for any insight...

Eric

Did you find a solution to this which still works in XCode 8.1?

As Xcode is telling we must start a group name with "group." for iOS, I am wondering if the solution is to use "TEAMID.group.xxxx" in some places, and "group.xxxx" in others (i.e. that Xcode automatically adds the Team ID in some places?)

I'm on macOS 10.12.5 using Xcode Version 8.3.3 (8E3004b). To get my sandboxed mac app to correctly write/read its app preferences, I found that--after much trial, error and gnashing of teeth--the following works:


NSUserDefaults* myDefaults = [[NSUserDefaults standardUserDefaults] initWithSuiteName: @"NNNNNNN.com.myCompany.myApp"];


where NNNNNNN is my developer signing ID.


It still throws initial spurious log messages but my app's prefs are both correctly read and written in the app's container.


NOTE: iOS suiteName may have to be slightly differently formatted. I have not verified this on iOS.

Does NSUserDefaults suite name require the team id?
 
 
Q