Is there a way to wakeup suspended app in iOS without user or server intervention

后端 未结 3 948
花落未央
花落未央 2020-12-09 09:16

Is there way to wakeup iOS app without using \"The significant-change location service\"?

I need to wakeup my app without server or user intervention Some thing simi

3条回答
  •  甜味超标
    2020-12-09 09:42

    You could opt out of multitasking. This way the app never enters background or gets suspended. Just wait for the correct time when the alert should be displayed. However, this probably is not the best solution considering the power usage. Also, the app needs to be active all the time. If the user presses the Home button the app is terminated. But the app does not get terminated when the user locks the device. This is the best thing you can do without using any undocumented apis.

    If you do not want your app to run in the background at all, you can explicitly opt out of background by adding the UIApplicationExitsOnSuspend key (with the value YES) to your app’s Info.plist file. When an app opts out, it cycles between the not-running, inactive, and active states and never enters the background or suspended states. When the user presses the Home button to quit the app, the applicationWillTerminate: method of the app delegate is called and the app has approximately 5 seconds to clean up and exit before it is terminated and moved back to the not-running state.

    Opting out of background execution is strongly discouraged but may be the preferred option under certain conditions.

    https://developer.apple.com/library/archive/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/BackgroundExecution/BackgroundExecution.html

提交回复
热议问题