I have an app that uses CloudKit and I have a notification sent if I create a “Notification” record with “Username” set to the signed in user. This works, but a user could have 2 devices, say an iPhone and an iPad, and be signed in to both devices with the same iCloud account, but be using different app accounts. For example:
iPhone - signed into iCloud as “User”, signed into app as “UserPersonal”
iPad - signed into iCloud as “User”, signed into app as “UserBusiness”
The problem is that CloudKit is tied to the iCloud account so in the above example both the iPhone and iPad will get notifications meant for both “UserPersonal” and “UserBusiness”. In this example I want “UserPersonal” notifications to just go to the iPhone and “UserBusiness” to go to just the iPad.
I see that Apple has added the ability to filter notifications with a Notification Service Extension Filtering Entitlement:
I already use a notification service extension so I could use this to filter the notifications going to the same iCloud account and check if it is for the user who is signed into my app account. But, you have to apply to Apple for this entitlement and it says:
“This entitlement is intended for certain types of apps — such as messaging apps or location sharing apps — that use notification service extensions to receive push notifications without delivering notifications to the user.”
This is not really my use case.
Is there any way I can have a CloudKit notification just go to either app user “UserPersonal” or “UserBusiness” even though they are signed into the same iCloud account? Or, should I just try applying for the Notification Service Extension Filtering Entitlement?