我已經更新的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