-1

I am converting url data into UIImage. This is my code.

NSURL *url = [NSURL URLWithString:strImgURL];
NSData *data = [NSData dataWithContentsOfURL:url options:NSDataReadingUncached error:&error];
NSLog(@"Image Error-------%@",[error localizedDescription]);
imgProf = [[UIImage alloc] initWithData:data];

but My data always returns <>

(lldb) po data
<>

But when I type this url in browser I can get the image. What is the reason for this? Please help me. Thanks

user1960169
  • 3,533
  • 12
  • 39
  • 61

1 Answers1

0

You're getting an empty response because your code (app) can't authenticate with the server by the sounds of it. This should generally be returned as an error but it depends on the response from the server.

You need to deal with the authentication first, so the app has an auth token or cookie or something and then you can make your request (potentially supplying the auth details in headers).

Wain
  • 118,658
  • 15
  • 128
  • 151