我升级我的现有代码转换的时间价值“诠释”预期参数类型“NSPropertyListReadOptions”斯威夫特2,我需要一些帮助,plist文件中不能在斯威夫特2
该代码的保存在Xcode 6.3是工作,但现在的Xcode 7和斯威夫特2它显示了我这个错误:
Cannot convert value of time 'Int' to expected argument type 'NSPropertyListReadOptions' (aka 'NSPropertyListMutabilityOptions')
var resultValue = "Value goes here"
@IBAction func saveNote(sender: AnyObject) {
// Save note to plist
var appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
var pathForThePlistFile = appDelegate.plistPathInDocument
// Extract the content of the file as NSData
var data:NSData = NSFileManager.defaultManager().contentsAtPath(pathForThePlistFile)!
// Convert the NSData to mutable array
var notesArray = (try! NSPropertyListSerialization.propertyListWithData(data, options: Int(NSPropertyListMutabilityOptions.MutableContainersAndLeaves.rawValue), format: nil)) as! NSMutableArray
//
notesArray.addObject(resultValue)
// Save to plist
notesArray.writeToFile(pathForThePlistFile, atomically: true)
}
请帮助!
谢谢,这工作! – AJ152