0

I wonder if it's possible with swift, start a function at a certain time, especially if the app is closed.

I tried a bit around but did not find anything useful.

I hope you can help me. Thanks

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Stefano
  • 83
  • 9
  • You can schedule local notifications and show like a remote notification to the user. Other than that, I think no. Your app can't run processes when it is not running, given how it leaves a lot of room for privacy breach and malicious activities. If it is running, you can schedule operations for a certain time using same local notifications. – NSNoob Oct 04 '17 at 10:54
  • That is shady shit, doing it after application is closed. You have an `applicationWillTerminate` method in your App delegate, that I think is the closest you come – Lars Nielsen Oct 04 '17 at 10:55

1 Answers1

-1

You can try to override functions like

applicationDidEnterBackground

applicationWillTerminate

applicationDidBecomeActive
Rishabh Dugar
  • 606
  • 5
  • 16
  • You can't override this AppDelegate methods you need to add an observer at the view controller with a selector – Leo Dabus Oct 04 '17 at 11:38