Post not yet marked as solved
Post marked as unsolved with 1 replies, 2,496 views
I'm trying to move a video I create from images within my app from a temporary path to the photo library.
I've verified that the movie exists by downloading the app data via devices/xcode and the movie then plays fine on my macbook.
I've tried:
UISaveVideoAtPathToSavedPhotosAlbum(
videoPath,
self,
#selector(self.video(_:didFinishSavingWithError:contextInfo:)),
nil)
with Error:
Optional(Error Domain=ALAssetsLibraryErrorDomain Code=-1 "Unknown error" UserInfo={NSLocalizedDescription=Unknown error, NSUnderlyingError=0x283684570 {Error Domain=ALAssetsLibraryErrorDomain Code=-1 "Unknown error" UserInfo={NSLocalizedDescription=Unknown error, NSUnderlyingError=0x283681860 {Error Domain=ALAssetsLibraryErrorDomain Code=-1 "Unknown error" UserInfo={NSLocalizedDescription=Unknown error, NSUnderlyingError=0x28366e490 {Error Domain=com.apple.photos.error Code=42001 "(null)"}}}}}})
and
PHPhotoLibrary.requestAuthorization { status in
// Return if unauthorized
guard status == .authorized else {
print("Error saving video: unauthorized access")
return
}
PHPhotoLibrary.shared().performChanges({
PHAssetChangeRequest.creationRequestForAssetFromVideo(atFileURL: videoURL as URL)
}) { success, error in
if !success {
print("Error saving video: \(String(describing: error))")
}
}
}
with Error:
Domain=ALAssetsLibraryErrorDomain Code=-1 "Unknown error" UserInfo= ...... {Error Domain=com.apple.photos.error Code=42001 "(null)"
both compile fine and are called, but end up giving me errors that do not help in the slightest.
I have a full help request on StackOverflow with a link to the project (that it does not let me post here): https://stackoverflow.com/questions/63575539/swift-ios-save-video-to-library