From what I can interpret from you, the question that needs to be formatted and made coherent, I believe that:
a) your value @"UserID" not synchronized with NSUserDefaults because you are not calling the -synchronize method. NSUserDefaults update the storage of key values in memory, but will not write it to disk, which means that it is lost at any time.
b) The fact that it does not fit loginView may be due to several reasons, most likely, this is already a subheading of your UIWindow . So, instead of reusing the login property in the application’s deletion, create a new View Controller instance variable and set rootViewController instead.
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex { if (buttonIndex == 0) { NSUserDefaults * defaults = [NSUserDefaults standardUserDefaults]; [defaults setObject:nil forKey:@"UserId"]; [defaults synchronize];
source share