Xamarin-macios: Notification Service Extension does not work in iOS 11 (Rich Push)

Created on 8 Jan 2018  路  24Comments  路  Source: xamarin/xamarin-macios

Steps to Reproduce

  1. Build a blank app with associated Notification Service Extension on device running iOS 11 (11.2.1)
  2. Build the same app on iOS 10 (10.3.3)

Expected Behavior

The Notification Service Extension should be present on the device

Actual Behavior

The Notification Service Extension is not present on the device

Environment

  • Visual Studio 7.3.2 (build 12)
  • Mono 5.4.1.7 (2017-06/e66d9abbb27) (64-bit)
  • Xamarin.iOS 11.6.1.2 (Visual Studio Community)
  • Xcode 9.2 (13772)

I don't have build logs as I'm not the person who noticed this behavior and this bug was brought back by one of our main customers.

Thank you

bug iOS

All 24 comments

Could you please let me know what did you do to confirm that the extension was not present? I'll create a project and will test it ASAP.

Hello,

I just sent a push with an image and noticed that the Notification Service Extension was not loaded.

Thanks

I have tried the sample that can be found in https://developer.xamarin.com/samples/monotouch/Notifications/ and the notifications are installed. Can you double check the issue. If the issue does continue to exist can you please provide full build logs of the application so that we can study the compilation process and ensure that the extension is indeed added.

To get full build logs just set the log verbosity to diagnostic at the following locations:

  • On Visual Studio for Mac: Preferences > Projects > Build
  • On Visual Studio for Windows: Tools > Options > Projects and Solutions > Build and Run

Hello,

Looking in bug within bugzilla I have found the following that could be a duplicate of this issue: https://bugzilla.xamarin.com/show_bug.cgi?id=53207 Can you please read the recommendations in the bug and confirm that it is a duplicate of your issue?

Will close the bug since we have one already reported in bugzilla. Please, if you do not agree feel free to re-open the issue.

Hello,
We did further testing and here's what we got:
No problem whatsoever with Xamarin app running on iOS 10 or with the native app running on iOS 11.
However, every single time we send a rich notification to a Xamarin app running on iOS 11 we get the following log:

