我目前正在一个项目中,我想从NSObject类导航到ViewController,我已经成功导航到ViewController,但我已经在NSUserDefault中保存了一些数据,在那个特定的ViewController中,所有数据都变为NULL,任何人都可以帮助数据丢失的原因
我用于导航的代码:
case ENDED:
{
dispatch_async(dispatch_get_main_queue(), ^{
UIWindow *window=[UIApplication sharedApplication].keyWindow;
UIViewController *root = [window rootViewController];
UIStoryboard *storyboard = root.storyboard;
myTappointmentInfo *vcc =(myTappointmentInfo *) [storyboard instantiateViewControllerWithIdentifier:@"home"];
[root presentModalViewController:vcc animated:YES];
});
break;
}
这些数据是我在导航时从之前的viecontroller获得的
[[NSUserDefaults standardUserDefaults] setObject:recDic forKey:@"dictionaryKey"];
[[NSUserDefaults standardUserDefaults] setInteger:recRowClick forKey:@"recUDclick"];
[[NSUserDefaults standardUserDefaults] synchronize];