EVERY SINGLE FREAKIN TIME!! (Was NSData to NSString following resourceDataDidBecomeAvailable:)
EVERY SINGLE FREAKIN TIME!! (Was NSData to NSString following resourceDataDidBecomeAvailable:)
- Subject: EVERY SINGLE FREAKIN TIME!! (Was NSData to NSString following resourceDataDidBecomeAvailable:)
- From: John Lombardo <email@hidden>
- Date: Sat, 13 Sep 2003 16:14:47 +0800
I've only ever asked questions here after having spent hours searching,
experimenting, and being totally stumped on a problem... And this time, like
every other time, moments after clicking "Send Now" in Entourage I happened
get an idea (or notice a detail, or inadvertently spot something relevant in
AppKiDo) that solves the problem...
This time the solution is:
[NSString stringWithCString:[newBytes bytes] length:[newBytes length]]
Thanks to Peter Ammon - Re: Initializing a string with an NSData
(2001.07.02)
Sending email makes me smarter.
John :)
(Except that I accidentally sent this email to myself, rather than the
mailing list)
On 13/9/03 3:49 PM, "John Lombardo" <email@hidden> wrote:
>
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.