• 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
Getting Image from Web and Displaying it problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Getting Image from Web and Displaying it problem


  • Subject: Getting Image from Web and Displaying it problem
  • From: John Tsombakos <email@hidden>
  • Date: Fri, 24 Jan 2003 00:22:45 -0500

I have a small app that is just supposed to download an image from the
web and display it in an ImageView. I have an image view in a window,
with a button and everything is wired up correctly. (Which is an
accomplishment in itself, as I'm on the newbie side of Cocoa). The
method the button calls when it's clicked is:

- (IBAction)getImage:(id)sender
{
NSString* string = @"http://www.rccl.com/rc/image/vywebcam.jpg";;

if (string) {
NSURL* url = [NSURL URLWithString:string];
if (url) {
NSData *imageData = [url resourceDataUsingCache:NO];
if (imageData) {
NSImage* image = [[NSImage alloc]
initWithData:imageData]; //****
if (image) {
[voyagerImage setImage:image];
} else {
NSLog(@"couldn't init image from imageData
%@\nLoaded from %@\nReferenced by %@\nwith url %@", imageData, url,
string);
}
} else {
NSLog(@"can't init imageData from url %@\n with string
%@", url, string);
}
} else {
NSLog(@"can't init url from string %@", url);
}
} else {
NSLog(@"couldn't get a string from sender %@", sender);
}
}

Now, it sometimes works, but at the line marked with **** it will
generate a message in the debug pane or put the line in the console:
"Application transferred too few scanlines".

I have no idea why! Is this the best way to do this?

Thanks!

jt
_______________________________________________
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.

  • Follow-Ups:
    • Re: Getting Image from Web and Displaying it problem
      • From: mw <email@hidden>
    • Re: Getting Image from Web and Displaying it problem
      • From: Scott Anguish <email@hidden>
  • Prev by Date: DSP framework for Cocoa
  • Next by Date: A good method for xml usage/parsing
  • Previous by thread: Re: DSP framework for Cocoa
  • Next by thread: Re: Getting Image from Web and Displaying it problem
  • Index(es):
    • Date
    • Thread