As the title, can I use realm in Notification Service Extension ?
When I receive a notification, I need to get some data from realm, then edit notification content before showing to user.
I do below in the Podfile
pod 'RealmSwift'
target 'NotificationServiceExtension' do
inherit! :search_paths
end
Then I import RealmSwift in NotificationService.swift .
But it seems not working because it doesn't use the same database and can not find the scope I've already created.
CodePudding user response:
Yes it works, you need to create an AppGroup
in order to share data between your app & the Extension.