Yes, if you are using an iPhone simulator , then this didUpdateToLocation will never be called, because location updates are not possible in the case of a simulator, I faced the same situation in one of my applications (testing the simulator becomes difficult) so I set the longitude and latitude in the case of the simulator in the didFailWithError method didFailWithError . As below
- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError*)error{ if( [(NSString *)[[UIDevice currentDevice] model] isEqualToString:@"iPhone Simulator"] ){ lat = 50.748129f; log = -2.970836f; return; } [[LocationManager sharedManager].locationManager stopUpdatingLocation]; [LocationManager sharedManager].isUpdating = NO; }
Now you can test your application with this location in the same way as with the device when searching for the current location.
I hope you have what I want to say
Good luck
source share