I have a scenario where, upon receiving a push notification, I need to decrypt the notification data using the information stored in the Hive database and display it in the notification.
I'm attempting two methods:
didReceive
, but I'm unsure how to access the Hive database.Is there any way to solve this issue?
You need to add the group capability to both the app and the extension. When the app runs for the first time I presume you specify a file location to it, if that location is within that group then both the app and the extension can access the db. You may need to consider the possibility that both the app and the extension are running simultaneously and therefore accessing the db simultaneously. Another option is the app reads out the data you need from the database (if the data isn't large) and stores it to user defaults, which the extension can access. Similarly this would require the group capability and the defaults used in the group location, not just standard defaults.
Sorry this isn't a full answer as there's no code example snippets, but I'm too busy to write a detailed answer and this is too long to add as a comment.