I load the data from the sqlite database, storing the values that I load from there in the instance variables of the user class, and then add this class to the mutable array, which then assigns the instance variable to my view controller for use as a table.
However, I would like to save this array in the .plist file in the document directory on the first launch of the application so that I can retrieve the entire object from there when loading, instead of pulling all 214 elements from the database.
Is this approach the best option? if so, can someone please help me provide a code that will allow me to save an array of my custom classes as a .plist file? I found many code examples on the Internet, but none of them work correctly.
I would like to:
- Check for the presence of the my_data.plist file.
- If it exists, read it as an array.
- If this is not the case, read the data from sqlite db into an array.
- save this data in .plist so you can read it faster.
Thanks guys, appreciate any help you can give me.
source
share