iOS 10 Notification Content Extension not loading
Asked Answered
B

5

5

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.

Bookman answered 15/10, 2016 at 6:26 Comment(0)
B
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.

Bookman answered 16/10, 2016 at 22:16 Comment(3)
If you believe you are seeing a bug, or the documentation is lacking, make sure to open a bug report with Apple at bugreport.apple.comDonatist
I have been testing it on 5s and 6 and the extensions have been working absolutely fine.Sanctity
I have iPhone 5s but not working. Guys Help me . any idea. UNNotificationExtensionCategory is same as APN and "mutable_content" : trueSpaetzle
U
42

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

enter image description here

Urbanize answered 19/7, 2018 at 9:56 Comment(6)
You saved hours of debugging. ThanksExcited
That's why I was on working on iOS 12 device, You made my dayNeiman
Spent a good deal of time before figuring out why one extension is working and the other one isn't, only to find out I had forgotten to set the deployment target. Thanks.Scruple
I just LOVE you.Thenna
So after fixing the deployment target, I also had to restart the device to get this to work. Not even deleting the application worked until I restarted my phone. Wow. Thanks Apple for making this easy. :(Closelipped
You made my day, dude! So helpful! THanksWristwatch
I
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

Irrefutable answered 15/10, 2016 at 6:39 Comment(2)
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" fieldBookman
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 :-)Radically
G
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

Garzon answered 3/4, 2017 at 17:12 Comment(1)
Welcome to stackoverflow! Please note that this answer is not very helpful, especially since the question already has an accepted answer.Transarctic
B
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.

Bookman answered 16/10, 2016 at 22:16 Comment(3)
If you believe you are seeing a bug, or the documentation is lacking, make sure to open a bug report with Apple at bugreport.apple.comDonatist
I have been testing it on 5s and 6 and the extensions have been working absolutely fine.Sanctity
I have iPhone 5s but not working. Guys Help me . any idea. UNNotificationExtensionCategory is same as APN and "mutable_content" : trueSpaetzle
T
1

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
Ty answered 15/3, 2021 at 8:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.