Search code examples
iphoneiosxmlplist

Store province, city and coordinate with plist


How to store the province, city and coordinate informations in .plist? These information should come with my App. I have tried the following format, but it doesn't work. Is there any other method substitute for plist? As plist is not good for query.

<?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>ProvinceN</key>
<array>
        <dict>
        <key>cityName</key>
        <string>cityM</string>
        <key>latitude</key>
        <integer>32.5543</integer>
        <key>longitude</key>
        <integer>88.3237</integer>
        </dict>
</array>
</dict>
</plist>

Solution

  • You can use a SQLite database instead of plist. If you don't know how to use it, here you have a good tutorial. Also, for managing the database before copying it in your xCode project, I suggest you the SQLite manager extension of Mozilla Firefox.

    If you need some more information, is VERY EASY to find on the internet an SQLite tutorial, searching on the web for something like "iPhone SQLite tutorial".