• 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
Re: NSImage initWithContentsOfURL:
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSImage initWithContentsOfURL:


  • Subject: Re: NSImage initWithContentsOfURL:
  • From: Louis Demers <email@hidden>
  • Date: Tue, 4 Sep 2001 19:31:26 -0400

At 4:02 AM -0700 9/4/01, Michael Meisel wrote:
On Tuesday, September 4, 2001, at 01:33 AM, Scott Anguish wrote:

On Monday, September 3, 2001, at 07:59 PM, Matt Judy wrote:

is an outlet to an NSImageView. myImage is not getting drawn into
imageView.
The NSLog for myImageURL returns a URL to an image, which I can verify
in a web browser.
The NSLog for myImage returns (null). This seems fairly
straightforward... What am I
doing wrong?


I thought that many areas of AppKit still only worked with NSURLs of the
file:// type. Is this one of those places?

Yes, that appears to be the case. You can use this code to init your image properly:

NSURL *myURL = [NSURL URLWithString:myImageURL];
NSImage *myImage = [[NSImage alloc] initWithData:[myURL resourceDataUsingCache:YES]];

I would add, that even that technique doesn't support the full syntax, ie user and paswords... For access to password protected sites, I resorted to using cURL. It compiles fine une OSX and seems a much more robust implementation of the NSURL idea.


-Michael
_______________________________________________
cocoa-dev mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/cocoa-dev


--

Louis Demers ing.
2447 Bellevue
St-Romuald, Quebec
Canada G6W 2T8
418 839-9266 (res.)
418 655-2499 (cell.)
email@hidden
email@hidden


References: 
 >Re: NSImage initWithContentsOfURL: (From: Michael Meisel <email@hidden>)

  • Prev by Date: Re: Any advantages of Unix formatting
  • Next by Date: Can't change title of top-level menu
  • Previous by thread: Re: NSImage initWithContentsOfURL:
  • Next by thread: ObjC API != Cocoa (Re: Another controversial question)
  • Index(es):
    • Date
    • Thread