I have a situation where I have to present alert while my app is in background. So I was thinking that the solution is Local notification. But the problem is that, I want to show that alert only when user has crossed a particular predefined location point.
So I have to show the notification without any registration for it in Foreground(Or you can say register the local notification in background).
Is it doable ?
Please help.
Yes, you can let your run in the background while you still receive location updates.
You have to the add location
to UIBackgroundModes
in your apps info.plist
;
And any instance of CLLocationManager will keep receiving location updates. But be aware that this could drain the battery of the iPhone really fast, so it's a good idea to only monitor major location changes.
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.