what is the difference between [NSLocale preferredLanguages] and [[NSUserDefaults standardUserDefaults] objectForKey:@“AppleLanguages”]?

后端 未结 2 1328
生来不讨喜
生来不讨喜 2021-01-25 10:30

What is the difference between [NSLocale preferredLanguages] and [[NSUserDefaults standardUserDefaults] objectForKey:@\"AppleLanguages\"]?

2条回答
  •  渐次进展
    2021-01-25 11:20

    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 returned array contains the languages associated with the AppleLanguages key in the user's preferred order.

    The Apple Documentation says: for [NSLocale preferredLanguages]

    The user's language preference order as an array of NSString objects,

提交回复
热议问题