sketchytech / FileSave_Swift_iOS

Simple class for iOS to save files to the Library and Documents Directories with optional subdirectories

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Saving a file from url.

hugocarlmartin opened this issue · comments

Hi

I'm trying to save a zip file from url to the Documents directory. But I get a lot of swift compile errors.

First I get: 'URLWithString' is unavailable: use object construction 'NSURL(string:)'
on all SaveFile.swift returns that includes NSURL.URLWithString

Then I get a Missing argument label 'fileURLWithPath:' in call
and i think it has something to do with my let data:NSData = NSData(contentsOfURL: url)

var url = NSURL(http://www.test.com/Monkey.zip)
FileSave.saveContentsOfStringToDocumentsDirectory("test", path:"1234.zip", subdirectory:"novela")

let data:NSData = NSData(contentsOfURL: url)
FileSave.saveDataToDocumentsDirectory(data, path: "1234.zip", subdirectory: "novela")

Any ideas? For the record, I'm new to Swift since 3 days. :) Done some obj c before.

Thx

Sorry about this, I fixed for the early Swift betas but need to revisit the code because some elements have stopped working.

If u have the time for filesave and delete it would be much appreciated.

Update should fix these errors.