Skip to content

Crashes when using keychainAccessGroup #25

@blursolo

Description

@blursolo

First I implemented this library successfully in an app extension but sharing stored values between my app and the extension didn't work.
Then I tried setting the .keychainAccessGroup as well:

self.defaultsAppGroupSecure = SecureDefaults(suiteName: "group.com.company.appname.AppGroup")
self.defaultsAppGroupSecure!.keychainAccessGroup = "com.company.appname.KeyChain"
        
if !self.defaultsAppGroupSecure!.isKeyCreated {
     self.defaultsAppGroupSecure!.password = "password"
}
        
self.defaultsAppGroupSecure!.set(true, forKey: "storedValue")

It throws "SecureDefaults.swift:218: Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value".
It seems like the internal key property isn't set. I had tried to set it manually but it wouldn't work.

What am I doing wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions