• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Beachball on Lengthy Task
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Beachball on Lengthy Task
      • From: Pierce Freeman <email@hidden>
References: 
 >Re: Beachball on Lengthy Task (From: Dave Keck <email@hidden>)
 >Re: Beachball on Lengthy Task (From: Pierce Freeman <email@hidden>)

  • Prev by Date: Re: Cocoa user pane equivalent?
  • Next by Date: Re: Puzzling run loop/autorelease pool question
  • Previous by thread: Re: Beachball on Lengthy Task
  • Next by thread: Re: Beachball on Lengthy Task
  • Index(es):
    • Date
    • Thread