How to share ApplicationToken with DeviceAcvivityMonitorExtension

To shield applications, we have to pass ApplicationTokens to DeviceAcvivityMonitorExtension. But I don't know the way.

I tried to pass it by using NSUserDefaults. However, it didn't work because ApplicationToken isn't encodable. So I can't save it in UserDefaults

Does anyone knows the way to pass ApplicationTokens to the Extension or another way to shield apps?

Replies

ApplicationToken is encodable, please see Encoding a Token for more information. Also, you must make sure to use UserDefaults that are shared between an app and its extensions via App Groups.