• 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: Using NSURL
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using NSURL


  • Subject: Re: Using NSURL
  • From: John Blackburn <email@hidden>
  • Date: Thu, 21 Mar 2002 12:14:47 -0800

You're better off using NSURLHandle to load the data in the background. When the data's done loading, your URLHandleResourceDidFinishLoading: gets called with the file's data:

- (void)initiateLoad:(NSString*)urlString
{
NSURLHandle* handle = [[NSURL URLWithString:urlString] URLHandleUsingCache:YES];
[handle addClient:self]; // add self, so your URLHandleResourceDidFinishLoading: will get called
[handle loadInBackground];
}

- (void)URLHandleResourceDidFinishLoading:(NSURLHandle *)sender
{
NSData* fileData = [sender resourceData];
// do something with the data
}

John Blackburn

On Thursday, March 21, 2002, at 07:41 PM, David Ahmed wrote:

Hi!

I'm trying to download a small text file from the internet (actually it's in
my idisk 'sites' folder) into an object so that the application can update
certain variables. Can anyone show me an example of NSURL in action or
suggest a suitable approach?

Many thanks!

David
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Using NSURL (From: David Ahmed <email@hidden>)

  • Prev by Date: Re: Using NSURL
  • Next by Date: Re: NSTextView and setString
  • Previous by thread: Re: Using NSURL
  • Next by thread: Image missing in Palette?
  • Index(es):
    • Date
    • Thread