我在我的应用程序中使用NSUserDefaults,当我启动应用程序时,NSUserDefaults似乎已经有了默认值。当我在应用程序的开头打印NSUserDefaults作为字典时,它具有默认值。这就是将它打印成字典的样子:
[MSVLoggingMasterSwitchEnabledKey: 0, NSLanguages: (
en,
fr,
de,
"zh-Hans",
"zh-Hant",
ja,
nl,
it,
es,
"es-MX",
ko,
pt,
"pt-PT",
da,
fi,
nb,
sv,
ru,
pl,
tr,
uk,
ar,
hr,
cs,
el,
he,
ro,
sk,
th,
id,
ms,
"en-GB",
"en-AU",
ca,
hu,
vi,
hi
), AppleITunesStoreItemKinds: (
audiobook,
"tv-episode",
booklet,
software,
"software-update",
"itunes-u",
ringtone,
"tv-season",
movie,
mix,
newsstand,
song,
wemix,
tone,
artist,
"podcast-episode",
podcast,
document,
eBook,
album,
"music-video"
), AppleKeyboardsExpanded: 1, NSInterfaceStyle: macintosh, AppleKeyboards: (
"en_US@hw=US;sw=QWERTY",
"emoji@sw=Emoji",
"en_US@hw=US;sw=QWERTY"
), AppleLocale: en_US, AppleLanguages: (
en,
fr,
de,
"zh-Hans",
"zh-Hant",
ja,
nl,
it,
es,
"es-MX",
ko,
pt,
"pt-PT",
da,
fi,
nb,
sv,
ru,
pl,
tr,
uk,
ar,
hr,
cs,
el,
he,
ro,
sk,
th,
id,
ms,
"en-GB",
"en-AU",
ca,
hu,
vi,
hi
)]
[MSVLoggingMasterSwitchEnabledKey: 0, NSLanguages: (
en,
fr,
de,
"zh-Hans",
"zh-Hant",
ja,
nl,
it,
es,
"es-MX",
ko,
pt,
"pt-PT",
da,
fi,
nb,
sv,
ru,
pl,
tr,
uk,
ar,
hr,
cs,
el,
he,
ro,
sk,
th,
id,
ms,
"en-GB",
"en-AU",
ca,
hu,
vi,
hi
), AppleITunesStoreItemKinds: (
audiobook,
"tv-episode",
booklet,
software,
"software-update",
"itunes-u",
ringtone,
"tv-season",
movie,
mix,
newsstand,
song,
wemix,
tone,
artist,
"podcast-episode",
podcast,
document,
eBook,
album,
"music-video"
), AppleKeyboardsExpanded: 1, NSInterfaceStyle: macintosh,
AppleKeyboards: (
"en_US@hw=US;sw=QWERTY",
"emoji@sw=Emoji",
"en_US@hw=US;sw=QWERTY"
), AppleLocale: en_US, AppleLanguages: (
en,
fr,
de,
"zh-Hans",
"zh-Hant",
ja,
nl,
it,
es,
"es-MX",
ko,
pt,
"pt-PT",
da,
fi,
nb,
sv,
ru,
pl,
tr,
uk,
ar,
hr,
cs,
el,
he,
ro,
sk,
th,
id,
ms,
"en-GB",
"en-AU",
ca,
hu,
vi,
hi
)]
[MSVLoggingMasterSwitchEnabledKey: 0, NSLanguages: (
en,
fr,
de,
"zh-Hans",
"zh-Hant",
ja,
nl,
it,
es,
"es-MX",
ko,
pt,
"pt-PT",
da,
fi,
nb,
sv,
ru,
pl,
tr,
uk,
ar,
hr,
cs,
el,
he,
ro,
sk,
th,
id,
ms,
"en-GB",
"en-AU",
ca,
hu,
vi,
hi
), AppleITunesStoreItemKinds: (
audiobook,
"tv-episode",
booklet,
software,
"software-update",
"itunes-u",
ringtone,
"tv-season",
movie,
mix,
newsstand,
song,
wemix,
tone,
artist,
"podcast-episode",
podcast,
document,
eBook,
album,
"music-video"
), AppleKeyboardsExpanded: 1, NSInterfaceStyle: macintosh,
AppleKeyboards: (
"en_US@hw=US;sw=QWERTY",
"emoji@sw=Emoji",
"en_US@hw=US;sw=QWERTY"
), AppleLocale: en_US, AppleLanguages: (
en,
fr,
de,
"zh-Hans",
"zh-Hant",
ja,
nl,
it,
es,
"es-MX",
ko,
pt,
"pt-PT",
da,
fi,
nb,
sv,
ru,
pl,
tr,
uk,
ar,
hr,
cs,
el,
he,
ro,
sk,
th,
id,
ms,
"en-GB",
"en-AU",
ca,
hu,
vi,
hi
)]
答案 0 :(得分:0)
是的,对于语言,有一些预设值。如您所示,您粘贴的项目是语言。甚至引号中的项目如“zh-Hans”也指的是语言,在这种情况下是不同的中文方言。
在gnustep.org上注意到“NSLanguages默认值用于设置本地化的常量。”