I am having trouble moving two files (3D scanning .obj files) into a directory. I currently have the URL's of the zipped version each of these files, which I originally used to upload them to Firebase separately with no problems.
However, now I am trying to place them into a directory together so I can upload a single file to Firebase. The URLs and the directory are listed below.
I am getting two errors saying that "CFURLCopyResourcePropertyForKey failed because it was passed an URL which has no scheme" and that the "The file couldn’t be opened because the specified URL type isn’t supported". The errors do not seem to be coming from creating the directory but rather from trying to add the files to the directory.
How can I achieve taking the 2 URL's and placing them into the directory I created?
// create directory
let paths = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)
let documentsDirectory = paths[0]
let docURL = URL(string: documentsDirectory)!
let dataPath = docURL.appendingPathComponent(meshIdentifierFormatted)
if !FileManager.default.fileExists(atPath: dataPath.absoluteString) {
do {
print("creating directory at \(dataPath)")
try FileManager.default.createDirectory(atPath: dataPath.absoluteString, withIntermediateDirectories: true, attributes: nil)
} catch {
print(error.localizedDescription);
}
}
Attempt to move files from respective URL into the directory (do the same thing for scanFile2URL)
// do {
try FileManager().copyItem(at: scanFile1URL, to: dataPath)
}
catch {
print(error)
}
scanFile1URL = file:///var/mobile/Containers/Data/Application/B81...A70/Documents/JacksonHubbard-Football-ACJoint-.zip
scanFile2URL = file:///var/mobile/Containers/Data/Application/B81...A70/Documents/JacksonHubbard-Football-ACJoint-2.zip
directory = /var/mobile/Containers/Data/Application/B81...A70/Documents/JacksonHubbard-Football-ACJoint-Scans