In your application, you do not have permission to access the /var/mobile/Media/DCIM/100APPLE/IMG_0048.JPG file due to the sandbox.
So, whatever you do, you cannot initialize NSData or UIImage using the file path. But you can access the /var/mobile/Media/DCIM/100APPLE/xxx.mov file using AVURLAsset . In my application, I extracted data, not the URL from the Photo Gallery, and initialized the UIImage data with data.
PHImageManager.default().requestImageData( for: assetObject!, options: options, resultHandler: { data, _, _, _ in if data != nil { self.assetUrl = movieMaker.createMovieFrom(imageData: data!, duration: Int(CXPreparetValue.imageDuration)) } })
he works for me! If you have other opinions, let me know.
source share