Hello!
After updating my device to iOS 14.0.1 my application started to receive an error - Error Domain=PHPhotosErrorDomain Code=-1 - after downloading video from remote url.
It was fine on iOS 13.
This is my code
func didFinishedDownloading(to location: URL) {
let exists = FileManager.default.fileExists(atPath: location.path)
debugPrint("EXISTS", exists)
var attemptsToSave: Int = 0
func saveToCameraRoll() {
PHPhotoLibrary.shared().performChanges({
PHAssetChangeRequest.creationRequestForAssetFromVideo(atFileURL: location)
}) { saved, error in
guard error == nil, attemptsToSave < 3 else {
debugPrint("ERROR ON SAVING", error, error?.localizedDescription, attemptsToSave)
if attemptsToSave < 3 {
DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {
attemptsToSave+=1
saveToCameraRoll()
}
} else {
DispatchQueue.main.async { [weak self] in
self?.currentState = .error(.download)
}
}
return
}
DispatchQueue.main.async { [weak self] in
if saved {
debugPrint("TIME INTERVAL", self?.completionTimer?.timeInterval)
}
}
}
}
saveToCameraRoll()
}
Post
Replies
Boosts
Views
Activity
Hello!After updating my devices to iOS to 13.1 I've started to receive "IOServiceOpen failed: 0xe00002e2"in my swift project while connecting USB HID Device to my iPhone. This not good, because IOService is a part of kernel framework and I really need it. What should I do? Is it a bug or a feature of new iOS version?