how can check if image saved or not ? i'm saving way:
library.writeimagetosavedphotosalbum(image.cgimage, orientation: alassetorientation(rawvalue: image.imageorientation.rawvalue)!) { (url, error) -> void in after i'm calling alertcontroller , need make sure shows after user allowed save image.
the returning objects handled block, alassetslibrarywriteimagecompletionblock.
according apple's document:
alassetslibrarywriteimagecompletionblock = (nsurl!, nserror!) -> void where nserror object error described as:
if image not saved, error object describes reason failure, otherwise nil.
so in block, can like:
library.writeimagetosavedphotosalbum(image.cgimage, orientation: alassetorientation(rawvalue: image.imageorientation.rawvalue)!) { (url, error) -> void in if error != nil { // handle error. } else { // saved successfully. } }
Comments
Post a Comment