• 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
NSData to NSString following resourceDataDidBecomeAvailable:
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSData to NSString following resourceDataDidBecomeAvailable:


  • Subject: NSData to NSString following resourceDataDidBecomeAvailable:
  • From: John Lombardo <email@hidden>
  • Date: Sat, 13 Sep 2003 15:49:59 +0800

I've found that I can get the text output from a webserver using

[NSString stringWithContentsOfURL:
[NSURL URLWithString:[urlText stringValue]]]

This is good. However, I would also like to be able to use methods from the
NSURLClient informal protocol, such as...

- (void)URLResourceDidFinishLoading:(NSURL *)sender
- (void)URLResourceDidCancelLoading:(NSURL *)sender
- (void)URL:(NSURL *)sender resourceDataDidBecomeAvailable:
(NSData *)newBytes
etc.

...and could do so by setting self as the client when calling:

- (void)loadResourceDataNotifyingClient:(id)client
usingCache:(BOOL)shouldUseCache

The problem is that a) I don't know how to collate all the newBytes into one
large NSData object, and b) I don't know how to convert it back into a
string. I tried using NSUnarchiver on the individual newBytes, but it just
reports:

+[NSUnarchiver unarchiveObjectWithData:]: extra data discarded
End of archive encountered prematurely at 0

sux0r
john
_______________________________________________
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:
    • EVERY SINGLE FREAKIN TIME!! (Was NSData to NSString following resourceDataDidBecomeAvailable:)
      • From: John Lombardo <email@hidden>
  • Prev by Date: Re: Localization of Edit-Menu - Solution found
  • Next by Date: Re: Country code or name
  • Previous by thread: Re: Extracting info from notification
  • Next by thread: EVERY SINGLE FREAKIN TIME!! (Was NSData to NSString following resourceDataDidBecomeAvailable:)
  • Index(es):
    • Date
    • Thread