删除plist文件不会重置应用程序在Mac OS 10.9小牛,10.10优胜美地 [英] Deleting plist file does not reset app on Mac OS 10.9 Mavericks, 10.10 Yosemite

查看:240
本文介绍了删除plist文件不会重置应用程序在Mac OS 10.9小牛,10.10优胜美地的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在10.9开发Cocoa应用程序时,我注意到,如果我去〜/ Library / Preferences并删除我的应用程序的plist文件(重置它),在下次构建和运行时,好像plist文件根本没有被删除。

While developing a Cocoa application on 10.9, I have noticed that if I go to ~/Library/Preferences and delete the plist file for my app (to reset it), on the next build-and-run, the app behaves as if the plist file had never been deleted at all.

我花了很长时间来跟踪为什么会发生这种情况,我没有看到一个问题/答案

It took me a long time to track down why this happens and I did not see a question/answer about it on SO, so I'm writing this question and answering it myself to help others.

推荐答案

在10.9,系统正在做一些更加健壮的缓存偏好。删除plist文件后,我激活了Activity Monitor并强制杀死了cfprefsd进程。注意:有多个进程使用此名称运行,您只想杀死在您自己的用户下运行的进程;不要杀死以root身份运行的程序。

On 10.9, the system is doing some more robust "caching" of preferences. After deleting the plist file, I fired up Activity Monitor and force-killed the "cfprefsd" process. Be careful: there are multiple processes with this name running and you only want to kill the one running under your own user; do not kill the one running as root.

这样做似乎刷新了首选项缓存,下次运行我的应用程序时,我得到了一个纯净的从头开始发射。

Doing this seems to flush the preferences cache and on the next run of my app, I get a pristine start-from-scratch launch.

编辑:如下所述,使用默认值在命令行中删除[您的包标识符] 缓存问题。我已经与这个混合成功。

As reported below, using defaults delete [your bundle identifier] at the command line also appears to eliminate the caching issue. I've had mixed success with this.

这篇关于删除plist文件不会重置应用程序在Mac OS 10.9小牛,10.10优胜美地的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