UserDefaults and SSO Extensions

Hi

Have a question around extensions and app group capabilities.

I have an existing app using UserDefaults and if I want to introduce an SSO extension; the extension doesn't use or need any of the data created by the app and saved to UserDefaults.

Will the app still have access to the UserDefaults or do I have move to UserDefaults(suiteName: "group.com.YourCompany.YourApp") even if UserDefaults is only used by the app?

Many thanks

Answered by DTS Engineer in 704763022

An app always has access to its own user defaults via the .standard singleton. If you don’t need to share preferences, it’s fine to use that. That doesn’t change if your app is using app groups for some other purpose.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Accepted Answer

An app always has access to its own user defaults via the .standard singleton. If you don’t need to share preferences, it’s fine to use that. That doesn’t change if your app is using app groups for some other purpose.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

I assume the UserDefault.standard accessible by the app aren't affected given SSO extensions are configured as of part of an MDM infrastructure

I’m not super familiar with SSO extensions or MDM but, yeah, I wouldn’t expect those to change this.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

UserDefaults and SSO Extensions
 
 
Q