• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: how do I determine if this is the first time the app is launched?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
  • Prev by Date: Re: Helper Tool on FireWire
  • Next by Date: Re: Helper Tool on FireWire
  • Previous by thread: Re: Clickable NSImageCell in NSMatrix
  • Next by thread: space bar keyboard short cut
  • Index(es):
    • Date
    • Thread