Re: Beachball on Lengthy Task
Re: Beachball on Lengthy Task
- Subject: Re: Beachball on Lengthy Task
- From: Dave Keck <email@hidden>
- Date: Sun, 5 Apr 2009 15:36:18 -1000
> 1. Is there any concern of thread safety using this class?
> 2. How can I pass NSFileHandle the file URL of my files?
> 3. How could I create a method that will take the contents of the file and
> do something with them?
1. No. NSFIleHandle takes care of creating a separate thread for you,
and notifies your main thread when it's finished reading the given
file, with a NSFileHandleReadToEndOfFileCompletionNotification
notification.
2. If you have a NSURL and need to create a NSFileHandle with that,
simply use NSURL's -path method to get the NSURL's filesystem path.
Otherwise, just create your file handle with a NSString path using
-fileHandleForReadingAtPath:.
3. Register for the NSFileHandleReadToEndOfFileCompletionNotification
notification. Once it's received, you can access its respective
NSFileHandle using the notification's -object method.
All of this has happened before, and it will all happen again, as they
say. The answers to 2 & 3 can be found with a little searching - I
encourage you to do so.
David
_______________________________________________
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