NSUserDefault线程安全吗? [英] Is NSUserDefault thread safe?

查看:787
本文介绍了NSUserDefault线程安全吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

https://developer.apple. com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSUserDefaults_Class/Reference/Reference.html 说是

...应通过禁用任何功能来防止用户编辑该首选项 适当的控件.

...should prevent users from editing that preference by disabling any appropriate controls.

NSUserDefaults类是线程安全的. NSURL和 文件参考网址...

The NSUserDefaults class is thread-safe. Persistence of NSURL and file reference URLs...

经过长时间的讨论,事实并非如此

This long discussion says it isn't

http://www.cocoabuilder.com/archive/cocoa/155227-nsuserdefaults -thread-safety.html

那么哪个是对的?还有为什么意见分歧.

So which one is right? Also why the difference of opinion.

推荐答案

Apple iOS 5.1和OS X 10.7文档说它是线程安全的.因此它是线程安全的.

The Apple iOS 5.1 and OS X 10.7 documentation say that it is thread-safe; therefore it is thread-safe.

这篇关于NSUserDefault线程安全吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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