Try this code to get the image ...
The code:
NSURL *url = [NSURL URLWithString:@"http://www.fnordware.com/superpng/pnggrad16rgb.png"]; NSData *data = [NSData dataWithContentsOfURL:url]; UIImage *image = [UIImage imageWithData:data]; [self.imageview1 setImage:image];
Note: I used the test URL. you can use your url.
Update: Swift 3.0 Code :
let url = URL(string: "http://www.fnordware.com/superpng/pnggrad16rgb.png") do { let data = try Data(contentsOf: url!) var image = UIImage(data: data) self.imageView.image = image print(image) } catch { }
Note. . In Xcode version 7.1 and above, you need to install ATS (application transport security). To install ATS, you need to write the code below in the info.plist file. Make sure the image URL should not be zero.
<key>NSAppTransportSecurity</key> <dict> <key>NSAllowsArbitraryLoads</key> <true/> </dict>
source share