iPhone的日期和版本在哪里?获得时区列表的时间 [英] Where is the iPhone's Date & Time getting its time zone list
问题描述
我可以使用 [NSTimeZone knownTimeZoneNames]
获取时区列表,但这只会提供时区ID,其中包含每个时区中的一个或两个城市。
I can get a list of time zones with [NSTimeZone knownTimeZoneNames]
, but that only gives the time zone IDs which include one or two cities in each time zone.
日期&时间设置有一个很好的城市列表,我看到一些其他应用程序具有相同但不相似的查找列表。
The Date & Time settings has a great list of cities and I have seen a few other apps that have the same if not similar lookup lists.
这些列表来自哪里?
我确实需要将选定的城市与其时区相关联,例如Date&时间确实。
I do need to relate a picked city to its time zone like Date & Time does.
推荐答案
只有2个?在3.1上 [NSTimeZone knownTimeZoneNames]
返回401个元素的数组,地球上的时区少于200个。
Only 2? On 3.1 the [NSTimeZone knownTimeZoneNames]
returns an array of 401 elements, and there are much less than 200 timezones on the Earth.
我很确定其他应用程序也使用 + knownTimeZoneNames
,因为这是返回此类列表的唯一公共方法。但请确保您的代码正确无误。
I'm pretty sure "other apps" use +knownTimeZoneNames
as well, since this is the only public method returning such list. Please make sure your code is correct, though.
Settings.app使用私有 <来自私人的
Settings.app uses the private CPCity API from the private AppSupport.framework. It does have San Francisco, but it's private.
您需要创建自己的数据库(可以从 / System / Library /复制数据PrivateFrameworks / AppSupport.framework / all_cities_adj.plist
)。
You need to create your own database (the data can be copied from /System/Library/PrivateFrameworks/AppSupport.framework/all_cities_adj.plist
).
这篇关于iPhone的日期和版本在哪里?获得时区列表的时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!