Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CoreDataStore with AppGroup #23

Open
fklingenberg opened this issue Nov 18, 2023 · 1 comment
Open

CoreDataStore with AppGroup #23

fklingenberg opened this issue Nov 18, 2023 · 1 comment

Comments

@fklingenberg
Copy link

Hi, i want to store the CoreData Container with a custom URL to share it with a widget extension.

Here is my code:

let accessToken = SingleCoreDataStore<String>(databaseName: "accessToken") { objectModel in
        let container = NSPersistentContainer(name: "accessToken")
        let storeURL = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: "group.com.justtreme.teamplaner")!.appendingPathComponent("accessToken.sqlite")
        let description = NSPersistentStoreDescription(url: storeURL)
        container.persistentStoreDescriptions = [description]

        container.loadPersistentStores { (_, error) in
            if let error = error {
                print(error.localizedDescription)
            }
        }
        
        return container
    }

I can store the data and retrieve it from the iOS app but it is not available on the widget extension.
This code is in a handler file wich is available for both targets.

Can someone help me with that?
Ferris

@kellvembarbosa
Copy link

kellvembarbosa commented Nov 22, 2023

I have a similar problem and I still haven't been able to solve it. @omaralbeik

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants