wajeeh wajeeh - 1 year ago 86
iOS Question

Real time notifications on iOS

I am developing an iOS app which needs to receive regular data from the server at specific period of time (every 5 seconds).

Apple gives developers some choices for background working.

I convinced that

Background Fetch
is the proper method for my problem.
But when I tested it I got confused.
Background Fetch
has many issues with my requirements:

  1. It does not fetch data at period you defined when declared it:

    I tried this and this:
    . But no guarantee
    that your app will fetch data at this interval.

  2. When the screen is off, your app will not make any fetch until the
    phone is unlocked again.

I wonder if there is a way that let my app receives real time data (or at least every 5 seconds).

Note: I read about
remote notifications
and I do not guarantee that I can execute it now, So I am searching for other solutions.


Answer Source

There is no solution to this problem until writing this answer.

If I need a real time notification then I must use Push Notification.

There is no way to check for server data every period of time from the app only, I can send a Remote Notification when new data available on server to wake up the app and let it connect to the server.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download