0

i am using location in my app and tested it with IOS 3 simulatior it works fine also on device it works fie. but when tested it on IOS4 simulator it crashes..and unable to find location I know that the location on simulator is of infinite loop cupertino california. but it is not working in IOS4...

and i don't have Iphone4...So can't test further

please help

Björn Marschollek
  • 9,899
  • 9
  • 40
  • 66
Ranjeet Sajwan
  • 1,925
  • 2
  • 28
  • 60
  • Do you mean testing in the iPhone and iPhone 4 versions of the simulator? – Paul Ardeleanu Oct 30 '10 at 08:44
  • YES...................................... – Ranjeet Sajwan Oct 30 '10 at 08:51
  • When you say it crashes, what exactly is the error you're getting? Did you try using NSZombies? http://stackoverflow.com/questions/535060/how-to-add-nsdebug-h-and-use-nszombie-in-iphone-sdk – Paul Ardeleanu Oct 30 '10 at 09:11
  • iphone simulator doesn't use the default location if you have your wifi enabled. it tries to get your location from your airport. to avoid crashing from not mapped hotspot, you need to provide a default location (see my answer for this). – pasine Oct 31 '10 at 14:02

1 Answers1

1

Maybe the simulator can't retrieve the default CLLocationManager location. You can try this:

- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
    location = newLocation.coordinate;

// Manually setting a default location for simulator only
    if(TARGET_IPHONE_SIMULATOR){
    location.latitude= 45.00;
    location.longitude= 45.00;
    }
}
pasine
  • 11,311
  • 10
  • 49
  • 81