I have an app that shares preferences with a Today extension, following the approach described in many places (like this), i.e., creating and registering an App Group, then loading preferences:
if let ud = UserDefaults(suitName: "group.myshop.MyDefaultsSuite") {
let myPref = ud.string(forKey: "myUserName")
...
}
This worked fine through about April, 2016, and I didn't touch the app for a long time. Then I downloaded the latest Xcode (v8.3.3) and updated my code for Swift 3 as reflected above.
However, now on the ud.string()
line I get a console warning Using kCFPreferencesAnyUser with a container is only allowed for System Containers, detaching from cfprefsd
. And my preferences fail to load. I've seen other issues posted that look very similar, but no solutions. I'd rather not rename my preferences bundle or pre-pend my group ID as that would effectively block access to previously saved settings.
Has anyone else found a solution?