Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

icinnamon

macrumors newbie
Original poster
Sep 7, 2007
13
0
I have this code in one method:
Code:
        NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
        [defaults setObject:longitude forKey:@"longitude"];
        [defaults setObject:latitude forKey:@"latitude"];
        [defaults synchronize];
        directionsText.text = latitude;

And then I have this to access the user defaults:
Code:
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
        double oldLon = [[defaults objectForKey:@"longitude"] doubleValue];
        double oldLat = [[defaults objectForKey:@"latitude"] doubleValue];
        
        courseText.text = [NSString stringWithFormat:@"%@",oldLat];

When I run this second section of code, the program crashes (both on the simulator and iPhone!)! Is there some user configuration step that I'm missing?

Thanks!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.