ios - CLLocationManager not calling its delegate method -
i developing app involves tracking new location , updates server in x mins. stopping location updating when time diff equal or greater x mins, sending server , start updating location if less x mins. didupdatetolocation delegate methos not called when less x mins.
i posting code here:
- (void)locationmanager:(cllocationmanager *)manager didupdatetolocation:(cllocation *)newlocation fromlocation:(cllocation *)oldlocation { if (thediff > 10.0f || mydate == nil) { [self stopupdating]; } else { [self.mlocationmanager startupdatinglocation]; } }
try this.,
//in .h cllocationmanager *locationmanager; @property (nonatomic,retain) cllocationmanager *locationmanager; // synthesize in .m @synthesize locationmanager; //in viewdidload locationmanager = [[cllocationmanager alloc] init]; locationmanager.delegate = self; locationmanager.distancefilter = kcldistancefilternone; // whenever move locationmanager.desiredaccuracy = kcllocationaccuracyhundredmeters; // 100 m [locationmanager startupdatinglocation];
this call method whwnever move phone. can check changing simulator locatin also.
hope helps., thanks, happy coding.
Comments
Post a Comment