1

My target is to run iOS app in background by receiving silent-pushes and post UILocalNotifications with some data downloaded from internet and decrypted inside app. I did it using method didReceiveRemoteNotification:fetchCompletionHandler: and pushing empty silent notifications from my server when some data is available to client.

But if user force closes app - this method is not called at all. And user is not notified about something available for him.

Then I added some text to push notification. So some time it all works as I want, but several hours later it become to show 2 notifications for 1 event. First - visible but not sensitive notification from server and local notification with sensitive data.

I just wanna always download data by push and show local notification and when my app is force closed - show just a notification that "something" happens.

UPDATE:

Looks like my question is closely related to Will iOS launch my app into the background if it was force-quit by the user?

The most strange thing is that: I did wanted behavior and it works for several hours. I don't know how exactly I achieved this, but here are my screenshots, where app was suspended and also was manually killed from switcher:

enter image description here enter image description here

I think it can be some kind of trick with this: https://stackoverflow.com/a/8749035/440168 Because my code changed app badge. But may be this was an apple bug that it happens...

Community
  • 1
  • 1
k06a
  • 17,755
  • 10
  • 70
  • 110

0 Answers0