我已经更新的Xcode 7个我所有的应用程序,从迅疾迅速2.0转换后,得到的错误,一些研究之后,我能够手动修复它们。雨燕2.0 - stringByAppendingPathComponent错误转换
不过,我有“stringByAppendingPathComponent”我解决不了错误。似乎swift 2.0删除了这个方法。
连接图为我平铺有关错误。
任何想法如何解决这个问题呢?
func loadNotes(){
let plistPath = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true) as NSArray
let DocumentsDirectory = plistPath[0] as! String
let path = DocumentsDirectory.stringByAppendingPathComponent("notes.plist")
let fileManager = NSFileManager.defaultManager()
if (!fileManager.fileExistsAtPath(path)) {
if let bundlePath = NSBundle.mainBundle().pathForResource("notes", ofType: "plist") {
let resultDictionary = NSMutableDictionary(contentsOfFile: bundlePath)
println("Bundle notes.plist file is --> \(resultDictionary?.description)")
fileManager.copyItemAtPath(bundlePath, toPath: path, error: nil)
println("copy")
} else {
println("notes.plist not found")
}
}else {
println("note.plist already exists")
//fileManager.removeItemAtPath(path, error: nil)
}
let resultDictionary = NSMutableDictionary(contentsOfFile: path)
println("Loaded notes.plist file is --> \(resultDictionary?.description)")
var myDict = NSDictionary(contentsOfFile: path)
if let dict = myDict {
//load values
} else {
println("worning ccould not create dictionary from notes.plist, default values will be used")
}
}
这是很多雨燕1.2的代码 - 没有更多的println – Jeef
尝试使用转换为最新的迅速语法选项 – Jeef
嗨Jeef是我连着1.2 - 我曾尝试使用转换为最新的迅速语法选项,但错误没有改变 – SNos