Re: Newbie questions
Re: Newbie questions
- Subject: Re: Newbie questions
- From: Ondra Cada <email@hidden>
- Date: Tue, 25 Apr 2006 15:10:02 +0200
Xavier,
too little information for us to be able to help :)
On Apr 25, 2006, at 2:42 PM, Xavier Elizalde wrote:
1. It says on page 294 in Chapter 15 that you can override
preference settings with "Application -[Key name] [Value name]"
from the Terminal. But whenever I try to do that, it gives me an
error, saying there is no directory with the same name as the [Key
name] in my home directory. Is there a newer way to do this that
works properly?
How do you try that exactly?
It works like this: to launch manually e.g., TextEdit with pref Foo
set to Bar (which of course would do nothing, for TextEdit ignores
pref "Foo"), you have to enter this in Terminal:
/Applications/TextEdit.app/Content/MacOS/TextEdit -Foo Bar
If you -- as can be assumed -- instead want to do this directly from
Xcode, use the executable Get Info, and in the arguments pane just
add something like "-Foo Bar".
2. On page 296, the third exercise at the end of Chapter 15 says to
modify the example application "so that it reads its application
defaults from a .plist file contained as a resource in its
application bundle" rather than in ~/Library/Preferences. I can't
figure out how to do that.
Haven't read the book, but if I follow properly what it meant by
that, the appropriate code should look kind of like this (written in
Mail, typos etc. probable :), no error checking (you should take
e.g., case there is no plist gracefully)):
NSString *plistPath=[[NSBundle mainBundle]
pathForResource:@"YourPlistName" ofType:@"YourPlistSuffix"];
NSDictionary *plistContent=[NSDictionary
dictionaryWithContentsOfFile:plistPath];
[[NSUserDefaults standardUserDefaults] registerDefaults:plistContents];
---
Ondra Čada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc
_______________________________________________
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