Using iOS 9 I'm attempting to use NSFileManager's
moveItemAtURL
:
do {
print(localURL) // http://localhost:3000/api/v1/activities
print(cacheFile) // file:///Users/kyledecot/Library/Developer/CoreSimulator/Devices/35C03988-D8F5-42E5-AB35-B99BE461EEAE/data/Containers/Data/Application/69593B3A-F764-4BC3-89AD-72B701BF85C8/Library/Caches/activities.json
try fileManager.moveItemAtURL(localURL, toURL: cacheFile)
} catch let error as NSError {
print(error)
}
When catching the error I'm getting:
Error Domain=NSCocoaErrorDomain Code=262 "The file “activities” couldn’t be opened because URL type http isn’t supported." UserInfo={NSURL=http://localhost:3000/api/v1/activities}
Update #1
I've already added the appropriate values to my Info.plist
to ensure that ATS is happy (see screenshot). What's odd is that I am able to download the data from my local server using HTTP (via dataTaskWithRequest:
) but NSFileManager then complains about the same URL when trying to perform moveItemAtURL
.