• 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: How to download a file from a web site?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to download a file from a web site?


  • Subject: Re: How to download a file from a web site?
  • From: Lorenzo Puleo <email@hidden>
  • Date: Tue, 01 Apr 2003 15:17:32 +0200

Hi Joar, thank you.
I have already found the CURLHandle at the Apple Developer Site.
Then I went to http://curlhandle.sourceforge.net/ and download the file.
I supposed it was a Carbon API, so my Project Builder should show it, so I
wasn't able to find it :-)
Anyway, first I want to understand the basic rules using your code, then I
will affoard CURLHandle.

I made some fix to your code, I tell you just in case:
it's URLWithString and not urlWithString
it's addClient and not setClient

NSURL *url = [NSURL URLWithString: @"http://www.myDomain.com/myFile.sit";];

NSURLHandle *handle = [url URLHandleUsingCache: NO];
[handle flushCachedData]; // I added this
[handle addClient:self];
[handle beginLoadInBackground];

But PB won't compile.
MyObject.m:85: warning: class `MyObject' does not implement the
`NSURLHandleClient' protocol

Also I cannot guess where my file should be downloaded. How should define
the destination?
And to read a file without saving it to the disk?
Yes I am new of this topic.

Best Regards
--
Lorenzo Puleo
email: email@hidden

> From: j o a r <email@hidden>
> Date: Tue, 1 Apr 2003 14:30:41 +0200
> To: Lorenzo Puleo <email@hidden>
> Subject: Re: How to download a file from a web site?
>
>
> On Tuesday, Apr 1, 2003, at 14:20 Europe/Stockholm, Lorenzo Puleo wrote:
>
>> I took a look at the NSURLHandle documentation, and it lists many APIs
>> but
>> not the way to use them together. So I need some sample code or to
>> know the
>> theory about it. It's always the same story. Apple Documentation is
>> poor if
>> you never knew a topic.
>
> NSURL *url = [NSURL urlWithString: @"http://www.domain.com/file.tgz";];
> NSURLHandle *handle = [url URLHandleUsingCache: NO];
>
> [handle setClient: self]; // You need to implement the client methods
> [handle beginLoadInBackground];
>
> ...then wait for the handle to call the client methods. The beauty of
> NSURLHandle is that it manages asynchronous downloads for you with
> minimum fuss.
>
>> Also, you speak about CURLHandle that I cannot find. More, you say that
>> CURLHandle can manage the progress indicator automatically. Good.
>> But what should I use? CURLHandle or NSURLHandle APIs?
>
> CURLHandle is a subclass to NSURLHandle, so you can use it in place of
> NSURLHandle (or rather in place of one of the internal subclasses to
> NSURLHandle that Apple uses - NSURLHandle is a mostly abstract
> superclass).
>
> You have to decide for yourself if you should use NSURLHandle or
> CURLHandle. I use CURLHandle in one of my applications, because I
> thought I got a memory leak with NSURLHandle. In your case it might be
> more important that you can have it manage the progress indicator for
> you. Read the documentation and compare, choose the one that you think
> fits yor project best.
>
>> Last, sourceforge has many links. Whis is the right one?
>
> You can SEARCH for things!
>
> <http://www.google.com/search?q=CURLHandle>
>
> ...returns the right page as the first item in the search results.
>
> j o a r
_______________________________________________
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.

  • Follow-Ups:
    • Re: How to download a file from a web site?
      • From: j o a r <email@hidden>
  • Prev by Date: Re: stringWithContentsOfURL doesn't load the updated file
  • Next by Date: Re: stringWithContentsOfURL doesn't load the updated file
  • Previous by thread: Re: How to download a file from a web site?
  • Next by thread: Re: How to download a file from a web site?
  • Index(es):
    • Date
    • Thread