NSData to NSString following resourceDataDidBecomeAvailable:
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 unarchiveObjectWith
Data:]: 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.