Re: NSURL / NSURLHandle loading problem
Re: NSURL / NSURLHandle loading problem
- Subject: Re: NSURL / NSURLHandle loading problem
- From: Don Arbow <email@hidden>
- Date: Mon, 19 May 2003 19:57:08 -0700
On Monday, May 19, 2003, at 04:41 PM, Ben Haller wrote:
OK, I'm mystified. I'm just trying to load, in the foreground, the
data from a URL (at my website:
http://www.sticksoftware.com/index.html). The website is up, and IE
can fetch the URL with no problems. So my first-pass code was very
simple: make a URL from the string, call resourceDataUsingCache:NO.
That returned nil, as did resourceDataUsingCache:YES. Then I shifted
over to using NSURLHandle, to see if that would work any better, but
-loadInForeground returns nil (-status returns 0 and -failureReason
returns nil, so it's a mystery what the problem is -- it seems to be
ignoring my request that it load). So then I added all the
NSURLHandleClient methods and tried doing a background load. And
that's when things get really wacky. I put logs in my client methods,
and here's what I get:
Ben,
The best way to get an answer is the explicitly show us the code that
you are having a problem with. It is difficult to figure out what is
wrong from reading your description of what you tried to do. Here is an
example of how to use NSURL (from the url below):
Loading a string from a website
(this will block until it loads)
NSURL *url;
NSData *data;
NSString *blork;
url = [NSURL URLWithString: @"
http://borkware.com/hacks/random"];
data = [url resourceDataUsingCache: NO];
blork = [[NSString alloc] initWithData: data encoding:
NSASCIIStringEncoding];
http://borkware.com/quickies/one?topic=NSURL
Don
_______________________________________________
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.