How to have a working Geofence even if the app is not running? [duplicate]

你说的曾经没有我的故事 提交于 2019-12-08 01:54:53

问题


I'm creating a location aware application. I was able to create geofences already, when I test it in my iPhone, I noticed that the calllback methods -didEnterRegion and -didExitRegion are being called when the application is running in foreground and background. But when I killed the application (meaning the application state is "not running") the said method call backs are not being called.

So, what am I missing here? Is there any configuration that I need to do? Any thought guys? Thank you!


回答1:


This is correct behaviour depending on how you 'killed' the app. If you stopped the app by swiping up from the multi-tasking view (double tap home) then iOS 7 interprets this as meaning you do not want the app to operate at all - either in the foreground or background. If the app is 'killed' as a result of being in the background when the device needs more memory then it will continue to operate in background mode.

Refer to this answer - Region monitoring in ios 7

In order to test you can stop your application using Xcode, simulate a low-memory situation while your app is suspended or call exit() for testing purposes.



来源:https://stackoverflow.com/questions/22447050/how-to-have-a-working-geofence-even-if-the-app-is-not-running

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!