1

I have an application which has communication with a remote server. The server should push data into it using remote notification silently, and I need to get and store these data into a CoreData database. The user won't be aware of the whole process.

I can successfully get notified when the app receives a remote notification, while it is either in the foreground or background mode. However, I need to get data while the app is terminated as well.

I searched for the possible solutions. For example, this SO question was good if I don't tend to use silent notification. I also saw the PushKit capability, but I am not sure about the Apple Review result.

  1. What is the possible solution?
  2. If I want to use VoIP and PushKit to get notified when the app is terminated, would Apple reject my application?
jscs
  • 63,694
  • 13
  • 151
  • 195
Hassan Shahbazi
  • 1,543
  • 9
  • 26
  • If your application category justifies VoIP, then Apple might not reject. For example if your building phone app then Apple might not reject, otherwise there are chances of rejection. – Raviprakash Feb 03 '18 at 13:41
  • @Raviprakash My app has communications with a Bluetooth-low-energy device and I want to use a server in order to configure it. Will it be compatible with the `VoIP` category? May I use `PKPushType: complication` which is designed for `Apple Watch`? – Hassan Shahbazi Feb 03 '18 at 13:45
  • With this much of details it is difficult to tell you category. I suggest you to contact Apple either via DTS questions or Technical evangelists. – Raviprakash Feb 03 '18 at 13:50

2 Answers2

2

If you’re not creating a VoIP app and you want your app to be in the App Store then the correct answer is: it is not possible. The only thing that can be done is adjusting your requirements in some way.

For instance you can send some notifications that will be visible for user in the Notification Center and wait until the user taps the notification or starts the app the usual way. Then the app will be able to do all the operations you need.

algrid
  • 5,600
  • 3
  • 34
  • 37
2

The delivery of push notifications is not guaranteed, so you should not rely on them to synchronise data.

For example, if multiple push notifications are sent while the device is offline, only the last notification is delivered when the device comes back online; the earlier notifications are lost.

When your app launches one of the first things it should do is check with your server for new data.

Paulw11
  • 108,386
  • 14
  • 159
  • 186
  • This is another disadvantage of using Push Notification. Do you have any alternative solution for server to push some data into my application silently? I don't want to involve user in the process. – Hassan Shahbazi Feb 04 '18 at 06:50
  • You can use silent push notification but you also need to check with your server when the app is launched – Paulw11 Feb 04 '18 at 06:53
  • Silent push notification won't delivered when the app is terminated, in addition, that will involve users to open the application. What about PushKit? Would it be the solution? – Hassan Shahbazi Feb 04 '18 at 06:54
  • You can only use pushkit if your app is a voip app. What does it matter if the push isn't received? The user isn't running your app to see the new data anyway. When they do launch your app then you get the new data from the server and they see the new data then. – Paulw11 Feb 04 '18 at 07:04
  • The notification contains some configurations for the connected BLE device. The goal is to configure our BLE device through our web dashboard without user involvement. – Hassan Shahbazi Feb 04 '18 at 07:06
  • Then you should explain to your users the importance of not terminating the app. – Paulw11 Feb 04 '18 at 07:11