[NSLocale PreferredLanguages] 和 [[NSUserDefaults standardUserDefaults] objectForKey:@“AppleLanguages”] 之间有什么区别?
[NSLocale PreferredLanguages]
和 [[NSUserDefaults standardUserDefaults] objectForKey:@"AppleLanguages"]
有什么区别?
- 我对Apple文档的描述感到困惑,无法清楚地理解,谁能告诉我它们的区别?因为我从他们那里得到了相同的数据。
- 在不同情况下我们应该使用哪一种?
What is the difference between [NSLocale preferredLanguages]
and [[NSUserDefaults standardUserDefaults] objectForKey:@"AppleLanguages"]
?
- I am confused with Apple Documentation description and can't understand clearly, Who can tell me their difference? because I get the same data from them.
- which one should we use at differente cases?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您应该使用
[NSLocale PreferredLanguages]
,如果您支持 Mac OS X 10.4 或更早版本,则应使用[[NSUserDefaults standardUserDefaults] objectForKey:@"AppleLanguages"]
。You should use
[NSLocale preferredLanguages]
, use[[NSUserDefaults standardUserDefaults] objectForKey:@"AppleLanguages"]
if you are supporting Mac OS X 10.4 or earlier.两者都旨在返回相同的内容,第一个更方便。
Apple 文档 说:
[[NSUserDefaults standardUserDefaults] objectForKey:@"AppleLanguages"]
Apple 文档 说:对于
[NSLocale PreferredLanguages]
Both are meant to return the same thing, the first one is just more convenient.
The Apple Documentation says: for
[[NSUserDefaults standardUserDefaults] objectForKey:@"AppleLanguages"]
The Apple Documentation says: for
[NSLocale preferredLanguages]