Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 iOS7 中[[NSUserDefaults standardUserDefaults] objectForKey:@"AppleLanguages"]给了我所有语言的数组。从 iOS8 开始,这似乎已更改为已安装的键盘。
[[NSUserDefaults standardUserDefaults] objectForKey:@"AppleLanguages"]
我怎样才能在 iOS8 中获得所有语言的数组?
使用+[NSLocale preferredLanguages]而不是查询 NSUserDefaults。请注意,正如 Xcode 6.1 发行说明中所提到的,iOS 8.1 模拟器运行时中存在一个已知错误,该错误会阻止它在那里工作,但这将在其他模拟器版本和设备上按预期工作。
+[NSLocale preferredLanguages]
如果您想要所有支持的语言列表而不仅仅是用户的首选语言,您可以使用+[NSLocale availableLocaleIdentifiers]它将返回所有支持的语言环境标识符的 NSArray。
+[NSLocale availableLocaleIdentifiers]