6 Replies
      Latest reply on Mar 10, 2017 6:40 AM by MoneyCoach App
      nf_ramsey Level 1 Level 1 (0 points)

        when ever my test users install new version NSUserDefaults settings get lost? is this normal? I also notice this happens intermittently when running from XCode too? How do I fix this issue?

        • Re: NSUserDefaults
          frunny Level 1 Level 1 (0 points)

          Please read here: Possible bug in iOS 9.3.1 https://forums.developer.apple.com/thread/44264

            • Re: NSUserDefaults
              ChaoticBox Level 1 Level 1 (0 points)

              I'm also seeing this again on iOS 10.0.2, and the workaround I described in that old thread no longer works. Only solution I can think of now is ditching userdefaults entirely.

                • Re: NSUserDefaults
                  Chris Mash Level 1 Level 1 (0 points)

                  I've started doing that for my own apps and seems to solve the problem. Unfortunately there are a lot of developers out there who aren't aware of this issue as it only seems to affect a handful of people (normally in a development scenario it seems) so they're still using user defaults in abundence!

              • Re: NSUserDefaults
                Chris Mash Level 1 Level 1 (0 points)

                I started seeing the same, both in my own apps and public apps (such as Facebook, 9gag, Slack etc. where I would have to keep logging in again and again). I had it really bad for about a week where one of my apps kept losing its data pretty much every time it opened (and others less often) and then it went away. Since I got my 7 Plus i've been on iOS 10 and it's not been an issue but now it's back again... Sky Force Reloaded (awesome game, very much recommended) has started doing it all the time (fortunately not losing all my progress but just my 'stars', preferences and requiring my IAPs to be restored).

                 

                Today the oddest thing of all happened. I've made a time tracking app and I opened it to find that it had lost my current day's logs (ARGH) but then I noticed that it had lost a whole lot more of my logs... in fact it had someone retrieved a load of logs from Oct 2014 that had been long deleted (only ever stored in user defaults and certainly not on my 7 Plus, which didn't exist back in 2014!).

                 

                Previous discussions with a colleague had suggested that maybe there was an iCloud sync issue going on.. maybe if the app's user defaults was being backed up to iCloud when you opened the app it would fail to load them and then you could end up overwriting (what would on subsequent launches load fine) with blank defaults. The fact that the app somehow resurrected long deleted data really does suggest that iCloud backups are playing havoc...

                 

                I do have two backups of my phone in iCloud, perhaps that's causing some confusion... let's try deleting one... (though it's not from 2014 so not sure it's to blame..)

                • Re: NSUserDefaults
                  syy20182019 Level 1 Level 1 (0 points)

                  I experienced same problem. Another app in use on my iPhone may have the same issue. It requires me log again in when lauching everyday for the past 3 days.(not sure it is  in this situation). I urge Apple solve this problem.

                  • Re: NSUserDefaults
                    MoneyCoach App Level 1 Level 1 (0 points)

                    I am facing the same problem. My app relies heavily on saving the settings in the user defaults...

                    The entire app is being ruined now...

                     

                    What kind of alternatives are you using to save settings or other small key/value pairs?

                     

                    Thanks,

                    P