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

Re: dataWithContentsOfURL


  • Subject: Re: dataWithContentsOfURL
  • From: Marc Laffitte <email@hidden>
  • Date: Wed, 7 Nov 2001 16:17:24 +0100

Hi!

You may send the loadResourceDataNotifyingClient:usingCache: message to an NSURL instance.
Then you will get resourceDidFailLoadingWithReason: messages if appropriate.

You may also look at my message in this list with subject "Re: How to cancel a NSURL action" for a proposition on how to cancel a download in progress using threads. (However, the line with "[pool_ release];" in "- (void) stopThread" must be remove because it produces autorelease problems which may lead to a crash - I don't know why).

Marc

On mercredi, novembre 7, 2001, at 06:44 , Angela Brett wrote:

Hi,

I'm using NSData's initWithURL: method to download files from the internet. However, if I disconnect from the internet, the dataWithContentsOfURL never finishes, so my program can't continue. I was hoping that if it couldn't finish downloading the data, it would return nil so I could just keep going and do something about the lack of data. How can I get the dataWithContentsOfURL to stop if the connection dies or it can't finish getting the data for some other reason? I can see there's URL:resourceDidFailLoadingWithReason: in the NSObject docs, but I don't know if that's what I need to use or how to use it.
-- Angela Brett email@hidden http://acronyms.co.nz/angela
"We must believe in free will, we have no choice!" -- Isaac Bashevis Singer
_______________________________________________
cocoa-dev mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/cocoa-dev


  • Follow-Ups:
    • Re: dataWithContentsOfURL
      • From: Angela Brett <email@hidden>
References: 
 >dataWithContentsOfURL (From: Angela Brett <email@hidden>)

  • Prev by Date: Re: [Q] Keyboard Event
  • Next by Date: NSData from NSMovie ?
  • Previous by thread: Re: dataWithContentsOfURL
  • Next by thread: Re: dataWithContentsOfURL
  • Index(es):
    • Date
    • Thread