为什么数据在从nsobject类导航到Viewcontroller时会被删除

时间:2016-12-05 05:48:14

标签: ios ios7 uinavigationcontroller

我目前正在一个项目中,我想从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]; 

0 个答案:

没有答案