FileManager cannot find audio file
You cannot save a sandboxed file URL or path string for later use, because the sandbox can move. You need to do what you were doing before, successfully: calculate the documents directory URL and then examine it. You should work entirely with URLs and never call absoluteString
at all; it is the wrong call entirely and is letting you down here.
In this example, I check the documents directory for any files whatever:
let documentsDirectory =
FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0]
let results =
try? FileManager.default.contentsOfDirectory(at: documentsDirectory,
includingPropertiesForKeys: nil)
Error when trying to copy file
This is possible when the destination path is missing the directory.
Make sure that the place at which you want to copy the source file is containing all required directory.
Related Topics
Uiview Hide/Show with Animation
How to Add a 'Done' Button to Numpad Keyboard in iOS
Uitableview with Static Cells Does Not Appear
Using Nsuserdefaults with Xcode 8 and iOS 10
How to Set an Nsdate Object to Midnight
Swift Countelements() Return Incorrect Value When Count Flag Emoji
iOS 8 Auto Cell Height - Can't Scroll to Last Row
Swift - How Creating Custom Viewforheaderinsection, Using a Xib File
Ibeacon Notification When the App Is Not Running
How to Simultaneously Satisfy Constraints - No Constraints in Place
Install Simulator Sdk 4.3 to Xcode 4.4 on Mountain Lion
How to Make a Button Continually Call a Function When Held Down (Spritekit)
Cannot Put a Google Maps Gmsmapview in a Subview of Main Main View
How to Fill a Uibezierpath with a Gradient