Save Data to .plist File in Swift

前端 未结 7 1302
一整个雨季
一整个雨季 2020-11-27 18:10

I am trying to save data to a plist file in swift, but the data isn\'t showing up as it was saved when the plist is read. This is the code I was using.

var          


        
相关标签:
7条回答
  • 2020-11-27 18:50

    Use writeToFile:options:error: and see what the error says:

    var error: NSError?
    var bytes = NSKeyedArchiver.archivedDataWithRootObject(data)
    if !bytes.writeToFile(path, options: nil, error: &error) {
        if let actualError = error {
            println(actualError)
        }
    }
    
    0 讨论(0)
提交回复
热议问题