notification service extension passing mutated content to contentHandler doesn't always work

Hi pushing rich notifications (iOS 10) to an app which has a notification service extension sometimes outputs the legacy notification content (the one inside the 'aps' array). This happens even with the bare-bones NotificationService class that Xcode generates when adding the notification service extension, so it's nothing to do with any extra code that I'm adding


bestAttemptContent.title = "test title"
contentHandler(bestAttemptContent)


I've confirmed that the notification service extension always runs, but something seems to be happening inside the iOS 10 beta SDK after passing the bestAttemptContent to the contentHandler.

It's also not the case that the serviceExtensionTimeWillExpire is getting called, service crashing, or anything like that.


Any help will be appreciated!

Thanks

@fragmentedVertexCan Can you confirm this for the public versions iOS 10.0.1 and iOS 10.0.2? I believe I am experiencing the same issue with the most recent versions of iOS.

Sometimes the content just doesn't get mutated. For me it seems like it happens for new devices / ones that haven't been pushed for a while. The second push always works.

@FabianKS

Thanks for the reply Fabian, this issue has persisted for me accross all releases of iOS10 including up to the latest one 10.1.1

I find it strange that no one else has reported this problem, as far as I can search online.

It could be something happening with app memory, perhaps iOS occasionally dumps certain processess such as the notifcation service. Our QA is experiencing the same behaviour as you, where the first push does not mutate, but the second one does, and afterwards about 10-20% of the pushes also do not get mutated.

Have you found a workaround, by chance? I'm seeing this behavior as well. iOS 10.0-10.2.1.

Seeing this as well when trying to attach an image. Sometimes it just doesn't appear to work. I wound up putting some code in my extension so that if something failed along the way in didReceive, it would mutate the content to show an error. But this error is never showing up for the users who don't get the image attachment.


I thought maybe the image download was expiring, so I have an implementation of serviceExtensionTimeWillExpire that puts in a default image, but from what I've seen when debugging is that this never gets called either - I even put a call to the sleep function to wait a minute, but in those cases the expiration method is never called.


Kind of at a loss on how to troubleshoot this.

Wrote a bug about this and it was pretty quickly marked as a duplicate of another open bug.

Have you found a workaround? I'm experiencing the same problem......

How did you handle the problem at last?

notification service extension passing mutated content to contentHandler doesn't always work
 
 
Q