UserDefaults sometimes does not save

Originator:pzabelin
Number:rdar://36054294 Date Originated:14-Dec-2017
Status:Open Resolved:
Product:iOS Product Version:11.2
Classification:Data Loss Reproducible:Often
 
Area:
Foundation

Summary:
We use UserDefaults to store whether user saw the app onboarding. We see that setting is not persistent sometimes.

Steps to Reproduce:
Download and open this project in Xcode 9.2
https://github.com/omadahealth/UserDefaultsBug
or see the attached project.

Expected Results:
UI Test pass all the time

Actual Results:
UI Test fails sometimes (about 1 in 3 times)

Version/Build:
iOS 11.2 Xcode 9.2

Configuration:
iPhone X Simulator and Device.

Comments

49809943 - Same issue with Xcode 10.2 and iOS 12.2

Filed again as 49809943 as it fails on the latest Xcode 10.2


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!