简体   繁体   中英

Using real device as simulator & storage

I've started to use my own Iphone as a simulator instead of the virtual one. My testing app uses UserDefaults to save some persistent data. If I rebuild the app via XCode on my phone this data does not get resetted. Is there a way to clear the data without de-installing the app and re-installing it via XCode on my phone again? And without actually adding some extra code.

You can try this in didFinishLaunchingWithOptions

UserDefaults.standard.removePersistentDomain(forName:Bundle.main.bundleIdentifier!)
UserDefaults.standard.synchronize()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM