1

recently, I want to save some images from urls to the user photo album. I use the function UIImageWriteToSavedPhotosAlbum, and the didFinishSavingWithError call back told me the result, my problem is if there is a lot urls of images,using this way, some images always cannot be saved to the album even its already download from url. As I checked the size offailed saved image , it is a png, 1290 × 1288, I don`t know if it is because of the size is too big too save. Do you guys have this kind of issues? please help~thanks!

    UIImageWriteToSavedPhotosAlbum(image, self,@selector(image:didFinishSavingWithError:contextInfo:), nil);


    - (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo{
        if (error != nil) {
            isImagesSavedFailed = true;
        }
    }
Sean Wang
  • 778
  • 5
  • 14
MichaelMao
  • 528
  • 6
  • 15
  • What was the error message? – Sean Wang Aug 13 '16 at 14:17
  • The error is too busy at writing, may be save lots of images is require some handles.` Error Domain=ALAssetsLibraryErrorDomain Code=-3301 "写入正忙" UserInfo={NSUnderlyingError=0x12e776a10 {Error Domain=ALAssetsLibraryErrorDomain Code=-3301 "写入正忙"` – MichaelMao Aug 13 '16 at 14:21
  • See if the info here points you to the right direction http://stackoverflow.com/questions/20662908/ios-programming-using-threads-to-add-multiple-images-to-library – Sean Wang Aug 13 '16 at 14:22
  • some guys give suggesstion like try again when error appread : -(void)tryWriteAgain:(UIImage *)image { UIImageWriteToSavedPhotosAlbum(image, self, @selector(imageSavedToPhotosAlbum: didFinishSavingWithError: contextInfo:), nil); } – MichaelMao Aug 13 '16 at 14:28
  • Yeah, cause I do it simultaneously, I should use ALAssetsLibrary, thank u very much, Sean Wang – MichaelMao Aug 13 '16 at 14:44

1 Answers1

0

You might want to try to write them one by one instead of in parallel. Especially since you have many pictures. You are letting it become "too busy." So you'll want to queue them up and write not all at once.

You can get some more details at ios programming: Using threads to add multiple images to library

Community
  • 1
  • 1
Sean Wang
  • 778
  • 5
  • 14