English 中文(简体)
A question related to NSUserDefault
原标题:A question related to NSUserDefault
  • 时间:2010-06-28 10:14:10
  •  标签:
  • iphone

我已经确定,

这是我下面在应用中确定的方法。

NSString *string4 = @"Objective-C";

NSUserDefaults* defs7 = [NSUserDefaults standardUserDefaults];
[defs7 setObject:string4 forKey:@"subject_textfield"];

下面是应用有限发射方法中的我。

NSUserDefaults* defs7 = [NSUserDefaults standardUserDefaults];
subject_textfield.text = [defs7 stringForKey:@"subject_textfield"];

but,when i press home and then i again launch application at that time i m getting nil value for subject_textfield.text.

为什么如此?

最佳回答

使用<代码>[NSUserDefaults standardUserDefaults]的同步];以强制实施NSUserDefaults正在得到拯救。

参考:

Because this method is automatically invoked at periodic intervals, use this method only if you cannot wait for the automatic synchronization (for example, if your application is about to exit) or if you want to update the user defaults to what is on disk even though you have not made any changes.

问题回答

http://www.un.org/Depts/DGACM/index_french.htm 不得在<代码>iOS4上打电话。 如果你在SOS4,检查下列事件:

didFinishLaunchingWithOptions
applicationWillResignActive

applicationWillEnterForeground
applicationDidBecomeActive




相关问题
Code sign Error

I have created a new iPhone application.I have two mach machines. I have created the certificate for running application in iPhone in one mac. Can I use the other mac for running the application in ...

ABPersonViewController Usage for displaying contact

Created a View based Project and added a contact to the AddressBook using ABAddressBookRef,ABRecordRef now i wanted to display the added contact ABPersonViewController is the method but how to use in ...

将音频Clips从Peter改为服务器

我不禁要问,那里是否有任何实例表明从Peit向服务器发送音响。 I m不关心电话或SIP风格的解决办法,只是一个简单的袖珍流程......

• 如何将搜查线重新定位?

我正试图把图像放在搜索条左边。 但是,问题始于这里,搜索条线不能重新布署。

热门标签