I am trying to set a user default when my application is killed in the background, this code does not work unless the application is open then you background kill it, if the application is closed it does not work. Is there any way around this? I need to make it so that if the application reloads after being killed fully that it will do the following but if put into the background and reloaded it won't do anything.
- (void)applicationWillTerminate:(UIApplication *)application {
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
[userDefaults setObject:@"KILLED" forKey:@"grabngostoreselected"];
[userDefaults removeObjectForKey:@"grabngocartid"];
[userDefaults removeObjectForKey:@"grabngocartq"];
}