Feb 15 10:29:17 iPhone SpringBoard(ApplePushService)[19082] : Delivering message from apsd: 13691
Feb 15 10:29:17 iPhone SpringBoard(ApplePushService)[19082] : responding with an ack for message with guid
Feb 15 10:29:17 iPhone SpringBoard(ApplePushService)[19082] : making delegate () calls to deliver message 13691 for topic
Feb 15 10:29:17 iPhone SpringBoard(ApplePushService)[19082] : calling connection:didReceiveIncomingMessage:
Feb 15 10:29:17 iPhone SpringBoard(ApplePushService)[19082] : returned from connection:didReceiveIncomingMessage:
Feb 15 10:29:17 iPhone SpringBoard(UserNotificationsServer)[19082] : Received incoming message on topic com.accengage.app.recette at priority 10
Feb 15 10:29:17 iPhone SpringBoard(UserNotificationsServer)[19082] : [com.accengage.app.recette] Received remote notification request 15DD-0D22 [ hasAlertContent: 1, hasSound: 1 hasBadge: 1 hasContentAvailable: 0 hasMutableContent: 1 ]
Feb 15 10:29:17 iPhone SpringBoard(UserNotificationsServer)[19082] : [com.accengage.app.recette] Getting notification settings
Feb 15 10:29:17 iPhone SpringBoard(UserNotificationsServer)[19082] : [com.accengage.app.recette] Getting section info
Feb 15 10:29:17 iPhone SpringBoard(UserNotificationsServer)[19082] : [com.accengage.app.recette] Got section info [ hasResult: 1 ]
Feb 15 10:29:17 iPhone SpringBoard(UserNotificationsServer)[19082] : [com.accengage.app.recette] Got notification settings [ hasResult: 1 ]
Feb 15 10:29:17 iPhone SpringBoard(UserNotificationsServer)[19082] : [com.accengage.app.recette] Remote notification request 15DD-0D22 can be modified: 1
Feb 15 10:29:17 iPhone SpringBoard(UserNotificationsServer)[19082] : [com.accengage.app.recette] Trying to find extension for bundle
Feb 15 10:29:17 iPhone analyticsd[21230] : [] no observers; dropped.
Feb 15 10:29:17 iPhone SpringBoard(UserNotificationsServer)[19082] : [com.accengage.app.recette] Extension can modify push notification request 15DD-0D22? YES
Feb 15 10:29:17 iPhone SpringBoard(UserNotificationsServer)[19082] : [com.accengage.app.recette.AccengageNotificationService] Beginning extension session...
Feb 15 10:29:17 iPhone assertiond[67] : PID 19082 requested an assertion for unknown process 21968 that doesn't seem to be an extension
Feb 15 10:29:17 iPhone SpringBoard(PlugInKit)[19082] : plug-in pre-screen sees activating state
Feb 15 10:29:17 iPhone pkd[21878] : allowing host 19082 /System/Library/CoreServices/SpringBoard.app/SpringBoard to use plug-in () uuid=4AB08512-0E3D-4532-A184-C5295B5F1BDA at
Feb 15 10:29:17 iPhone NotificationServiceExtension(libxamarin-debug.dylib)[22041] : Xamarin.iOS: IDE Port: 51530 Transport: USB
Feb 15 10:29:18 iPhone CommCenter(libATCommandStudioDynamic.dylib)[16783] : QMI: Svc=0x03(NAS) Ind MsgId=0x0051 Bin=['01 1F 00 80 03 04 04 03 35 51 00 13 00 14 06 00 AF F4 8E FF 00 00 A2 01 00 32 A4 03 00 01 64 00']
Feb 15 10:29:18 iPhone SpringBoard(UserNotificationsServer)[19082] : [com.accengage.app.recette.AccengageNotificationService] Extension will be killed due to sluggish startup
Feb 15 10:29:18 iPhone SpringBoard(UserNotificationsServer)[19082] : [com.accengage.app.recette] Deliver push notification request 15DD-0D22
Feb 15 10:29:18 iPhone SpringBoard(UserNotificationsServer)[19082] : [com.accengage.app.recette] Send willPresentNotification for notification 15DD-0D22
Feb 15 10:29:18 iPhone SpringBoard(PlugInKit)[19082] : connection to plug-in (4AB08512-0E3D-4532-A184-C5295B5F1BDA) lost
Feb 15 10:29:18 iPhone SpringBoard(PlugInKit)[19082] : Hub connection error Error Domain=NSCocoaErrorDomain Code=4097 "connection to service named com.accengage.app.recette.AccengageNotificationService" UserInfo={NSDebugDescription=connection to service named com.accengage.app.recette.AccengageNotificationService}

@oristanovic just to be precise, the native app does not have any issues with the startup time of the notifications. Can you provide a sample or access to the notification xamarin version to take a look and see if we can improve its performance?

Just to double check and make sure we are in the same page. The application does have this issue in release mode, correct? (I made this assumption but I prefer it to be explicit).

Info provided in https://github.com/xamarin/xamarin-macios/issues/3526 from @oristanovic, closed 3526 issue in order to keep all the info in a single thread.


Steps to Reproduce

This is a follow up to the issue https://github.com/xamarin/xamarin-macios/issues/3176

  1. Build a blank app with associated Notification Service Extension on device running iOS 11 (11.2.1)
  2. Build the same app on iOS 10 (10.3.3)

Expected Behavior

The Notification Service Extension should not be killed by the system and the rich push should be displayed

Actual Behavior

The Notification Service Extension is killed by the system and the rich push isn't displayed

Environment

Visual Studio 7.3.2 (build 12)
Mono 5.4.1.7 (2017-06/e66d9abbb27) (64-bit)
Xamarin.iOS 11.6.1.2 (Visual Studio Community)
Xcode 9.2 (13772)

Build Logs

We did further testing and here's what we got:
No problem whatsoever with Xamarin app running on iOS 10 or with the native app running on iOS 11.
However, every single time we send a rich notification to a Xamarin app running on iOS 11 we get the following log:

