Is it possible to have my closed app run code in iOS?

后端 未结 3 2032
暖寄归人
暖寄归人 2021-01-14 01:17

Let\'s say that my app in iOS is closed. Would it be possible to set it up so that it runs a piece of its code after a certain period of time?

相关标签:
3条回答
  • 2021-01-14 01:42

    Short answer: no, you can not. At the most, your application will keep running in the background for 11 minutes, if you request the extra time (check the documentation for beginBackgroundTaskWithExpirationHandler on the UIApplication class). There are some things you can do: Schedule a local notification, which the user can use to launch the app, or use push notifications to remind the user of something he needs to know.

    0 讨论(0)
  • 2021-01-14 01:44

    You can have your app schedule push notifications, but you can't schedule it to run specific code unless it's running.

    0 讨论(0)
  • 2021-01-14 01:52

    iOS allows background processing for the following reasons: - location dependent functionality - background audio playback - voip

    You can find out more from Apple's multitasking documentation

    0 讨论(0)
提交回复
热议问题