Notification content extensions not working in 10.2

I wrote a notification content extension which with 10.1 was working perfectly and reliably - it was getting called 100% of the time, as it should, and eveything was great and working as it should.


But now with 10.2 I just cannot get the bugger to work at all - the extension just isn't being called by the OS (actually it was called once out of about 30 attempts and on that one occasion the UNNotificationExtensionDefaultContentHidden YES flag was ignored, which it didn't use to be with 10.1)


Anybody else having problem with content extensions with 10.2, but if not is there some trick or tweak or change you applied to get them to work?

Replies

I have a Notification Content Extension and it does seem to be mostly working. I'm using local notifications and my extension is always invoked, so I'm not seeing the problem that you are. I only started developing it on beta 2 so can't comment on changes between 1 and 2. Are you sure you're correctly setting the notification's categoryIdentifier to match the UNNotificationExtensionCategory Info.plist key in your extension?


I have found that iPad doesn't seem to set the view size correctly according to the UNNotificationExtensionInitialContentSizeRatio Info.plist entry. And the layout guides of the view sometimes report stupidly large values, which causes problems with some autolayout. Also, at viewDidLoad time and the first pass through layoutSubviews seems to have the view as the full size of the screen, so the WWDC video which suggests setting the preferredContentSize in viewDidLoad won't work correctly (the view's bounds.size.width is not yet correct).

I found the problem - I'd been extending the push payload and the categoryIdentifier was present in the payload, however it wasn't in the aps section of the payload, and this was what was preventing the extension from loading.

Hi Mungbelan,

Have you resolved the issue. now my content extension cannot work at all even I set category in info.plist as guide. my ios version is 10.2 Thanks.

I am using Xcode 13.4, I have added a notification content extension, but lost of R&D I am not able to see this in device or simulator, any help I have facing this issue from last 7 days but did't get success. I am receiving push from firebase but in push notification button bar for down swipe is also not appear.