Reputation: 1853
CLLocationManager does not call back method:
locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status;
after user's permission.
I'm allocating CLLocationManager
instance in singleton class (sort of manager), assigning delegate to self, all is looking fine, but is not working.
Also I have many multithreading logic in my app, and I think, the problem is a deadlock or some other problem related to multithreading.
How can I reveal what is the problem.
P.S. I have also tried to call
startMonitoringSignificantLocationChanges;
on main thread and this does not help.
Upvotes: 2
Views: 1175
Reputation: 362
alloc/init CLocationManager as soon as viewDidLoad
gets called worked for me.
- (void)viewDidLoad {
[super viewDidLoad];
locationManager = [[CLLocationManager alloc] init];
}
Upvotes: 0
Reputation: 34780
Do you have a strong reference to the CLLocationManager
? It should be a strong property @property CLLocationManager *myManager;
or an ivar (instance variable) inside your class' implementation. If you are instantiating the CLLocationManager
inside a function/method, and not assinging any reference, it will be released as soon as you finish that function.
Have a strong reference to the instance.
Upvotes: 0