Get the similar timezone list as in iphone Settings app

前端 未结 3 1499
面向向阳花
面向向阳花 2021-02-04 21:50

I am able to get list of timezones using

NSArray *timezoneNames = [NSTimeZone knownTimeZoneNames] ;

but the generated list of timezones does no

相关标签:
3条回答
  • 2021-02-04 21:59

    Settings.app uses a plist file to display the timezone list. The name of file is: "all_cities_adj.plist". To get to this file you need to traverse deep down into the SDK itself. I have mentioned the traverse path below where you can find it.

    1.Go to the folder where you have your Xcode. 2.Right-Click on it and then click Show Package Contents. 3.Then Contents --> Developer --> Platforms --> iPhoneSimulator.platform --> Developer --> SDKs --> iPhoneSimulator6.1.sdk --> System --> Library --> PrivateFrameworks --> AppSupport.framework 4.In this folder you can find the plist file.

    Please let me know if it helped...

    0 讨论(0)
  • Firstly you need to download the .csv file which will provide you country/cities/timezone/region. Using this file we can display the list of countries and their cities. When user select any city we need to map it with the respected country and then this country needs to be map with device's timezones([NSTimeZone knownTimeZoneNames];).

    This link also might be useful in this regard:

    Get timezone by Country and Region

    0 讨论(0)
  • 2021-02-04 22:12

    I've been running into this problem as well and there is no way to get the same timezones as in the settings app.

    You will need to create you own list.

    0 讨论(0)
提交回复
热议问题