Feb 15 10:29:17 iPhone SpringBoard(ApplePushService)[19082] : Delivering message from apsd: 13691
Feb 15 10:29:17 iPhone SpringBoard(ApplePushService)[19082] : responding with an ack for message with guid
Feb 15 10:29:17 iPhone SpringBoard(ApplePushService)[19082] : making delegate () calls to deliver message 13691 for topic
Feb 15 10:29:17 iPhone SpringBoard(ApplePushService)[19082] : calling connection:didReceiveIncomingMessage:
Feb 15 10:29:17 iPhone SpringBoard(ApplePushService)[19082] : returned from connection:didReceiveIncomingMessage:
Feb 15 10:29:17 iPhone SpringBoard(UserNotificationsServer)[19082] : Received incoming message on topic com.accengage.app.recette at priority 10
Feb 15 10:29:17 iPhone SpringBoard(UserNotificationsServer)[19082] : [com.accengage.app.recette] Received remote notification request 15DD-0D22 [ hasAlertContent: 1, hasSound: 1 hasBadge: 1 hasContentAvailable: 0 hasMutableContent: 1 ]
Feb 15 10:29:17 iPhone SpringBoard(UserNotificationsServer)[19082] : [com.accengage.app.recette] Getting notification settings
Feb 15 10:29:17 iPhone SpringBoard(UserNotificationsServer)[19082] : [com.accengage.app.recette] Getting section info
Feb 15 10:29:17 iPhone SpringBoard(UserNotificationsServer)[19082] : [com.accengage.app.recette] Got section info [ hasResult: 1 ]
Feb 15 10:29:17 iPhone SpringBoard(UserNotificationsServer)[19082] : [com.accengage.app.recette] Got notification settings [ hasResult: 1 ]
Feb 15 10:29:17 iPhone SpringBoard(UserNotificationsServer)[19082] : [com.accengage.app.recette] Remote notification request 15DD-0D22 can be modified: 1
Feb 15 10:29:17 iPhone SpringBoard(UserNotificationsServer)[19082] : [com.accengage.app.recette] Trying to find extension for bundle
Feb 15 10:29:17 iPhone analyticsd[21230] : [] no observers; dropped.
Feb 15 10:29:17 iPhone SpringBoard(UserNotificationsServer)[19082] : [com.accengage.app.recette] Extension can modify push notification request 15DD-0D22? YES
Feb 15 10:29:17 iPhone SpringBoard(UserNotificationsServer)[19082] : [com.accengage.app.recette.AccengageNotificationService] Beginning extension session...
Feb 15 10:29:17 iPhone assertiond[67] : PID 19082 requested an assertion for unknown process 21968 that doesn't seem to be an extension
Feb 15 10:29:17 iPhone SpringBoard(PlugInKit)[19082] : plug-in pre-screen sees activating state
Feb 15 10:29:17 iPhone pkd[21878] : allowing host 19082 /System/Library/CoreServices/SpringBoard.app/SpringBoard to use plug-in () uuid=4AB08512-0E3D-4532-A184-C5295B5F1BDA at
Feb 15 10:29:17 iPhone NotificationServiceExtension(libxamarin-debug.dylib)[22041] : Xamarin.iOS: IDE Port: 51530 Transport: USB
Feb 15 10:29:18 iPhone CommCenter(libATCommandStudioDynamic.dylib)[16783] : QMI: Svc=0x03(NAS) Ind MsgId=0x0051 Bin=['01 1F 00 80 03 04 04 03 35 51 00 13 00 14 06 00 AF F4 8E FF 00 00 A2 01 00 32 A4 03 00 01 64 00']
Feb 15 10:29:18 iPhone SpringBoard(UserNotificationsServer)[19082] : [com.accengage.app.recette.AccengageNotificationService] Extension will be killed due to sluggish startup
Feb 15 10:29:18 iPhone SpringBoard(UserNotificationsServer)[19082] : [com.accengage.app.recette] Deliver push notification request 15DD-0D22
Feb 15 10:29:18 iPhone SpringBoard(UserNotificationsServer)[19082] : [com.accengage.app.recette] Send willPresentNotification for notification 15DD-0D22
Feb 15 10:29:18 iPhone SpringBoard(PlugInKit)[19082] : connection to plug-in (4AB08512-0E3D-4532-A184-C5295B5F1BDA) lost
Feb 15 10:29:18 iPhone SpringBoard(PlugInKit)[19082] : Hub connection error Error Domain=NSCocoaErrorDomain Code=4097 "connection to service named com.accengage.app.recette.AccengageNotificationService" UserInfo={NSDebugDescription=connection to service named com.accengage.app.recette.AccengageNotificationService}

