Hi guys
I'm looking at a tutorial in which an instance of CLLocationManager is being used. This instance is created in AppDelegate. It also uses info.plist to show an alertView to ask the user for permission to use his location. I wonder if somebody could explain me why this isn't done in a plain ViewController?
I looked in the documentation and found "
Keeping a strong reference to the location manager object is required until all tasks involving that object are complete. Because most location manager tasks run asynchronously, storing your location manager in a local variable is insufficient."
However if you just went let lm = CLLocationManger() in a ViewController at the top you would have a strong reference to it to or am I mistaken? As the documentation states I cannot instantiate it in a function.
Once again my sincere gratitude.
I'm looking at a tutorial in which an instance of CLLocationManager is being used. This instance is created in AppDelegate. It also uses info.plist to show an alertView to ask the user for permission to use his location. I wonder if somebody could explain me why this isn't done in a plain ViewController?
I looked in the documentation and found "
Keeping a strong reference to the location manager object is required until all tasks involving that object are complete. Because most location manager tasks run asynchronously, storing your location manager in a local variable is insufficient."
However if you just went let lm = CLLocationManger() in a ViewController at the top you would have a strong reference to it to or am I mistaken? As the documentation states I cannot instantiate it in a function.
Once again my sincere gratitude.
Last edited: