Saya memutakhirkan kode saya yang ada ke Swift 2, dan saya memerlukan bantuan untuk menyimpan file Plist
Kode ini berfungsi di Xcode 6.3, tetapi sekarang dengan Xcode 7 dan Swift 2, saya menunjukkan kesalahan ini:
Tidak dapat mengonversi nilai waktu 'Int' ke tipe argumen yang diharapkan 'NSPropertyListReadOptions' (alias '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)
}
Tolong bantu!