简体   繁体   中英

Resetting mac application in xcode

How can I reset a cocoa application in Xcode? When I run my application from Xcode all user default are saved. I would like to reset (delete) my application to create a new one with new settings and run as it would be run first time.

I found one way - I change a name of my app to a different one and it is started as new. But how can I do this with an old name?

Is your app limited to the App Store? If so, I don't think there's a way to delete your entire application, specifically because of the sandbox restrictions. We'd need more information on how you are planning to distribute it to help.

If you just want to delete your app settings, then clear whatever database you store your app data in - [NSUserDefaults +resetStandardUserDefaults] , SQLite, App Library directory, whatever. That is dependent on how/where you are storing user data, there's no one size fits all solution.

您可以使用defaults命令行工具删除所有设置,只需要您的应用程序的软件包ID(您可以在Info.plist文件中找到),例如,如果您的软件包ID为“com.foo.barApp”,那么你可以从终端shell运行它:

defaults delete com.foo.barApp

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