NSE Filtering

we already got access to com.apple.developer.usernotifications.filtering , we have set up this special permission in our app extension entitlement and provision profile. but we are still unable to filter notification by providing empty UNNotificationContent

Replies

@dipak10112 Did you set the apns-push-type header field to alert when you send the notification to the APNS server?
  • I am in the same situation, I can confirm the type is set to alert but still unable to filter the notification

    Received remote notification request 8B7E-2E97 [ waking: 0, hasAlertContent: 1, hasSound: 0 hasBadge: 0 hasContentAvailable: 0 hasMutableContent: 1 pushType: Alert]

    After my extension returns an empty UNNotificationContent, I see this in console:

    Mutated notification request will not visibly alert the user, will deliver original content; notificationRequest=8B7E-2E97, runtime: 9.882166

    Then it delivered the visible notification:

    Saving notification 8B7E-2E97: 1 [ hasAlertContent: 1, shouldPresentAlert: 1 ] Delivered user visible push notification 8B7E-2E97

Add a Comment
Hi,

There is a note on the documentation about this:

To silence a remote notification, you must set the apns-push-type header field to alert when you send the notification to the APNS server. Otherwise, the system always displays the notification banner to the user.
  • Does this work in sandbox environment? I think I got everything setup based on the doc but on sandbox I cannot silent the notification. I do have the push type header set but on console I still see the should present = 1

    fault 13:19:44.299587-0700 SpringBoard Got effective section info [ result: 0 ] default 13:19:44.299715-0700 SpringBoard [com.globalrelay.gr-app-im] Got effective section info [ hasResult: 1 ] default 13:19:44.299810-0700 SpringBoard Getting effectiveSectionInfo for section identifier: com.globalrelay.gr-app-im default 13:19:44.299882-0700 SpringBoard [com.globalrelay.gr-app-im] Getting effective section info default 13:19:44.299942-0700 SpringBoard Getting requested effective section info (sync) default 13:19:44.301367-0700 SpringBoard Got effective section info [ result: 0 ] default 13:19:44.301501-0700 SpringBoard [com.globalrelay.gr-app-im] Got effective section info [ hasResult: 1 ] default 13:19:44.301567-0700 SpringBoard [Persisting notification CA60-3031: 1 [applicableSettings: 1] default 13:19:44.301626-0700 SpringBoard [com.globalrelay.gr-app-im] Saving notification CA60-3031: 1 [ hasAlertContent: 1, shouldPresentAlert: 1 ]

  • I read thru the open source Signal Messenger code, they only have the filtering entitlement for App Store, so I am wondering if this only works for App Store (production push)?

Add a Comment

Hi. I am facing same problem, I got access to use entitlement but notification is not being hidden. I tried it with both sandbox and production env. My notification payload is

[AnyHashable("aps"): { alert = { body = "Tap to explore"; title = APP Name; }; badge = 0; "content-available" = 1; "mutable-content" = 1; }]

As described here com.apple.developer.usernotifications.filtering you have to use an extension and then to call contentHandler(UNNotificationContent()) to suppress a notification. As for the APS-Payload "mutable-content" has to be set and it has to be an alert. Without "mutable-content" your notification is not being called.

Hello I have the same problem The model of my notification is

{
  "headers": {
     "apns-push-type": "alert"
  },

  "aps": {
	"alert": {
			"title": "Test title",
			"body": "You have received a new message."
	},
	"mutable-content": 1
  }
}

I can catch notification in UNNotificationServiceExtension but i can't filter it with contentHandler(UNNotificationContent())