Search code examples
iosiclouduilocalnotificationnsnotificationcenter

Syncing LocaLNotifications via iCloud in background


Using iCloud I'm syncing my app data through all of the user's Apple devices. The problem is that the user can create himself an alert and I want to do that if the user created a notification in the iPad, he would get the notification in the iPhone also, without the need of opening the app in the iPhone (to sync iCloud changes). I want the iCloud to sync in the background, only for the notifications thing.

Also, when a user gets a notification and opens the app in his iPad, the notification should be removed from all of his other Apple devices, it should be not seen in the notification center.

Is that even possible? Thanks a lot!


Solution

  • The only way for your app on the iPad to deliver a notification to the iPhone, assuming the app isn't already running on the iPhone, would be for the app to make a call to a server that would send an APNS notification to the iPhone.

    As far as removing the notification, you have this sort of control over local notifications, but not over remote notifications. I don't believe there's any way with APNS to remove the notification from the other devices.