4

I have a bare-bones app to play with push notifications. I have the Notification Service Extension working. I can send a remote notification with an image URL and have it load.

I can't seem to get Notification Content Extension working. I've gone through multiple tutorials and they all say, just create a Notification Content Extension from the target menu and then inside the Notification Content Extensions Info.plist set the

UNNotificationCategory

to some string. Then when you push the notification, inside the "aps" json-block make sure to have category the same as UNNotificationCategory.

When I receive a notification, I try to swipe it down, left or right and nothing really happens. However, the service extension is working great.

I am using an iPhone 5 with ios 10 and XCode 8.0. I read that at one point only devices with 3d touch could view the content extension but that has since changed since xCode 8 is out of beta.

Any ideas? How can I go about debugging this? I've tried running the app with the Notification Extension selected and printing out stuff inside

didReceive

but am not having any luck.

jayess
  • 49
  • 6
George B
  • 2,592
  • 3
  • 22
  • 27

5 Answers5

42

Make sure to set the Extension's deployment target to the same as your Application target.

enter image description here

choofie
  • 2,575
  • 1
  • 25
  • 30
7

Please check if you set the category identifier in your UNMutableNotificationContent() For e.g.

let content = UNMutableNotificationContent()
content.categoryIdentifier = "awesomeNotification"

where "awesomeNotification" is the identifier for your UNNotificationCategory

Annie Gupta
  • 2,786
  • 15
  • 23
  • I am doing this with a remote notification, but I've made sure to set the "category" field equal to the UNNotificationCategory inside the "aps" field – George B Oct 15 '16 at 06:41
  • This should be the accepted answer. Works perfectly. So yes, don't forget to have the field "category" inside the "aps" node in the received push notification :-) – Antoine Rucquoy Jan 12 '18 at 09:34
5

Such problem. iOS Content Extension work fine with iPhone 5s, SE, iPad2mini, but doesn't work with iPhoine 5, 5c:

UNUserNotificationCenter.current().supportsContentExtensions is false on iPhoine 5, 5c

alexey.popkov
  • 96
  • 1
  • 3
  • Welcome to stackoverflow! Please note that this answer is not very helpful, especially since the question already has an accepted answer. – Aloso Apr 03 '17 at 17:51
2

Despite what I read elsewhere on stackoverflow and online, expanding the push notification did not work on an iPhone 5 and IOS 10. I borrowed an iPhone 6+ and my code worked fine.

George B
  • 2,592
  • 3
  • 22
  • 27
  • If you believe you are seeing a bug, or the documentation is lacking, make sure to open a bug report with Apple at https://bugreport.apple.com – Léo Natan Oct 16 '16 at 22:21
  • I have been testing it on 5s and 6 and the extensions have been working absolutely fine. – mickeymoon Apr 25 '17 at 07:42
  • I have iPhone 5s but not working. Guys Help me . any idea. UNNotificationExtensionCategory is same as APN and "mutable_content" : true – Ankur Patel Mar 05 '18 at 10:01
0

For me it was due to changing signing certificates. I was able to resolve it by:

  1. Deleting the app (and all apps in app group)
  2. Restarting phone
  3. Quitting Xcode
  4. Cleaning project
  5. Running again
Isaiah Turner
  • 2,574
  • 1
  • 22
  • 35