Xcode 9: NSUserDefaults does not delete values

Originator:s.pankevich
Number:rdar://35096120 Date Originated:20-10-2017
Status:Open Resolved:
Product:Xcode Product Version:Version 9.0 (9A235)
Classification:Serious bug Reproducible:Sometimes (Often)
 
Area:
Foundation

Summary:

Please see the attached. In my unit tests I create UserDataStorage which has
`storage` property which is a UserDefaults.standard in the app and UserDefaults() in my unit tests. I have written this tests just today and I get the erroneous behaviour: the data does not get deleted. Please let me know what information I can gather to help investigating this. Hopefully my branch will always work even if I move from it for a while.

Steps to Reproduce:
I have preserved this issue in a dedicated branch. I just run the unit tests for my dynamic framework's unit tests. The issue reproduces no less than 5 of 10 test runs. It reproduces on both ways of creating User Defaults object: 1) UserDefaults.standard and 2) UserDefaults().

I tried to reproduce it on a standalone project and could not reproduce it unfortunately.

Expected Results:
UserDefaults MUST delete the values!

Actual Results:
UserDefaults DOES NOT delete the values in this case!

Version/Build:
Version 9.0 (9A235)

Configuration:

Comments


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!