I have a CPImage:
-(void)setAvatarImageForMessage:(STMessage)aSTMsg{
var image = [[CPImage alloc] initWithContentsOfFile:aSTMsg.avatar_url];
[image setDelegate:self];
if([image loadStatus] == CPImageLoadStatusCompleted)
CPLog.debug("avatar image loaded");
else
CPLog.debug("avatar image FAILED!!!");
}
But am not sure if this is the correct way to download an image from a URL?
That's how you create an image, but you can't expect it to load immediately. Images (like just about everything else on the web) load asynchronously. If you need to know when the image has loaded, you can register for a notification.