Re: Weird problem
Re: Weird problem
- Subject: Re: Weird problem
- From: Dan Wood <email@hidden>
- Date: Mon, 15 Oct 2001 10:52:17 -0700
This sounds similar to another problem that just appeared on one of
these lists a few days ago. Some URL-loading methods *only* seem
to work with file:// URLS and not network based URLs like http://.
I haven't seen a definitive list of what works and what doesn't,
but I believe you have stumbled on the fact that NSData works, but
NSImage doesn't.
The safest way I've seen is to actually get the data with NSURL or
NSURLHandle, e.g. [NSURL resourceDataUsingCache:]. By using
NSURLHandle, you're even better off, because you can cause your
load to take place in the background.
Dan
On Sunday, October 14, 2001, at 10:31 PM, Jeff LaMarche wrote:
Wonder if anyone might have some thoughts on this. I did this:
thumb = [[NSImage alloc] initWithContentsOfURL: thumbURL];
thumbURL is a valid URL to a JPEG image, however thumb ends up null.
Now, if I do this:
NSData *data;
data = [NSData dataWithContentsOfURL:thumbURL];
thumb = [[NSImage alloc] initWithData:data];
It works just dandy. Nothing else changed anywhere else, I just loaded
the image data to an NSData object and used that instead of the
original
URL to load the image. Is there something wrong with the way I
attempted
to load the image from a URL?
_______________________________________________
cocoa-dev mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
--
Dan Wood
email@hidden
http://www.karelia.com/
http://www.bikealameda.org/
Mac OS X Developer: Online Resume:
http://www.karelia.com/resume.html