@oristanovic please provide answers to @mandel-macaque's requests above also if you think https://bugzilla.xamarin.com/show_bug.cgi?id=53207 is a good fit for your request please close this issue and comment on the bug instead.

@oristanovic just to be precise, the native app does not have any issues with the startup time of the notifications. Can you provide a sample or access to the notification xamarin version to take a look and see if we can improve its performance?

Just to double check and make sure we are in the same page. The application does have this issue in release mode, correct? (I made this assumption but I prefer it to be explicit).

Hello,

There is only an issue with the Xamarin app.

Here is a summary :

  • the extension works in a native app for both iOS 10 and 11
  • the extension works in a Xamarin app for iOS 10
  • the extension does not work in a Xamarin app for iOS 11

We also don't think that the problem is related to the extension's performance as it occurred every time the we tested it.

Neither the native app nor the xamarin app (iOS 10) have issues with the startup time (the notification is delivered within the 30 seconds).
Do you need a sample app or just the notification (payload) to test? The issue was discovered by a client in the debug phase and we reproduce it as well (sandbox environment).

Thank you,

@itzseven A sample app to reproduce the bug will be very welcome since that you know how to reproduce it. Once we have a test app we will be able to investigate what is happening.

https://github.com/Accengage/accengage-xamarin-sample
If I understand correctly, you don't have any issues with service extensions on iOS 11 on your side (in your test apps)?

Hi,
Were you able to investigate further on this ?
We have clients waiting and would like to pinpoint the source of the problem. Let us know if you need any additional information.
Thanks

I was able to consistently reproduce this in a test app. IOS 11. If you're in release mode it works. It fails in debug mode.

No idea why. I'm not that smart. If you need something, let me know

This is most likely a memory problem: iOS kills the extension because it uses too much memory. The reason it works in release and not in debug mode, is that release mode uses less memory, and thus doesn't hit the limit imposed by iOS.

The good news is that we've improved this scenario significantly in our next major release (d15-7), which you can already try if you switch to the alpha or beta channel in Visual Studio for Mac (could you try this and see if it works for you?)

Sorry, not using VS for Mac. I'll wait until it gets into production. Thanks.

@itzseven / et all have anyone tried our beta build known as 15.7 mentioned here? If so is this still an issue for you?

The extension does not work in a Xamarin app for iOS 11. I have tested with release d15-7.
Environment details:
Xamarin.iOS
Version: 11.10.1.177 (Visual Studio Community)
Branch: d15-7

@anish1984 When you say it does not work on iOS 11, does it mean that it works on previous iOS versions? (Trying to triage the issue correctly to see if it is a regression).

I tested this in Visual Studio Windows 2017 version 15.8.0 Preview 4.0. Still a problem in debug mode. Works in release mode.

@PlymouthRock could you please provide the full environment information of the platform in which you tested the extension. Can you provide a small sample?

Hi what is the conclusion please. I am building an app in Xamarin with Visual Studio Professional 2017 and I need to intercept the push notification in a service extension that I added to my Projec, in order to modify its content before displaying to the user, but but i cannot do that. The service extension method DidReceiveNotificationRequest(UNNotificationRequest request, Action contentHandler) does not trigger. I would need to debug, how can you debug in release?

This is the template for the notification that i am using to register:
const string templateBodyAPNS = @"{
""aps"" : {
""alert"" : ""$(messageParam)"",
""mutable-content"": 1
},
""encrypted-content"" : ""somecontent""
}";
Please help me out. Thank you.

@PlymouthRock

Still a problem in debug mode. Works in release mode.

I wonder if iOS is not happy about the time it takes for us to attach the debugger to the process. Some more investigation would be needed to determine this.

@RazvanEmilR:

I would need to debug, how can you debug in release?

There are no simple solutions in this case, but you can always add Console.WriteLines and look at the device log.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chamons picture chamons  路  4Comments

juepiezhongren picture juepiezhongren  路  3Comments

michaelstonis picture michaelstonis  路  3Comments

therealjohn picture therealjohn  路  3Comments

ormaa picture ormaa  路  3Comments