I have a NotificationService Extension in my iOS app which I use to modify the text and download attachments.
This works fine as long as the screen is unlocked. The moment the screen is locked, the service extension is not invoked and the notification is shown in its default state with no message.
I have an iPhone 7s running 11.2.5. Has anyone else come across this and have a solution for the same?
Turns out the issue was with the NotificationService Extension not having access to the keychain when the device was locked! duh... feel like an idiot :)
I set the kSecAttrAccessible to kSecAttrAccessibleAfterFirstUnlock while creating the key pair and problem was solved.
[keyDict setObject:(__bridge id)kSecAttrAccessibleAfterFirstUnlock forKey:(__bridge id)kSecAttrAccessible];
So my assumption that OS was not initiating the service extension was incorrect.