Swift NSLocale模拟器iOS 8 [英] Swift NSLocale Simulator iOS 8

查看:174
本文介绍了Swift NSLocale模拟器iOS 8的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在XCode 6.1中遇到Swift和iOS 8仿真器的问题。

I'm having an issue with Swift and the iOS 8 Emulator in XCode 6.1.

当我尝试使用NSLocale时,几乎它的每个函数都返回nil 。

Indeed when I try to use NSLocale, almost every functions of it return nil.

以下是我的使用方法:

let cc = "fr" // Example
let locale = NSLocale.currentLocale()
let countryName = locale.displayNameForKey(NSLocaleCountryCode, value : cc)
println(countryName) // Shows : nil

它可以在设备,iOS 7和iOS 8以及模拟器iOS 7上运行。
它没有在iOS 8和Playground上运行模拟器,甚至EXC_BAD_ACCESS。
我想这只是一个模拟器和Playground问题,但它仍然很奇怪。我想知道是否有人有解决方法。

It does work on device, iOS 7 and iOS 8 and on simulator iOS 7. It doesn't work on simulator iOS 8 and on Playground, it even EXC_BAD_ACCESS. I guess it's just a simulator and Playground problem, but it's weird still. And I wish to know if anyone has a workaround from it.

我确实清理了派生数据,重新启动并清理了模拟器的数据。没有变得更好。

I did clean derived data, restarted and clean datas of simulator. Not getting better.

推荐答案

Xcode 6.1的发行说明


在某些情况下,[NSLocale currentLocale]可能会返回en_US而不是iOS 8.1模拟器中所选的区域设置。 (18512161

In some situations, [NSLocale currentLocale] may return en_US instead of the chosen locale in the iOS 8.1 simulator. (18512161

这篇关于Swift NSLocale模拟器iOS 8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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