我正在尝试将我的App的Bundle中的文件复制到设备上,我收到一个奇怪的错误:无法将表达式’$T5’转换为’LogicValue’类型
这是一切:
// This function returns the path to the Documents folder: func pathTodocsFolder() -> String { let pathTodocumentsFolder = NSSearchPathForDirectoriesInDomains(.DocumentDirectory,.UserDomainMask,true)[0] as String return pathTodocumentsFolder.stringByAppendingPathComponent("/moviesDataBase.sqlite") } override func viewDidLoad() { super.viewDidLoad() let theFileManager = NSFileManager.defaultManager() if theFileManager.fileExistsAtPath(pathTodocsFolder()) { println("File Found!") // And then open the DB File } else { // copy the file from the Bundle and write it to the Device: let pathToBundledDB = NSBundle.mainBundle().pathForResource("moviesDB",ofType: "sqlite") let pathToDevice = pathTodocsFolder() let error:NSError? // Here is where I get the error: if (theFileManager.copyItemAtPath(pathToBundledDB,toPath:pathToDevice,error:error)) { // success } else { // failure } } }
该应用程序甚至不会立即编译.这个问题似乎特别针对copyItemAtPath调用 – 它应该返回一个Bool.
我很欣赏任何见解.