I used this part of code in my Application for a while and it worked as expected. But now, it crashes on the line with setInteger:
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
int selEvent = [defaults integerForKey:@"selected_event"];
/*
* Do Something with selEvent
* New ID is in NSNumber event_id
*/
[defaults setInteger:[event_id intValue] forKey:@"selected_event"]; //Crashes on this line
[defaults synchronize];
Working in Xcode 4.5.1 and iPad 6.0 Simulator.
I’m getting a EXC_BAD_ACCESS.
Whats the cause of my problem?
Found my Problem:
This worked before with setInteger:
Changed all setIntegers with setObject .