I am creating an application and I want to take the latest photo and share it using the UI activity view controller. For some reason, when I try to share a photo, I get an error
ImageIO: PNG zlib error
Here is the relevant code:
let imgManager = PHImageManager.defaultManager() var fetchOptions = PHFetchOptions() let screenSize: CGSize = UIScreen.mainScreen().bounds.size let targetSize = CGSizeMake(screenSize.width, screenSize.height) var imagesArray: NSMutableArray = [] fetchOptions.sortDescriptors = [NSSortDescriptor(key:"creationDate", ascending: true)] if let fetchResult = PHAsset.fetchAssetsWithMediaType(PHAssetMediaType.Image, options: fetchOptions) { imgManager.requestImageForAsset(fetchResult.lastObject as PHAsset, targetSize: targetSize, contentMode: PHImageContentMode.AspectFill, options: nil, resultHandler: { (image, _) in imagesArray.addObject(image) }) } let activityViewController = UIActivityViewController( activityItems: imagesArray,
I do not know what happens and where the error arises from
source share