I have a code
func pathForBuggyWKWebView(filePath: String?) -> String? {
let fileMgr = NSFileManager.defaultManager()
let tmpPath = NSTemporaryDirectory().stringByAppendingPathComponent("www")
var error: NSErrorPointer = nil
if !fileMgr.createDirectoryAtPath(tmpPath, withIntermediateDirectories: true, attributes: nil, error: error) {
println("Couldn't create www subdirectory. \(error)")
return nil
}
let dstPath = tmpPath.stringByAppendingPathComponent(filePath!.lastPathComponent)
if !fileMgr.fileExistsAtPath(dstPath) {
if !fileMgr.copyItemAtPath(filePath!, toPath: dstPath, error: error) {
println("Couldn't copy file to /tmp/www. \(error)")
return nil
}
}
return dstPath
}
with errors below
I tried to use this solution
stringByAppendingPathComponent is unavailable
and I managed to solve first error with
let tmpPath = NSURL(fileURLWithPath: NSTemporaryDirectory()).URLByAppendingPathComponent("www")
Error number 4 i tried to solve with code
let writePath = NSURL((fileURLWithPath: tmpPath).URLByAppendingPathComponent(filePath!.lastPathComponent))
but it doest work.
Maybe somebody can help with errors 2,3, 4 ?