I have tried using NSTimer for scheduling a timely background task. However, it stopped working at some point ( Don't know what the issue was) and also it stops when user tries to intentionally kill the application.
I am required to call an API after every 1 minute irrespective of my app being in foreground and background. Similar to native iOS alarm app(kind of creating an repeating alarm).
Please any help would be appreciable. Thanks in advance.
P.S. I am new to swift development.
The short answer is "You can't do that." Apple does not allow 3rd party apps to run continuously in the background, with a few very specific exceptions (Navigation apps and streaming music apps are examples.)
For testing, you can set your app up as a navigation app and it will be allowed to run continuously in the background, but you'll get rejected when you try to submit it to the app store.