i have task that download image through UIDocumentInteractionController, however when i clicked on the Save Image button, it displayed the error log as below:
Video /Users/khanhnd/Library/Developer/CoreSimulator/Devices/13D3E1DA-DB0A-40C2-81EC-9937C7143A2E/data/Containers/Data/Application/83FD51AB-882A-462C-8804-21602AECB030/Documents/storage/IMG_2793.JPG cannot be saved to the saved photos album: Error Domain=AVFoundationErrorDomain Code=-11828
Here is my code:
if statusCode == 200 {
let viewController = self.storyboard!.instantiateViewControllerWithIdentifier("ViewFileStorageController") as! ViewFileStorageController
let data = NSData(contentsOfURL: filePath!)
do {
let object = try NSJSONSerialization.JSONObjectWithData(data!, options: .AllowFragments)
if let dictionary = object as? [String: AnyObject] {
print(dictionary["status"])
let status = dictionary["status"] as! Int
let errorMsg = dictionary["description"] as? String
if status == 400 {
let alertController = SLZAlertController(title:errorMsg, message: nil, preferredStyle: .Alert)
alertController.addAction(SLZAlertAction(title: "OK", style: .Default, handler: nil))
alertController.show(inViewController: self, animated: true)
}
}
} catch {
// Handle Error
}
viewController.pathFileUrl = filePath
print("file path is \(filePath)")
viewController.titleNav = self.nameFile!
self.documentController = UIDocumentInteractionController.init(URL: filePath!)
self.documentController!.presentOptionsMenuFromRect(self.cellFrame!, inView: self.view, animated: true)
I think in this case ios thought my image is a video.But still stucking in it. Please any one can help me solve this. Thank you so much.