Mac沙箱已创建,但没有NSUserDefaults plist [英] Mac sandbox created but no NSUserDefaults plist

查看:99
本文介绍了Mac沙箱已创建,但没有NSUserDefaults plist的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试查找沙箱创建过程中出现的一些问题.在多种情况下,似乎未在数据/库/首选项中创建NSUserDefaults .plist文件.我已经在调试器中以及从应用程序"目录启动应用程序时看到了这一点.我没有尝试存档,签署应用程序然后启动.这是必需的吗?

I'm trying to track down some issues arising from sandbox creation. Under multiple circumstances it appears that an NSUserDefaults .plist file is not created in Data/Library/Preferences. I have seen this in the debugger and when launching the app from the Applications directory. I have not tried archiving, signing the app and then launching. Is that required?

创建了一个以.LSSharedFileList.plist结尾的别名文件,但它指向自身,因此不存在.

An alias file ending in .LSSharedFileList.plist is created but it points to itself and therefore does not exist.

我不知道它是否相关,但控制台报告:

I don't know if it's related but Console reports:

appleeventsd[72]: <rdar://problem/11489077> A sandboxed application with pid ... checked in with appleeventsd, but its code signature could not be validated ( either because it was corrupt, or could not be read by appleeventsd ) and so it cannot receive AppleEvents targeted by name, bundle id, or signature. Error=ERROR: #100013  { "NSDescription"="SecCodeCopySigningInformation() returned 100013, -." }  (handleMessage()/appleEventsD.cp #2072) client-reqs-q

谢谢.

推荐答案

这可能与NSUserDefaults的缓存有关吗?

Could this be related to the caching of NSUserDefaults?

在最新的OS X版本中,默认值不会立即写入磁盘,因此您可能不会立即看到它们.您可能要尝试手动同步首选项- 来自 NSUserDefaults类参考:

In recent OS X versions the defaults are not immediately written to disk so you might not see them right away. You might want to try synching the prefs manually - From NSUserDefaults Class Reference:

在运行时,您可以使用NSUserDefaults对象读取默认值, 您的应用程序从用户的默认数据库中使用. NSUserDefaults 缓存信息,以避免必须打开用户的默认设置 每次需要一个默认值时都存储数据库.同步方法 它会定期自动调用 内存中缓存与用户的默认数据库同步.

At runtime, you use an NSUserDefaults object to read the defaults that your application uses from a user’s defaults database. NSUserDefaults caches the information to avoid having to open the user’s defaults database each time you need a default value. The synchronize method, which is automatically invoked at periodic intervals, keeps the in-memory cache in sync with a user’s defaults database.

尽管我相信甚至可能不会立即将默认值写入10.9中的磁盘,因为现在还涉及一些缓存用户默认值的守护程序.

Although I believe even that might not immediately write the defaults to disk in 10.9 anymore as some daemon caching the user defaults is now also involved.

也检查

从沙箱中的助手应用程序读取NSUserDefaults

Objective-C NSUserDefaults缓存可阻止其他应用程序准确读取更改

何时(不)滥用NSUserDefaults

这篇关于Mac沙箱已创建,但没有NSUserDefaults plist的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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