简体   繁体   中英

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: application.setMinimumBackgroundFetchInterval(UIApplicationBackgroundFetchIntervalMinimum) I tried this and this: application.setMinimumBackgroundFetchInterval(5) . 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.

Thanks

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM