can I check if downloaded image is corrupt or not before saving it into my document director开发者_如何学运维y? if yes then please tell me how? thank you
UIImage *im = [[UIImage alloc] initWithData:YourNSData];
UIImageView *imview;
// test to see if the image was successfully created
if (im){
imview = [[UIImageView alloc] initWithImage:im];
}
Hope this helps
You could try to load the NSData
object in a UIIImage
with the initData
. Then check if the return UIImage
object is nil
.
This is not full proof methods, but should work.
精彩评论