Can not create UIImage out of NSData for .jpg images

Discussion in 'iOS Programming' started by usuf2484, Jul 1, 2009.

  1. usuf2484 macrumors newbie

    Joined:
    Jun 30, 2009
    #1
    Hi,

    I have got the data for a .jpg image from the url like below

    NSData *imageData = nil;
    NSURL *url = [NSURL URLWithString:someurl.jpg];

    imageData = [NSData dataWithContentsOfURL:url];

    I can see that data has come, now i try to create image out of this data

    UIImage *theImage = [[[UIImage alloc] initWithData:imageData] autorelease];

    But theImage always is 0x0.

    I tried using initWithContents of file and as well as the class functions in the UIImage class but no luck.

    The image gets displayed on the browser.

    Can any one please help with this regard, what am i doing wrong.

    Thanks and Regards,
    U'suf
     
  2. usuf2484 thread starter macrumors newbie

    Joined:
    Jun 30, 2009
    #2
    Got it!

    It was my network proxy problem... It was blocking the url and sending me a html file instead of the image stating it could not authenticate..
     

Share This Page