Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialNAUSHAD DARUWALLA
1,587 PointsiPhone Data Storage
Hello all I have a question about saving data in IOS 8. In my project, I am saving data in a list such as:
aaa bbb ccc ....
I also give the user the functionality to change the order of the list to their liking. I have, to my knowledge, properly coded the data storage portion where after the app terminates the order of the list is saved and it works correctly on the iPhone simulator. The problem arises when it is tested on the live iPhone because the data gets saved in the correct order after the first termination but every termination after that, regardless of the list changes order, it keeps the list order after the first termination.
Ex.
1st termination: aaa bbb cccc
Before 2nd termination: ccc bbb aaa
What's saved for 2nd termination: aaa bbb ccc
What is the issue and how can I solve this? Thank you!
1 Answer
NAUSHAD DARUWALLA
1,587 PointsI'm saving all of this data with nsuserdefaults
Alex Hedley
16,381 PointsCan you post the code you are using? Are you adding logging for the didenterbackground and other methods? If you keep your phone connected to your mac and run the app check the logging to see if the methods are being called.
(I use http://simpholders.com to quickly get to the data stored in the Simulator)
Alex Hedley
16,381 PointsAlex Hedley
16,381 PointsAre you saving this to a plist or a db?