Reputation: 137
I am developing an iOS app in Swift on a Mac running Catalina using Xcode and would like to clear User Defaults using defaults delete bundleidentifier
. However, the command fails with 'Domain(bundleidentifier) not found' because the file bundleidentifier.plist is not present in /Library/Preferences (as is the case for a MacOS app) or in the iOS simulator Library/Preferences folder. Where are the user defaults stored in this case and how can I delete them?
Upvotes: 0
Views: 954
Reputation: 137
Found the the bundleidentifier.plist file in /users/<UserName/>/Library/Developer/CoreSimulator/Devices/<DeviceCode>/Containers/Data/Application/<ApplicationCode>/Library/Preferences
.
<DeviceCode>
is the code for the simulator being used and <ApplicationCode>
is the code for application. These codes were found by looking at the DateModified values for all the DeviceCodes and ApplicationCodes. Deleting the file leaves the UserDefault values in the cache. Would be useful to find a way of clearing this without rebooting. defaults delete bundleidentifier
on Mac does not seem to work when using an iOS simulator.
Upvotes: 2