I have at least two controllers in my app that currently use their own CLLocationManager instance. I'm curious however if using multiple instances actually imposes any additional burden on the phone - beyond the additional memory for the different instances.
Will the iPhone ping the GPS hardware multiple times, or does it use some sort of dispatch such that the hardware is abstracted and just forwarded to all listeners? I was about to write my own abstraction layer to handle multiple observers but wanted to check if there was any knowledge out there to suggest it's not necessary.
I would say no, it would not be a problem or performance penalty. Having multiple instances of CLLocationManager in one app is no more costly than having multiple apps in the background all with CLLocationManagers. The OS configures the GPS/cell radios for minimum power use based on the combined requests of all the CLLocationManagers.
Be sure to stop location updates on all CLLocationManager instances when your app doesn't need it anymore (ie: in applicationWillResignActive:) so the GPS h/w can be turned off to save battery.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With