** the readData.plist is:**
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>currentChapter</key>
<string>2</string>
<key>currentLine</key>
<string>2</string>
<key>bookname</key>
<string>ExcelBible</string>
</dict>
</plist>
** The following is code:**
let Chapter = currentChapter
let Line = currentLine
let name = bookname
let dict:NSMutableDictionary = NSMutableDictionary()
dict.setObject("1", forKey: "currentChapter" as NSCopying)
dict.setObject("1", forKey: "currentLine" as NSCopying)
dict.setObject("WordBible", forKey: "bookname" as NSCopying)
//I also use dict[0] = "1", and setValue() method both of them are not work
let plistPath = Bundle.main.path(forResource: "readData", ofType: "plist")
dict.write(toFile: plistPath!, atomically: true)
Blockquote I also use FileManager and several examples here to save data, some display "Successfully write", but the file does't change.
Blockquote
I am an iOS developer since Feb 12, 2020