I am very puzzled on this matter that I can only write image to system album 5 times.
UIImage *image = [UIImage imageNamed:@"icon.png"];
for (int i = 0; i < 6; i++) {
UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil);
}
I got this log if the value of i equals to 5:
* -[NSKeyedUnarchiver initForReadingWithData:]: data is NULL
I did not find any related information about 5 times from the API document .
Well… Can I write images to system album continuously more than 5 times? Is it too fast to write to system album ? Is there another way to do it ?
Thank you for your reply.
image is an autoreleased variable. I assume you’re not using ARC. Will it still fail if you retain it first and then release it after the loop?
EDIT: How about if you put your call in a delayed method, i.e.:
where you’ve also defined:
Your writes may just need to go through the run loop after each attempt.