Hi Kevin,

since you said you don't need instance variables, why not do it with a category 
of AppDelegate or even NSApplication (not sure about this one, just throwing it 
in)?

Best,
Sebastian



Am 29.03.2010 um 10:48 schrieb Kevin Bracey:

> 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 (Cocoa-dev@lists.apple.com)
> 
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/sebastianmorsch%40mac.com
> 
> This email sent to sebastianmor...@mac.com

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to