Thursday, May 30, 2019

objective c - Delegation and retrieving info on IOS



I'm trying to get heading info from CLLocationManager but it's not getting called. I did everything as the documentation says, but something is very wrong.
I'm using locationManager delegating into my app delegate.



Here is the method to retrieve heading messages:




  - (void) locationManager:(CLLocationManager *)manager didUpdateHeading:(CLHeading *)newHeading
{
NSLog(@"%@", newHeading);
}


Here is the part from main()



  locationManager = [[CLLocationManager alloc] init];
[locationManager setDelegate:self];

[locationManager startUpdatingHeading];


But nothing happens! With debugging, NSLog is never getting called.
When I do same with [locationManager startUpdatingLocation] everything works fine, shows the location info, using another method (very same looking but using



- (void) locationManager:(CLLocationManager *) manager
didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation



but I need heading info here.


Answer



Found the deal.
Code is perfectly fine, the issue is in Iphone simulator.
Somehow it is providing location info just fine, but heading info is not provided thus the message is never sent.
Talk about weird things, apple.


No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...