App intermittently cannot retrieve data from NSUserDefaults on iOS 10+

Originator:pgauriar
Number:rdar://29001445 Date Originated:28-Oct-2016 11:20 AM
Status:Open Resolved:
Product:iOS SDK Product Version:10.0
Classification:Crash/Hang/Data Loss Reproducible:Sometimes
 
Summary:
Our app is intermittently exhibiting behavior that indicates that NSUserDefaults is not returning previously stored values. In all cases, our app is in the foreground and visible on-screen. 

For example, we store boolean values for whether a user has gone through the onboarding flow or seen various interstitials in NSUserDefaults. Our analytics have recorded a sharp increase in Onboarding screen views and interstitial events on iOS 10, and we have likewise observed this behavior intermittently on our own devices. However, we have not been able to reliably reproduce it. It seems like we just aren’t able to read user defaults sometimes.

Steps to Reproduce:
0. Store a boolean value in NSUserDefaults on a previous application sessions.
1. Attempt to read the previously stored value in NSUserDefaults.

Expected Results:
The previously stored value should be read correctly.

Actual Results:
The previously stored value does not appear to be read correctly.

Version:
iOS 10.0 and higher

Notes:


Configuration:
Variety of iPhones (iPhone 6, iPhone 7, etc.)

Comments

Similar case with repeatable automated test

http://www.openradar.me/radar?id=5057804138184704


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!