0

I am new in iOS and I am facing problem regarding to check image exist on photo library or not.

My code is like this. Saving image to photo library:

 NSString *strImgURLAsString = @"Imagename.png";
    [strImgURLAsString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    strImgURLAsString = [strImgURLAsString stringByReplacingOccurrencesOfString:@" " withString:@"%20"];
    NSURL *imgURL = [NSURL URLWithString:strImgURLAsString];
    [NSURLConnection sendAsynchronousRequest:[NSURLRequest requestWithURL:imgURL] queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) {
        if (!connectionError) {
            img = [[UIImage alloc] initWithData:data];
            if (img==nil) {

            }
            procedureimage.image=img;

            UIImageWriteToSavedPhotosAlbum(img, nil, nil, nil);//Saving image to photo library.


            [customActivityIndicator stopAnimating];

            // pass the img to your imageview
        }else{
            NSLog(@"%@",connectionError);
        }
    }];

How can I check image exists in the photo library?

halfer
  • 19,824
  • 17
  • 99
  • 186
Muju
  • 884
  • 20
  • 54

0 Answers0