Re: how do I determine if this is the first time the app is launched?
Re: how do I determine if this is the first time the app is launched?
- Subject: Re: how do I determine if this is the first time the app is launched?
- From: Gregory Weston <email@hidden>
- Date: Sun, 25 Jun 2006 07:13:52 -0400
Alan Smith wrote:
I tried checking if the preference file existed but apparently but by
the time it awakeFromNib it is there. I need to add some things to the
defaults so that the rest of my app can use them. I also don't want to
overwrite them every time is launches, that would defeat the purpose.
I think you probably want to look at the registerDefaults: method of
NSUserDefaults. This can be used in two ways to achieve what seems to
be your goal.
1) To do what you actually asked, use register defaults to set up a
flag indicating that your app has run, and make it false. Then in
your awakeFromNib check that flag and if it's false set up all you
like and set the flag to true.
2) Or just use registerDefaults: to set up those values you want the
rest of the app to be able to use in the first place and forget about
the "first-run?" notion.
<http://developer.apple.com/documentation/Cocoa/Reference/Foundation/
Classes/NSUserDefaults_Class/Reference/Reference.html#//apple_ref/occ/
instm/NSUserDefaults/registerDefaults:>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden