简体   繁体   中英

Running iOS App In The Background

There are many questions on the topic of running an iOS app in the background, but I'd like to use this question to clarify a few points.

First, if you are going to submit your app to the app store, you can only run in the background as an audio/voip/location/airplay app. You can also receive push notifications.

However, if you are developing an enterprise app, or otherwise don't have to worry about getting approval for the app store, do any additional options become available? There are two cases I want to explore:

  1. Running an app in the background constantly (processing or transmitting data)
  2. Scheduling an app to start a process at a given time

Bonus: If #2 and the app is closed, is it possible to start the app?

Running an app in the background constantly (processing or transmitting data)

The restrictions on background processing are built into iOS, not just imposed by the app store review team. You can try to fool iOS by labeling your app as, say, an audio app and then calling the appropriate audio API in addition to doing whatever else you want your app to do. In the long run, it seems much simpler to look for ways to accomplish your real goal while living with the restrictions. For example, if you need to get the user to do something periodically, use local notifications to get their attention, and then give them a good reason to want to do that task.

Scheduling an app to start a process at a given time

Not possible under the current API to the best of my knowledge. iOS will restart an app that previously requested notifications of significant changes, but that doesn't help if you want to relaunch at a given time. Your best bet, again, is to use a local notification and give the user a reason to launch the app.

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