How to get a Xamarin iOS notification service extension working?

626 Views Asked by At

I'm trying to add a notification service extension to my Xamarin iOS so that I can receive silent notifications. I'm using OneSignal and have followed their instructions and set up everything that I think is required:

  • App bundle id = com.abc.abcapp
  • Extension bundle ID = com.abc.abcapp.OneSignalNotificationServiceExtension
  • Added extension project reference to app
  • Enabled App Groups in app & extension and set to group.com.abc.abcapp.onesignal (also registered this in Apple developer portal)
  • Using Automatic Provisioning for both, which seems to have registered everything properly

It builds fine. I have Visual Studio 2022 deploy it to a physical iPhone plugged into my computer. It deploys fine. But notifications don't appear to go to the extension. They just go to the App, which limit the number of silent notifications I can send to a device to a few an hour.

Some possibly useful debugging?

  1. Getting the phone's device log in Visual Studio is really hit or miss but at one point I did see this err:

Library Validation failed: Rejecting '/private/var/containers/Bundle/Application/11D98889-9C2C-4218-A2C8-227C93CBD579/Abc.app/PlugIns/OneSignalNotificationServiceExtension.appex/libOneSignalNotificationServiceExtension.dll.dylib' (Team ID: none, platform: no) for process 'OneSignalNotific(2868)' (Team ID: CJTV38PNRD, platform: no), reason: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.

  1. When I try to build this in MS App Center, it doesn't recognize that I have an extension and doesn't let me associate a second profile or cert. (which I think it's supposed to do?)
1

There are 1 best solutions below

1
On

According to documentation You can’t modify silent notifications or those that only play a sound or badge the app’s icon.