I need to create an xml .plist with 6 records, with record 5 being an input string from the user, the rest is all fixed data. I’m not sure what the best way of doing this is? It seems like it should be simple, but I haven’t had much success.
The data that needs to be written looks like this:
<?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>AREA51</key>
<dict>
<key>ORIGIN</key>
<data>M45</data>
...(4 more records)...
(USER STRING)
...(1 more record)...
</dict>
</dict>
</plist>
I’ve tried following some examples, but I think they are outdated and not up to spec. thanks!
I don’t know how a tutorial for this could possibly be outdated, the way you do it hasn’t changed in something like ten years. Create the dictionary, and use the
-writeToFile:atomically:method.(I don’t know if you actually need atomic writing or not. It is safe to change it to
YESif you are unsure.)