How to save set of images to photo gallery in iphone app

I have to save some set of images to photo gallery in one button action.

for (j=85; j<100; j++)
           UIImage *saveImage=[UIImage imageNamed:[NSString stringWithFormat:@"%d.png",j]];

I use the above code.image name starts with 85.png and ends with 100.png.It saves 4 or 5 images afterthat it shows some lines in output window as follows

-[NSKeyedUnarchiver initForReadingWithData:]: data is NULL

could anyone fix this problem?


Call Your Save method after some time delay. The image takes sometime to save in photo gallery. And when you save multiple images continuously then processing overwrites and method of saving image doesn't work.

So, delay at least 0.5 second for each image. I used this in my case see below method...

first declare

NSInteger frameCount; 
NSTimer pauseTimer;

globally. and make a method name


now on your save button click call this method

    [self startTimer];

    frameCount = 85;
pauseTimer = [NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(myFunctionForSaveToPhoneLibrary) userInfo:nil repeats:YES];



UIImage *saveImage=[UIImage imageNamed:[NSString stringWithFormat:@"%d.png",frameCount]];

     [pauseTimer invalidate];
     NSLog(@"Images are saved successfully");

it will Work ..... Thank You!!

Need Your Help

Generate truth table for n operators

list functional-programming lisp scheme

I've been tasked with writing a function that generates a table given n operators. The truth table must be in a list and each row of the table must be in separate lists (inside the main list).

How to use the SSH key for Bitbucket projects?

git ssh bitbucket

My steps to generate and use the SSH key in Bitbucket: