views:

15

answers:

1

In ApplicationWillTerminate method NSString *state; this statement declares in AppDelegate method NSString *string1 ;this statement declares in AppDelegate method

NSUserDefaults *def = [NSUserDefaults standardUserDefaults];
[def setObject:state forkey:@"integer"];

In ApplicationDidFinishLaunching method

NSUserDefaults *def = [NSUserDefault standardUserDefaults];
string1 = [def stringForKey:@"integer"];

I have used 1 value per view and pass that value to state and string1 gets that value on application launch but if i done the state maintainance of that view again agian at the random time string1 becomes null I don't know why? Please help me Thankyou in advance

+1  A: 

What is the state? Are you sure you do not set it to nil somewhere? Another possibility is that you terminate the app before any of your views set the state. Try to nslog all places where you set the state and see if it always gets set properly.

spbfox