简体   繁体   English

iOS 模拟器不断看到旧系统日历类型(公历/iso8601)

[英]iOS simulator keeps seeing old system calendar type (Gregorian/iso8601)

I changed calendar type from Gregorian to ISO8601 in my MacOS's system preferences but when I launch my app in simulator it always returns gregorian我在 MacOS 的系统偏好设置中将日历类型从公历更改为 ISO8601,但是当我在模拟器中启动我的应用程序时,它总是返回公历

Here's how I check the value:这是我检查值的方法:

print("Calendar.current.identifier = \(Calendar.current.identifier)")

Is there any other way to make simulator think my calendar is "ISO8601" apart from initializing calendar as "Calendar(identifier: .iso8601)" in my app?除了在我的应用程序中将日历初始化为“日历(标识符:.iso8601)”之外,还有其他方法可以让模拟器认为我的日历是“ISO8601”吗?

The macOS system preferences don't affect the iOS simulator. macOS 系统首选项不会影响 iOS 模拟器。

You have to set the calendar in the virtual device of the simulator.您必须在模拟器的虚拟设备中设置日历。 However there is no ISO8601 calendar available – neither on a physical device – so you have to create it in code.然而,没有可用的 ISO8601 日历——在物理设备上也没有——所以你必须在代码中创建它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM