Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Default NSUserDefaults

Default NSUserDefaults
Thread Tools
davecom
Mac Elite
Join Date: Jan 2001
Location: New York
Status: Offline
Reply With Quote
Dec 15, 2001, 11:51 PM
 
Is there a non-programatic way to set-up a default NSUserDefaults?
     
Ghoser777
Professional Poster
Join Date: Dec 2000
Location: Chicago, Illinois
Status: Offline
Reply With Quote
Dec 16, 2001, 01:58 AM
 
I have no idea what that would mean. Please clarify. Do you want to drop an instance of NSUserDefaults on a NSWindow in IB or something? That doesn't make any sense, but I don't think the question does to begin with.

F-bacher
     
tie
Professional Poster
Join Date: Feb 2001
Status: Offline
Reply With Quote
Dec 17, 2001, 01:30 AM
 
He is asking whether there is some plist file you can put in your package where NSUserDefaults looks if it doesn't find a user preferences file.

I think the answer is no, not built in, though you could write your program to look elsewhere (when the defaults returns 0 or whatever). I haven't checked the documentation, though, I could be wrong.
The 4 o'clock train will be a bus.
It will depart at 20 minutes to 5.
     
davecom  (op)
Mac Elite
Join Date: Jan 2001
Location: New York
Status: Offline
Reply With Quote
Dec 18, 2001, 05:50 PM
 
Originally posted by tie:
<STRONG>He is asking whether there is some plist file you can put in your package where NSUserDefaults looks if it doesn't find a user preferences file. </STRONG>
Yes, this is what I was asking.
     
Angus_D
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
Dec 18, 2001, 06:12 PM
 
Why on earth can't you do it programmatically?
     
davecom  (op)
Mac Elite
Join Date: Jan 2001
Location: New York
Status: Offline
Reply With Quote
Dec 18, 2001, 06:20 PM
 
Originally posted by Angus_D:
<STRONG>Why on earth can't you do it programmatically?</STRONG>
Streamlined is the word of the day. I would like to keep it separate for clarity.
     
lindberg
Dedicated MacNNer
Join Date: Jan 2001
Location: Virginia, US
Status: Offline
Reply With Quote
Dec 18, 2001, 09:03 PM
 
You could add a Defaults.plist (or whatever) file to your app as a resource, and in applicationDidFinishLaunching, find the file via NSBundle, load it into an NSDictionary, and call registerDefaults with that dictionary. Most of the time I'm not sure it adds all that much to just hardcoding the values in the app, but in some situations I could see it. I suppose you could have localized settings this way.
     
davecom  (op)
Mac Elite
Join Date: Jan 2001
Location: New York
Status: Offline
Reply With Quote
Dec 18, 2001, 09:07 PM
 
Originally posted by lindberg:
<STRONG>You could add a Defaults.plist (or whatever) file to your app as a resource, and in applicationDidFinishLaunching, find the file via NSBundle, load it into an NSDictionary, and call registerDefaults with that dictionary. Most of the time I'm not sure it adds all that much to just hardcoding the values in the app, but in some situations I could see it. I suppose you could have localized settings this way.</STRONG>
So simple that I overlooked it. Thank you.
     
davecom  (op)
Mac Elite
Join Date: Jan 2001
Location: New York
Status: Offline
Reply With Quote
Dec 18, 2001, 09:19 PM
 
double post

[ 12-18-2001: Message edited by: davecom ]
     
   
Thread Tools
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 07:35 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,