R
R
Roman19852015-05-15 15:29:41
iOS
Roman1985, 2015-05-15 15:29:41

Swift background fetching data from server?

I would appreciate your help in explaining my problem.
Task: Receive data from the server at specified intervals, in the background (ie when the application is minimized) and update the data table.
What does not work: receive data when the application is minimized
In connection with this, I have several questions:
Now I have implemented all the logic for receiving and processing data in the main ViewController class, using NSTimer and network requests. If I run the application on the simulator and minimize it, then the application continues to work normally and receive data. However, when launched on a real phone, when the application is minimized, it stops. Is this a bug or is this normal behavior?
I read about Background Fetch - do I understand correctly that this mechanism was created to solve problems like mine?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
An, 2015-05-15
@Roman1985

Yes. You need a Background Fetch
But just pay attention, you can't specify the exact update time, but only some abstract one. The OS itself will determine when it will have extra resources and wake up your application for a short time

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question