On Feb 17, 2010, at 3:21 PM, Paul Johnson wrote:

> I am working on a Document-based application that needs to have a
> certain file in ~/Library/Application Support/<appname> before it can
> do anything. It needs to be created the first time the program is run
> (or if it has been deleted by the user).
> 
> I've created a class XXAppDelegate and declared it as implementing the
> NSApplicationDelegate protocol, and I defined
> -(void)applicationDidFinishedLaunching:(NSNotification*)aNotification.
> In this method I want to perform the file creation. Does this sound
> like I'm on the right track? (Newbie as you can tell.)
> 
> I should add that the file needs to be created by accessing the
> internet and could take even a minute to finish, so I will no doubt
> have to worry about informing the user about the delay when the
> program is run for the first time, but before I charge in this
> direction I would appreciate some affirmation I'm on the right track.

Yes, you're on the right track.  You could start it earlier by putting it in 
-applicationWillFinishLaunching:, but I wouldn't bother in your case.  If the 
file could be created immediately, and if other parts of your app which might 
run between -applicationWillFinishLaunching: and 
-applicationDidFinishLaunching: would be simpler to code by assuming it's 
already present, then doing it in the earlier method would be good.  Since it's 
going to take a while to download the file, there's no real benefit to starting 
it earlier.

Regards,
Ken

_______________________________________________

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