Class Message
Class Message
- Subject: Class Message
- From: Kevin Bracey <email@hidden>
- Date: Mon, 29 Mar 2010 21:48:45 +1300
Hi all,
This may be a matter of style...
I have a simple class whose job it is to check if it's a first run and
create all the Folders required such as App Support and Logs, check
CFBundleVersion and if different from the last run update any App
Support files and reset any UserDefaults. That sort of thing.
I know how to do this, but I'm not sure of the best/simplest pattern
for Cocoa.
My Class has only 1 message and stores no instance data, all the
states are in the UserDefaults. Trash the Preferences .plist and you
get a nice fresh firstrun.
I currently have ad-hock code in the AppDelegate, duplicated
functionality in quiet a few apps and want to standardise on one way,
cutting down on the code I need to maintain
1. Is this the best place to use a Class Message such as +
( BOOL )firstRunError:(NSError **)error; I'm not sure as the main use
of Class Messages seems to be for convenience initialisers or
returning singletons.
2. But the alloc/init/autorelease seems like an over-kill when there
is no properties and one very quick call 99% of the time.
3. Maybe make it a function, I'm not strong on mixing C and Cocoa
source files and code, if this is the best way it would be great if
you can share some links to documentation or examples.
I'm happy to read-up on this, but haven't found anything that compares
the different approaches to skinning this cat. Perhaps there's a
better trick that I'm unaware of.
Thanks for any ideas
Kevin
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden