From 71a5480033442267d376bfcc53a1f0e96530899a Mon Sep 17 00:00:00 2001 From: Igor Khmurets Date: Mon, 16 Dec 2013 19:49:50 +0300 Subject: [PATCH] Project now uses ARC --- api/MapsWithMeAPI.h | 1 + api/MapsWithMeAPI.m | 21 +- .../Capitals.xcodeproj/project.pbxproj | 19 +- capitals-example/Capitals/AppDelegate.m | 34 +- capitals-example/Capitals/City.h | 41 - capitals-example/Capitals/City.m | 272 -- .../Capitals/CityDetailViewController.h | 3 +- .../Capitals/CityDetailViewController.m | 42 +- .../Capitals/MasterViewController.m | 68 +- capitals-example/Capitals/capitals.plist | 3380 +++++++++++++++++ 10 files changed, 3465 insertions(+), 416 deletions(-) delete mode 100644 capitals-example/Capitals/City.h delete mode 100644 capitals-example/Capitals/City.m create mode 100644 capitals-example/Capitals/capitals.plist diff --git a/api/MapsWithMeAPI.h b/api/MapsWithMeAPI.h index 41873af..c119c58 100644 --- a/api/MapsWithMeAPI.h +++ b/api/MapsWithMeAPI.h @@ -44,6 +44,7 @@ /// it will be opened from MapsWithMe after selecting "More Details..." for the pin @property (nonatomic, retain) NSString * idOrUrl; - (id)initWithLat:(double)lat lon:(double)lon title:(NSString *)title andId:(NSString *)idOrUrl; + @end diff --git a/api/MapsWithMeAPI.m b/api/MapsWithMeAPI.m index d84448e..f601312 100644 --- a/api/MapsWithMeAPI.m +++ b/api/MapsWithMeAPI.m @@ -57,13 +57,6 @@ static BOOL openUrlOnBalloonClick = NO; return self; } -- (void)dealloc -{ - self.title = nil; - self.idOrUrl = nil; - [super dealloc]; -} - @end // Utility class to automatically handle "MapsWithMe is not installed" situations @@ -97,7 +90,7 @@ static BOOL openUrlOnBalloonClick = NO; MWMPin * pin = nil; if ([url.host isEqualToString:@"pin"]) { - pin = [[[MWMPin alloc] init] autorelease]; + pin = [[MWMPin alloc] init]; for (NSString * param in [url.query componentsSeparatedByString:@"&"]) { NSArray * values = [param componentsSeparatedByString:@"="]; @@ -140,7 +133,7 @@ static BOOL openUrlOnBalloonClick = NO; + (BOOL)showLat:(double)lat lon:(double)lon title:(NSString *)title andId:(NSString *)idOrUrl { - MWMPin * pin = [[[MWMPin alloc] initWithLat:lat lon:lon title:title andId:idOrUrl] autorelease]; + MWMPin * pin = [[MWMPin alloc] initWithLat:lat lon:lon title:title andId:idOrUrl]; return [MWMApi showPin:pin]; } @@ -183,9 +176,7 @@ static BOOL openUrlOnBalloonClick = NO; [str appendString:@"&balloonAction=openUrlOnBalloonClick"]; NSURL * url = [NSURL URLWithString:str]; - [str release]; BOOL const result = [[UIApplication sharedApplication] openURL:url]; - [url release]; return result; } @@ -237,17 +228,17 @@ static NSString * mapsWithMeIsNotInstalledPage = + (void)showMapsWithMeIsNotInstalledDialog { - UIWebView * webView = [[[UIWebView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]] autorelease]; + UIWebView * webView = [[UIWebView alloc] initWithFrame:[UIScreen mainScreen].applicationFrame]; // check that we have Internet connection and display fresh online page if possible if (gethostbyname("mapswith.me")) [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://mapswith.me/api_mwm_not_installed"]]]; else [webView loadHTMLString:mapsWithMeIsNotInstalledPage baseURL:[NSURL URLWithString:@"http://mapswith.me/"]]; - UIViewController * webController = [[[UIViewController alloc] init] autorelease]; + UIViewController * webController = [[UIViewController alloc] init]; webController.view = webView; webController.title = @"Install MapsWithMe"; - MWMNavigationController * navController = [[[MWMNavigationController alloc] initWithRootViewController:webController] autorelease]; - navController.navigationBar.topItem.rightBarButtonItem = [[[UIBarButtonItem alloc] initWithTitle:@"Close" style:UIBarButtonItemStyleDone target:navController action:@selector(onCloseButtonClicked:)] autorelease]; + MWMNavigationController * navController = [[MWMNavigationController alloc] initWithRootViewController:webController]; + navController.navigationBar.topItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Close" style:UIBarButtonItemStyleDone target:navController action:@selector(onCloseButtonClicked:)]; [[[UIApplication sharedApplication] delegate].window.rootViewController presentModalViewController:navController animated:YES]; } diff --git a/capitals-example/Capitals.xcodeproj/project.pbxproj b/capitals-example/Capitals.xcodeproj/project.pbxproj index 1ff8912..244563f 100644 --- a/capitals-example/Capitals.xcodeproj/project.pbxproj +++ b/capitals-example/Capitals.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 97F3580C185F5BB200DDF84D /* capitals.plist in Resources */ = {isa = PBXBuildFile; fileRef = 97F3580B185F5BB200DDF84D /* capitals.plist */; }; FA1792CE17784F000092B567 /* MapsWithMeAPI.m in Sources */ = {isa = PBXBuildFile; fileRef = FA1792CC17784F000092B567 /* MapsWithMeAPI.m */; }; FA776B4F17848A370023F7A0 /* MasterViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = FA776B4D17848A370023F7A0 /* MasterViewController.xib */; }; FAA484EA178108970027B232 /* 114x114.png in Resources */ = {isa = PBXBuildFile; fileRef = FAA484E2178108970027B232 /* 114x114.png */; }; @@ -26,12 +27,12 @@ FAD3DD63177221B500B0735B /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = FAD3DD62177221B500B0735B /* Default@2x.png */; }; FAD3DD65177221B500B0735B /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = FAD3DD64177221B500B0735B /* Default-568h@2x.png */; }; FAD3DD68177221B500B0735B /* MasterViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FAD3DD67177221B500B0735B /* MasterViewController.m */; }; - FAD3DD7F1772246600B0735B /* City.m in Sources */ = {isa = PBXBuildFile; fileRef = FAD3DD7E1772246600B0735B /* City.m */; }; FAD3DD8317724D4A00B0735B /* CityDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FAD3DD8117724D4A00B0735B /* CityDetailViewController.m */; }; FAD3DD8417724D4A00B0735B /* CityDetailViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = FAD3DD8217724D4A00B0735B /* CityDetailViewController.xib */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + 97F3580B185F5BB200DDF84D /* capitals.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = capitals.plist; sourceTree = ""; }; FA1792CC17784F000092B567 /* MapsWithMeAPI.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MapsWithMeAPI.m; path = ../api/MapsWithMeAPI.m; sourceTree = ""; }; FA1792CD17784F000092B567 /* MapsWithMeAPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MapsWithMeAPI.h; path = ../api/MapsWithMeAPI.h; sourceTree = ""; }; FA776B4D17848A370023F7A0 /* MasterViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MasterViewController.xib; sourceTree = ""; }; @@ -57,8 +58,6 @@ FAD3DD64177221B500B0735B /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = ""; }; FAD3DD66177221B500B0735B /* MasterViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MasterViewController.h; sourceTree = ""; }; FAD3DD67177221B500B0735B /* MasterViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MasterViewController.m; sourceTree = ""; }; - FAD3DD7D177223BB00B0735B /* City.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = City.h; sourceTree = ""; }; - FAD3DD7E1772246600B0735B /* City.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = City.m; sourceTree = ""; }; FAD3DD8017724D4A00B0735B /* CityDetailViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CityDetailViewController.h; sourceTree = ""; }; FAD3DD8117724D4A00B0735B /* CityDetailViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CityDetailViewController.m; sourceTree = ""; }; FAD3DD8217724D4A00B0735B /* CityDetailViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = CityDetailViewController.xib; sourceTree = ""; }; @@ -120,8 +119,6 @@ children = ( FAD3DD5D177221B500B0735B /* AppDelegate.h */, FAD3DD5E177221B500B0735B /* AppDelegate.m */, - FAD3DD7D177223BB00B0735B /* City.h */, - FAD3DD7E1772246600B0735B /* City.m */, FAD3DD8017724D4A00B0735B /* CityDetailViewController.h */, FAD3DD8117724D4A00B0735B /* CityDetailViewController.m */, FAD3DD8217724D4A00B0735B /* CityDetailViewController.xib */, @@ -136,6 +133,7 @@ FAD3DD55177221B500B0735B /* Supporting Files */ = { isa = PBXGroup; children = ( + 97F3580B185F5BB200DDF84D /* capitals.plist */, FAA484E2178108970027B232 /* 114x114.png */, FAA484E3178108970027B232 /* 144x144.png */, FAA484E4178108970027B232 /* 100x100.png */, @@ -206,6 +204,7 @@ buildActionMask = 2147483647; files = ( FAD3DD61177221B500B0735B /* Default.png in Resources */, + 97F3580C185F5BB200DDF84D /* capitals.plist in Resources */, FAD3DD63177221B500B0735B /* Default@2x.png in Resources */, FAD3DD65177221B500B0735B /* Default-568h@2x.png in Resources */, FAD3DD8417724D4A00B0735B /* CityDetailViewController.xib in Resources */, @@ -231,7 +230,6 @@ FAD3DD5B177221B500B0735B /* main.m in Sources */, FAD3DD5F177221B500B0735B /* AppDelegate.m in Sources */, FAD3DD68177221B500B0735B /* MasterViewController.m in Sources */, - FAD3DD7F1772246600B0735B /* City.m in Sources */, FAD3DD8317724D4A00B0735B /* CityDetailViewController.m in Sources */, FA1792CE17784F000092B567 /* MapsWithMeAPI.m in Sources */, ); @@ -268,10 +266,11 @@ FA776B5217848EC50023F7A0 /* Production */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ENABLE_OBJC_ARC = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "Capitals/Capitals-Prefix.pch"; INFOPLIST_FILE = "Capitals/Capitals-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 4.3; + IPHONEOS_DEPLOYMENT_TARGET = 5.0; PRODUCT_NAME = "World Capitals"; WRAPPER_EXTENSION = app; }; @@ -334,10 +333,11 @@ FAD3DD7B177221B500B0735B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ENABLE_OBJC_ARC = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "Capitals/Capitals-Prefix.pch"; INFOPLIST_FILE = "Capitals/Capitals-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 4.3; + IPHONEOS_DEPLOYMENT_TARGET = 5.0; PRODUCT_NAME = "World Capitals"; WRAPPER_EXTENSION = app; }; @@ -346,10 +346,11 @@ FAD3DD7C177221B500B0735B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ENABLE_OBJC_ARC = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "Capitals/Capitals-Prefix.pch"; INFOPLIST_FILE = "Capitals/Capitals-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 4.3; + IPHONEOS_DEPLOYMENT_TARGET = 5.0; PRODUCT_NAME = "World Capitals"; WRAPPER_EXTENSION = app; }; diff --git a/capitals-example/Capitals/AppDelegate.m b/capitals-example/Capitals/AppDelegate.m index ea59875..c78c409 100644 --- a/capitals-example/Capitals/AppDelegate.m +++ b/capitals-example/Capitals/AppDelegate.m @@ -43,14 +43,14 @@ MWMPin * pin = [MWMApi pinFromUrl:url]; if (pin) { - size_t const cityId = [pin.idOrUrl integerValue]; + NSInteger const cityId = [pin.idOrUrl integerValue]; // display selected page based on passed id - if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) + if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone) { [self.navigationController popToRootViewControllerAnimated:NO]; - MasterViewController * masterVC = [self.navigationController.viewControllers objectAtIndex:0]; + MasterViewController * masterVC = self.navigationController.viewControllers[0]; if (!masterVC.detailViewController) - masterVC.detailViewController = [[[CityDetailViewController alloc] initWithNibName:@"CityDetailViewController" bundle:nil] autorelease]; + masterVC.detailViewController = [[CityDetailViewController alloc] initWithNibName:@"CityDetailViewController" bundle:nil]; masterVC.detailViewController.cityIndex = cityId; [masterVC.navigationController pushViewController:masterVC.detailViewController animated:YES]; } @@ -65,35 +65,27 @@ return NO; } -- (void)dealloc -{ - self.window = nil; - self.navigationController = nil; - self.splitViewController = nil; - [super dealloc]; -} - - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; + self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; - if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) + if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone) { - MasterViewController * masterViewController = [[[MasterViewController alloc] initWithNibName:@"MasterViewController" bundle:nil] autorelease]; - self.navigationController = [[[UINavigationController alloc] initWithRootViewController:masterViewController] autorelease]; + MasterViewController * masterViewController = [[MasterViewController alloc] initWithNibName:@"MasterViewController" bundle:nil]; + self.navigationController = [[UINavigationController alloc] initWithRootViewController:masterViewController]; self.window.rootViewController = self.navigationController; } else { - MasterViewController * masterViewController = [[[MasterViewController alloc] initWithNibName:@"MasterViewController" bundle:nil] autorelease]; - UINavigationController * masterNavigationController = [[[UINavigationController alloc] initWithRootViewController:masterViewController] autorelease]; + MasterViewController * masterViewController = [[MasterViewController alloc] initWithNibName:@"MasterViewController" bundle:nil]; + UINavigationController * masterNavigationController = [[UINavigationController alloc] initWithRootViewController:masterViewController]; - CityDetailViewController * detailViewController = [[[CityDetailViewController alloc] initWithNibName:@"CityDetailViewController" bundle:nil] autorelease]; - UINavigationController * detailNavigationController = [[[UINavigationController alloc] initWithRootViewController:detailViewController] autorelease]; + CityDetailViewController * detailViewController = [[CityDetailViewController alloc] initWithNibName:@"CityDetailViewController" bundle:nil]; + UINavigationController * detailNavigationController = [[UINavigationController alloc] initWithRootViewController:detailViewController]; masterViewController.detailViewController = detailViewController; - self.splitViewController = [[[UISplitViewController alloc] init] autorelease]; + self.splitViewController = [[UISplitViewController alloc] init]; self.splitViewController.delegate = detailViewController; self.splitViewController.viewControllers = @[masterNavigationController, detailNavigationController]; diff --git a/capitals-example/Capitals/City.h b/capitals-example/Capitals/City.h deleted file mode 100644 index e439345..0000000 --- a/capitals-example/Capitals/City.h +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - - Copyright (c) 2013, MapsWithMe GmbH - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - ******************************************************************************/ - -@class NSString; - -typedef struct -{ - NSString * name; - double lat; - double lon; - NSString * countryCode; - int population; - NSString * timeZone; -} City; - -extern City const CAPITALS[241]; \ No newline at end of file diff --git a/capitals-example/Capitals/City.m b/capitals-example/Capitals/City.m deleted file mode 100644 index 53a625e..0000000 --- a/capitals-example/Capitals/City.m +++ /dev/null @@ -1,272 +0,0 @@ -/******************************************************************************* - - Copyright (c) 2013, MapsWithMe GmbH - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - ******************************************************************************/ - -#include "City.h" - - City const CAPITALS[241] = {{@"Abu Dhabi", 24.46667, 54.36667, @"AE", 603492, @"Asia/Dubai"}, - {@"Abuja", 9.06853, 7.48375, @"NG", 590400, @"Africa/Lagos"}, - {@"Accra", 5.55602, -0.1969, @"GH", 1963264, @"Africa/Accra"}, - {@"Adamstown", -25.06597, -130.1015, @"PN", 46, @"Pacific/Pitcairn"}, - {@"Addis Ababa", 9.02497, 38.74689, @"ET", 2757729, @"Africa/Addis_Ababa"}, - {@"Algiers", 36.7525, 3.04197, @"DZ", 1977663, @"Africa/Algiers"}, - {@"Alofi", -19.05952, -169.9187, @"NU", 624, @"Pacific/Niue"}, - {@"Amman", 31.95522, 35.94503, @"JO", 1275857, @"Asia/Amman"}, - {@"Amsterdam", 52.37403, 4.88969, @"NL", 741636, @"Europe/Amsterdam"}, - {@"Andorra la Vella", 42.50779, 1.52109, @"AD", 20430, @"Europe/Andorra"}, - {@"Ankara", 39.91987, 32.85427, @"TR", 3517182, @"Europe/Istanbul"}, - {@"Antananarivo", -18.91368, 47.53613, @"MG", 1391433, @"Indian/Antananarivo"}, - {@"Apia", -13.83333, -171.7667, @"WS", 40407, @"Pacific/Apia"}, - {@"Ashgabat", 37.95, 58.38333, @"TM", 727700, @"Asia/Ashgabat"}, - {@"Asmara", 15.33805, 38.93184, @"ER", 563930, @"Africa/Asmara"}, - {@"Astana", 51.1801, 71.44598, @"KZ", 345604, @"Asia/Almaty"}, - {@"Asunción", -25.30066, -57.63591, @"PY", 1482200, @"America/Asuncion"}, - {@"Athens", 37.97945, 23.71622, @"GR", 729137, @"Europe/Athens"}, - {@"Avarua", -21.20778, -159.775, @"CK", 13373, @"Pacific/Rarotonga"}, - {@"Baghdad", 33.34058, 44.40088, @"IQ", 5672513, @"Asia/Baghdad"}, - {@"Baku", 40.37767, 49.89201, @"AZ", 1116513, @"Asia/Baku"}, - {@"Bamako", 12.65, -8, @"ML", 1297281, @"Africa/Bamako"}, - {@"Bandar Seri Begawan", 4.94029, 114.9481, @"BN", 64409, @"Asia/Brunei"}, - {@"Bangkok", 13.75398, 100.5014, @"TH", 5104476, @"Asia/Bangkok"}, - {@"Bangui", 4.36122, 18.55496, @"CF", 542393, @"Africa/Bangui"}, - {@"Banjul", 13.45274, -16.57803, @"GM", 34589, @"Africa/Banjul"}, - {@"Basse-Terre", 15.99854, -61.72548, @"GP", 11472, @"America/Guadeloupe"}, - {@"Basseterre", 17.29484, -62.7261, @"KN", 12920, @"America/St_Kitts"}, - {@"Beijing", 39.9075, 116.3972, @"CN", 7480601, @"Asia/Shanghai"}, - {@"Beirut", 33.88894, 35.49442, @"LB", 1916100, @"Asia/Beirut"}, - {@"Belgrade", 44.80401, 20.46513, @"RS", 1273651, @"Europe/Belgrade"}, - {@"Belmopan", 17.25, -88.76667, @"BZ", 13381, @"America/Belize"}, - {@"Berlin", 52.52437, 13.41053, @"DE", 3426354, @"Europe/Berlin"}, - {@"Bern", 46.94809, 7.44744, @"CH", 121631, @"Europe/Zurich"}, - {@"Bishkek", 42.87, 74.59, @"KG", 900000, @"Asia/Bishkek"}, - {@"Bissau", 11.86357, -15.59767, @"GW", 388028, @"Africa/Bissau"}, - {@"Bogotá", 4.60971, -74.08175, @"CO", 7102602, @"America/Bogota"}, - {@"Brasília", -15.77972, -47.92972, @"BR", 2207718, @"America/Sao_Paulo"}, - {@"Bratislava", 48.14816, 17.10674, @"SK", 423737, @"Europe/Bratislava"}, - {@"Brazzaville", -4.26613, 15.28318, @"CG", 1284609, @"Africa/Brazzaville"}, - {@"Bridgetown", 13.1, -59.61667, @"BB", 98511, @"America/Barbados"}, - {@"Brussels", 50.85045, 4.34878, @"BE", 1019022, @"Europe/Brussels"}, - {@"Bucharest", 44.43225, 26.10626, @"RO", 1877155, @"Europe/Bucharest"}, - {@"Budapest", 47.49801, 19.03991, @"HU", 1696128, @"Europe/Budapest"}, - {@"Buenos Aires", -34.61315, -58.37723, @"AR", 13076300, @"America/Argentina/Buenos_Aires"}, - {@"Bujumbura", -3.3822, 29.3644, @"BI", 331700, @"Africa/Bujumbura"}, - {@"Cairo", 30.06263, 31.24967, @"EG", 7734614, @"Africa/Cairo"}, - {@"Canberra", -35.28346, 149.1281, @"AU", 327700, @"Australia/Sydney"}, - {@"Caracas", 10.48801, -66.87919, @"VE", 3000000, @"America/Caracas"}, - {@"Castries", 13.9957, -61.00614, @"LC", 10000, @"America/St_Lucia"}, - {@"Cayenne", 4.93333, -52.33333, @"GF", 61550, @"America/Cayenne"}, - {@"Charlotte Amalie", 18.3419, -64.9307, @"VI", 20000, @"America/St_Thomas"}, - {@"Chişinău", 47.00556, 28.8575, @"MD", 635994, @"Europe/Chisinau"}, - {@"Cockburn Town", 21.46122, -71.14188, @"TC", 3720, @"America/Grand_Turk"}, - {@"Colombo", 6.93194, 79.84778, @"LK", 648034, @"Asia/Colombo"}, - {@"Conakry", 9.53795, -13.67729, @"GN", 1767200, @"Africa/Conakry"}, - {@"Copenhagen", 55.67594, 12.56553, @"DK", 1153615, @"Europe/Copenhagen"}, - {@"Dakar", 14.6937, -17.44406, @"SN", 2476400, @"Africa/Dakar"}, - {@"Damascus", 33.5102, 36.29128, @"SY", 1569394, @"Asia/Damascus"}, - {@"Dhaka", 23.7104, 90.40744, @"BD", 10356500, @"Asia/Dhaka"}, - {@"Dili", -8.55861, 125.5736, @"TL", 150000, @"Asia/Dili"}, - {@"Djibouti", 11.58901, 43.14503, @"DJ", 623891, @"Africa/Djibouti"}, - {@"Dodoma", -6.17221, 35.73947, @"TZ", 180541, @"Africa/Dar_es_Salaam"}, - {@"Doha", 25.27932, 51.52245, @"QA", 344939, @"Asia/Qatar"}, - {@"Douglas", 54.15, -4.48333, @"IM", 26218, @"Europe/Isle_of_Man"}, - {@"Dublin", 53.33306, -6.24889, @"IE", 1024027, @"Europe/Dublin"}, - {@"Dushanbe", 38.53575, 68.77905, @"TJ", 543107, @"Asia/Dushanbe"}, - {@"Flying Fish Cove", -10.42172, 105.6791, @"CX", 500, @"Indian/Christmas"}, - {@"Fort-de-France", 14.60892, -61.07334, @"MQ", 89995, @"America/Martinique"}, - {@"Freetown", 8.484, -13.22994, @"SL", 802639, @"Africa/Freetown"}, - {@"Funafuti", -8.52425, 179.1942, @"TV", 4492, @"Pacific/Funafuti"}, - {@"Gaborone", -24.65451, 25.90859, @"BW", 208411, @"Africa/Gaborone"}, - {@"George Town", 19.28692, -81.36706, @"KY", 29370, @"America/Cayman"}, - {@"Georgetown", 6.80448, -58.15527, @"GY", 235017, @"America/Guyana"}, - {@"Gibraltar", 36.14474, -5.35257, @"GI", 26544, @"Europe/Gibraltar"}, - {@"Grytviken", -54.28111, -36.5092, @"GS", 2, @"Atlantic/South_Georgia"}, - {@"Guatemala City", 14.64072, -90.51327, @"GT", 994938, @"America/Guatemala"}, - {@"Gustavia", 17.89618, -62.84978, @"BL", 5988, @"America/St_Barthelemy"}, - {@"Hagåtña", 13.47567, 144.7489, @"GU", 1051, @"Pacific/Guam"}, - {@"Hamilton", 32.29149, -64.77797, @"BM", 902, @"Atlantic/Bermuda"}, - {@"Harare", -17.82772, 31.05337, @"ZW", 1542813, @"Africa/Harare"}, - {@"Havana", 23.13302, -82.38304, @"CU", 2163824, @"America/Havana"}, - {@"Helsinki", 60.16952, 24.93545, @"FI", 558457, @"Europe/Helsinki"}, - {@"Hong Kong", 22.28552, 114.1577, @"HK", 7012738, @"Asia/Hong_Kong"}, - {@"Honiara", -9.43333, 159.95, @"SB", 56298, @"Pacific/Guadalcanal"}, - {@"Hà Nội", 21.0245, 105.8412, @"VN", 1431270, @"Asia/Ho_Chi_Minh"}, - {@"Islamabad", 33.72148, 73.04329, @"PK", 601600, @"Asia/Karachi"}, - {@"Jakarta", -6.21462, 106.8451, @"ID", 8540121, @"Asia/Jakarta"}, - {@"Jamestown", -15.93872, -5.71675, @"SH", 637, @"Atlantic/St_Helena"}, - {@"Juba", 4.85165, 31.58247, @"SS", 300000, @"Africa/Juba"}, - {@"Kabul", 34.52813, 69.17233, @"AF", 3043532, @"Asia/Kabul"}, - {@"Kampala", 0.31628, 32.58219, @"UG", 1353189, @"Africa/Kampala"}, - {@"Kathmandu", 27.70169, 85.3206, @"NP", 1442271, @"Asia/Kathmandu"}, - {@"Khartoum", 15.55177, 32.53241, @"SD", 1974647, @"Africa/Khartoum"}, - {@"Kiev", 50.45466, 30.5238, @"UA", 2514227, @"Europe/Kiev"}, - {@"Kigali", -1.94995, 30.05885, @"RW", 745261, @"Africa/Kigali"}, - {@"Kingston", -29.05459, 167.9663, @"NF", 880, @"Pacific/Norfolk"}, - {@"Kingston", 17.99702, -76.79358, @"JM", 937700, @"America/Jamaica"}, - {@"Kingstown", 13.15872, -61.22475, @"VC", 24518, @"America/St_Vincent"}, - {@"Kinshasa", -4.32142, 15.30807, @"CD", 7785965, @"Africa/Kinshasa"}, - {@"Kralendijk", 12.15, -68.26667, @"BQ", 3081, @"America/Kralendijk"}, - {@"Kuala Lumpur", 3.1412, 101.6865, @"MY", 1453975, @"Asia/Kuala_Lumpur"}, - {@"Kuwait City", 29.36972, 47.97833, @"KW", 60064, @"Asia/Kuwait"}, - {@"El Aaiún", 27.16224, -13.20315, @"EH", 188084, @"Africa/El_Aaiun"}, - {@"Libreville", 0.39241, 9.45356, @"GA", 578156, @"Africa/Libreville"}, - {@"Lilongwe", -13.96692, 33.78725, @"MW", 646750, @"Africa/Blantyre"}, - {@"Lima", -12.04318, -77.02824, @"PE", 7737002, @"America/Lima"}, - {@"Lisbon", 38.71667, -9.13333, @"PT", 517802, @"Europe/Lisbon"}, - {@"Ljubljana", 46.05108, 14.50513, @"SI", 255115, @"Europe/Ljubljana"}, - {@"Lomé", 6.13748, 1.21227, @"TG", 749700, @"Africa/Lome"}, - {@"London", 51.50853, -0.12574, @"GB", 7556900, @"Europe/London"}, - {@"Longyearbyen", 78.2186, 15.64007, @"SJ", 2060, @"Arctic/Longyearbyen"}, - {@"Luanda", -8.83682, 13.23432, @"AO", 2776168, @"Africa/Luanda"}, - {@"Lusaka", -15.40669, 28.28713, @"ZM", 1267440, @"Africa/Lusaka"}, - {@"Luxembourg", 49.61167, 6.13, @"LU", 76684, @"Europe/Luxembourg"}, - {@"Macau", 22.20056, 113.5461, @"MO", 520400, @"Asia/Macau"}, - {@"Madrid", 40.4165, -3.70256, @"ES", 3255944, @"Europe/Madrid"}, - {@"Majuro", 7.08971, 171.3803, @"MH", 25400, @"Pacific/Majuro"}, - {@"Malabo", 3.75, 8.78333, @"GQ", 155963, @"Africa/Malabo"}, - {@"Male", 4.1748, 73.50888, @"MV", 103693, @"Indian/Maldives"}, - {@"Mamoudzou", -12.77944, 45.22722, @"YT", 54831, @"Indian/Mayotte"}, - {@"Managua", 12.13282, -86.2504, @"NI", 973087, @"America/Managua"}, - {@"Manama", 26.21536, 50.5832, @"BH", 147074, @"Asia/Bahrain"}, - {@"Manila", 14.6042, 120.9822, @"PH", 10444527, @"Asia/Manila"}, - {@"Maputo", -25.96553, 32.58322, @"MZ", 1191613, @"Africa/Maputo"}, - {@"Mariehamn", 60.09726, 19.93481, @"AX", 10682, @"Europe/Mariehamn"}, - {@"Marigot", 18.06667, -63.08333, @"MF", 5700, @"America/Marigot"}, - {@"Maseru", -29.31667, 27.48333, @"LS", 118355, @"Africa/Maseru"}, - {@"Mata-Utu", -13.28163, -176.1745, @"WF", 1200, @"Pacific/Wallis"}, - {@"Mbabane", -26.31667, 31.13333, @"SZ", 76218, @"Africa/Mbabane"}, - {@"Melekeok", 7.50043, 134.6235, @"PW", 0, @"Pacific/Palau"}, - {@"Mexico City", 19.42847, -99.12766, @"MX", 12294193, @"America/Mexico_City"}, - {@"Minsk", 53.9, 27.56667, @"BY", 1742124, @"Europe/Minsk"}, - {@"Mogadishu", 2.03711, 45.34375, @"SO", 2587183, @"Africa/Mogadishu"}, - {@"Monaco", 43.73333, 7.41667, @"MC", 32965, @"Europe/Monaco"}, - {@"Monrovia", 6.30054, -10.7969, @"LR", 939524, @"Africa/Monrovia"}, - {@"Montevideo", -34.83346, -56.16735, @"UY", 1270737, @"America/Montevideo"}, - {@"Moroni", -11.70216, 43.25506, @"KM", 42872, @"Indian/Comoro"}, - {@"Moscow", 55.75222, 37.61556, @"RU", 10381222, @"Europe/Moscow"}, - {@"Muscat", 23.61387, 58.5922, @"OM", 797000, @"Asia/Muscat"}, - {@"N'Djamena", 12.10672, 15.0444, @"TD", 721081, @"Africa/Ndjamena"}, - {@"Nairobi", -1.28333, 36.81667, @"KE", 2750547, @"Africa/Nairobi"}, - {@"Nassau", 25.05823, -77.34306, @"BS", 227940, @"America/Nassau"}, - {@"Nay Pyi Taw", 19.745, 96.12972, @"MM", 925000, @"Asia/Rangoon"}, - {@"New Delhi", 28.63576, 77.22445, @"IN", 317797, @"Asia/Kolkata"}, - {@"Niamey", 13.51366, 2.1098, @"NE", 774235, @"Africa/Niamey"}, - {@"Nicosia", 35.16667, 33.36667, @"CY", 200452, @"Asia/Nicosia"}, - {@"Nouakchott", 18.08581, -15.9785, @"MR", 661400, @"Africa/Nouakchott"}, - {@"Nouméa", -22.27631, 166.4572, @"NC", 93060, @"Pacific/Noumea"}, - {@"Nuku‘alofa", -21.13938, -175.2018, @"TO", 22400, @"Pacific/Tongatapu"}, - {@"Nuuk", 64.18347, -51.72157, @"GL", 14798, @"America/Godthab"}, - {@"Oranjestad", 12.52398, -70.02703, @"AW", 29998, @"America/Aruba"}, - {@"Oslo", 59.91273, 10.74609, @"NO", 580000, @"Europe/Oslo"}, - {@"Ottawa", 45.41117, -75.69812, @"CA", 812129, @"America/Toronto"}, - {@"Ouagadougou", 12.36566, -1.53388, @"BF", 1086505, @"Africa/Ouagadougou"}, - {@"Pago Pago", -14.27806, -170.7025, @"AS", 11500, @"Pacific/Pago_Pago"}, - {@"Palikir - National Government Center", 6.92477, 158.1611, @"FM", 0, @"Pacific/Pohnpei"}, - {@"Panamá", 8.9936, -79.51973, @"PA", 408168, @"America/Panama"}, - {@"Papeete", -17.53333, -149.5667, @"PF", 26357, @"Pacific/Tahiti"}, - {@"Paramaribo", 5.86638, -55.16682, @"SR", 223757, @"America/Paramaribo"}, - {@"Paris", 48.85341, 2.3488, @"FR", 2138551, @"Europe/Paris"}, - {@"Philipsburg", 18.026, -63.04582, @"SX", 1400, @"America/Lower_Princes"}, - {@"Phnom Penh", 11.56245, 104.916, @"KH", 1573544, @"Asia/Phnom_Penh"}, - {@"Plymouth", 16.70555, -62.21292, @"MS", 0, @"America/Montserrat"}, - {@"Podgorica", 42.44111, 19.26361, @"ME", 136473, @"Europe/Podgorica"}, - {@"Port Louis", -20.16194, 57.49889, @"MU", 155226, @"Indian/Mauritius"}, - {@"Port Moresby", -9.44314, 147.1797, @"PG", 283733, @"Pacific/Port_Moresby"}, - {@"Port-Vila", -17.73381, 168.3219, @"VU", 35901, @"Pacific/Efate"}, - {@"Port-au-Prince", 18.53917, -72.335, @"HT", 1234742, @"America/Port-au-Prince"}, - {@"Port-aux-Français", -49.35, 70.21667, @"TF", 45, @"Indian/Kerguelen"}, - {@"Port-of-Spain", 10.66617, -61.51657, @"TT", 49031, @"America/Port_of_Spain"}, - {@"Porto-Novo", 6.49646, 2.60359, @"BJ", 234168, @"Africa/Porto-Novo"}, - {@"Prague", 50.08804, 14.42076, @"CZ", 1165581, @"Europe/Prague"}, - {@"Praia", 14.93152, -23.51254, @"CV", 113364, @"Atlantic/Cape_Verde"}, - {@"Pretoria", -25.74486, 28.18783, @"ZA", 1619438, @"Africa/Johannesburg"}, - {@"Pristina", 42.67272, 21.16688, @"XK", 550000, @"Europe/Belgrade"}, - {@"Pyongyang", 39.03385, 125.7543, @"KP", 3222000, @"Asia/Pyongyang"}, - {@"Quito", -0.22985, -78.52495, @"EC", 1399814, @"America/Guayaquil"}, - {@"Rabat", 34.01325, -6.83255, @"MA", 1655753, @"Africa/Casablanca"}, - {@"Reykjavík", 64.13548, -21.89541, @"IS", 113906, @"Atlantic/Reykjavik"}, - {@"Riga", 56.946, 24.10589, @"LV", 742572, @"Europe/Riga"}, - {@"Riyadh", 24.68773, 46.72185, @"SA", 4205961, @"Asia/Riyadh"}, - {@"Road Town", 18.41667, -64.61667, @"VG", 8449, @"America/Tortola"}, - {@"Rome", 41.89474, 12.4839, @"IT", 2563241, @"Europe/Rome"}, - {@"Roseau", 15.30174, -61.38808, @"DM", 16571, @"America/Dominica"}, - {@"Saint George's", 12.05644, -61.74849, @"GD", 7500, @"America/Grenada"}, - {@"Saint Helier", 49.18804, -2.10491, @"JE", 28000, @"Europe/Jersey"}, - {@"Saint John’s", 17.11667, -61.85, @"AG", 24226, @"America/Antigua"}, - {@"Saint Peter Port", 49.45981, -2.53527, @"GG", 16488, @"Europe/Guernsey"}, - {@"Saint-Denis", -20.88231, 55.4504, @"RE", 137195, @"Indian/Reunion"}, - {@"Saint-Pierre", 46.78091, -56.17196, @"PM", 6200, @"America/Miquelon"}, - {@"Saipan", 15.21233, 145.7545, @"MP", 48220, @"Pacific/Saipan"}, - {@"San José", 9.93333, -84.08333, @"CR", 335007, @"America/Costa_Rica"}, - {@"San Juan", 18.46633, -66.10572, @"PR", 418140, @"America/Puerto_Rico"}, - {@"San Marino", 43.93667, 12.44639, @"SM", 4500, @"Europe/San_Marino"}, - {@"San Salvador", 13.68935, -89.18718, @"SV", 525990, @"America/El_Salvador"}, - {@"Sanaa", 15.35472, 44.20667, @"YE", 1937451, @"Asia/Aden"}, - {@"Santiago", -33.45694, -70.64827, @"CL", 4837295, @"America/Santiago"}, - {@"Santo Domingo", 18.50012, -69.98857, @"DO", 2201941, @"America/Santo_Domingo"}, - {@"Sarajevo", 43.84864, 18.35644, @"BA", 696731, @"Europe/Sarajevo"}, - {@"Seoul", 37.56826, 126.9778, @"KR", 10349312, @"Asia/Seoul"}, - {@"Singapore", 1.28967, 103.8501, @"SG", 3547809, @"Asia/Singapore"}, - {@"Skopje", 42.00122, 21.42878, @"MK", 474889, @"Europe/Skopje"}, - {@"Sofia", 42.69751, 23.32415, @"BG", 1152556, @"Europe/Sofia"}, - {@"Stanley", -51.7, -57.85, @"FK", 2213, @"Atlantic/Stanley"}, - {@"Stockholm", 59.33258, 18.0649, @"SE", 1253309, @"Europe/Stockholm"}, - {@"Sucre", -19.03332, -65.26274, @"BO", 224838, @"America/La_Paz"}, - {@"Suva", -18.14161, 178.4415, @"FJ", 77366, @"Pacific/Fiji"}, - {@"São Tomé", 0.33654, 6.72732, @"ST", 53300, @"Africa/Sao_Tome"}, - {@"Taipei", 25.04776, 121.5319, @"TW", 7871900, @"Asia/Taipei"}, - {@"Tallinn", 59.43696, 24.75353, @"EE", 394024, @"Europe/Tallinn"}, - {@"Tarawa", 1.3278, 172.977, @"KI", 40311, @"Pacific/Tarawa"}, - {@"Tashkent", 41.26465, 69.21627, @"UZ", 1978028, @"Asia/Tashkent"}, - {@"Tbilisi", 41.69411, 44.83368, @"GE", 1049498, @"Asia/Tbilisi"}, - {@"Tegucigalpa", 14.0818, -87.20681, @"HN", 850848, @"America/Tegucigalpa"}, - {@"Tehrān", 35.69439, 51.42151, @"IR", 7153309, @"Asia/Tehran"}, - {@"The Valley", 18.21704, -63.05783, @"AI", 2035, @"America/Anguilla"}, - {@"Thimphu", 27.46609, 89.64191, @"BT", 98676, @"Asia/Thimphu"}, - {@"Tirana", 41.3275, 19.81889, @"AL", 374801, @"Europe/Tirane"}, - {@"Tokyo", 35.6895, 139.6917, @"JP", 8336599, @"Asia/Tokyo"}, - {@"Tripoli", 32.87519, 13.18746, @"LY", 1150989, @"Africa/Tripoli"}, - {@"Tunis", 36.81897, 10.16579, @"TN", 693210, @"Africa/Tunis"}, - {@"Tórshavn", 62.00973, -6.77164, @"FO", 13200, @"Atlantic/Faroe"}, - {@"Ulaanbaatar", 47.90771, 106.8832, @"MN", 844818, @"Asia/Ulaanbaatar"}, - {@"Vaduz", 47.14151, 9.52154, @"LI", 5197, @"Europe/Vaduz"}, - {@"Valletta", 35.89972, 14.51472, @"MT", 6794, @"Europe/Malta"}, - {@"Vatican City", 41.90236, 12.45332, @"VA", 829, @"Europe/Vatican"}, - {@"Victoria", -4.61667, 55.45, @"SC", 22881, @"Indian/Mahe"}, - {@"Vienna", 48.20849, 16.37208, @"AT", 1691468, @"Europe/Vienna"}, - {@"Vientiane", 17.96667, 102.6, @"LA", 196731, @"Asia/Vientiane"}, - {@"Vilnius", 54.68916, 25.2798, @"LT", 542366, @"Europe/Vilnius"}, - {@"Warsaw", 52.22977, 21.01178, @"PL", 1702139, @"Europe/Warsaw"}, - {@"Washington, D. C.", 38.89511, -77.03637, @"US", 601723, @"America/New_York"}, - {@"Wellington", -41.28664, 174.7756, @"NZ", 381900, @"Pacific/Auckland"}, - {@"West Island", -12.15681, 96.82251, @"CC", 120, @"Indian/Cocos"}, - {@"Willemstad", 12.1084, -68.93354, @"CW", 125000, @"America/Curacao"}, - {@"Windhoek", -22.55941, 17.08323, @"NA", 268132, @"Africa/Windhoek"}, - {@"Yamoussoukro", 6.82055, -5.27674, @"CI", 194530, @"Africa/Abidjan"}, - {@"Yaoundé", 3.86667, 11.51667, @"CM", 1299369, @"Africa/Douala"}, - {@"Yerevan", 40.18111, 44.51361, @"AM", 1093485, @"Asia/Yerevan"}, - {@"Zagreb", 45.81444, 15.97798, @"HR", 698966, @"Europe/Zagreb"} - }; diff --git a/capitals-example/Capitals/CityDetailViewController.h b/capitals-example/Capitals/CityDetailViewController.h index 5481b1b..53f96b8 100644 --- a/capitals-example/Capitals/CityDetailViewController.h +++ b/capitals-example/Capitals/CityDetailViewController.h @@ -30,6 +30,7 @@ @interface CityDetailViewController : UITableViewController -@property (nonatomic, assign) size_t cityIndex; +@property (nonatomic, assign) NSInteger cityIndex; +@property (strong, nonatomic) NSDictionary * city; @end diff --git a/capitals-example/Capitals/CityDetailViewController.m b/capitals-example/Capitals/CityDetailViewController.m index 1d31b0a..68d50b4 100644 --- a/capitals-example/Capitals/CityDetailViewController.m +++ b/capitals-example/Capitals/CityDetailViewController.m @@ -27,41 +27,30 @@ ******************************************************************************/ #import "CityDetailViewController.h" -#import "City.h" #import "MapsWithMeAPI.h" @interface CityDetailViewController () + @property (strong, nonatomic) UIPopoverController * masterPopoverController; - (void)configureView; + @end @implementation CityDetailViewController -- (NSString *)urlEncode:(NSString *)str -{ - return [(NSString *)CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef)str, NULL, CFSTR("!$&'()*+,-./:;=?@_~"), kCFStringEncodingUTF8) autorelease]; -} - - (void)showCapitalOnTheMap:(BOOL)withLink { - City const * city = &CAPITALS[_cityIndex]; NSString * pinId; if (withLink) - pinId = [NSString stringWithFormat:@"http://en.wikipedia.org/wiki/%@", [self urlEncode:city->name]]; + pinId = [NSString stringWithFormat:@"http://en.wikipedia.org/wiki/%@", [self.city[@"name"] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]; else - pinId = [NSString stringWithFormat:@"%ld", _cityIndex]; - [MWMApi showLat:city->lat lon:city->lon title:city->name andId:pinId]; + pinId = [NSString stringWithFormat:@"%i", _cityIndex]; + [MWMApi showLat:[self.city[@"lat"] doubleValue] lon:[self.city[@"lon"] doubleValue] title:self.city[@"name"] andId:pinId]; } -- (void)dealloc -{ - self.masterPopoverController = nil; - [super dealloc]; -} - -- (void)setCityIndex:(size_t)newCityIndex +- (void)setCityIndex:(NSInteger)newCityIndex { if (_cityIndex != newCityIndex) { @@ -70,13 +59,13 @@ [self configureView]; } - if (self.masterPopoverController != nil) + if (self.masterPopoverController) [self.masterPopoverController dismissPopoverAnimated:YES]; } - (void)configureView { - self.title = CAPITALS[_cityIndex].name; + self.title = self.city[@"name"]; [self.tableView reloadData]; } @@ -106,7 +95,7 @@ { if (indexPath.section == 0) { - cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cellId] autorelease]; + cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cellId]; cell.selectionStyle = UITableViewCellSelectionStyleNone; switch (indexPath.row) { @@ -120,7 +109,7 @@ } else { - cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellId] autorelease]; + cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellId]; cell.textLabel.textAlignment = UITextAlignmentCenter; if (indexPath.section == 1) cell.textLabel.text = @"Show map and come back"; @@ -131,14 +120,13 @@ if (indexPath.section == 0) { - City const * city = &CAPITALS[_cityIndex]; switch (indexPath.row) { - case 0: cell.detailTextLabel.text = [NSString stringWithFormat:@"%lf", city->lat]; break; - case 1: cell.detailTextLabel.text = [NSString stringWithFormat:@"%lf", city->lon]; break; - case 2: cell.detailTextLabel.text = city->countryCode; break; - case 3: cell.detailTextLabel.text = [NSString stringWithFormat:@"%d", city->population]; break; - case 4: cell.detailTextLabel.text = city->timeZone; break; + case 0: cell.detailTextLabel.text = [self.city[@"lat"] stringValue]; break; + case 1: cell.detailTextLabel.text = [self.city[@"lon"] stringValue]; break; + case 2: cell.detailTextLabel.text = self.city[@"countryCode"]; break; + case 3: cell.detailTextLabel.text = [self.city[@"population"] stringValue]; break; + case 4: cell.detailTextLabel.text = self.city[@"timeZone"]; break; default: break; } } diff --git a/capitals-example/Capitals/MasterViewController.m b/capitals-example/Capitals/MasterViewController.m index 3bfff52..d8e8bc5 100644 --- a/capitals-example/Capitals/MasterViewController.m +++ b/capitals-example/Capitals/MasterViewController.m @@ -28,29 +28,48 @@ #import "MasterViewController.h" #import "CityDetailViewController.h" -#import "City.h" #import "MapsWithMeAPI.h" +@interface MasterViewController () + +@property (strong, nonatomic) NSArray * capitals; + +@end + @implementation MasterViewController +- (CityDetailViewController *)detailViewController +{ + if (!_detailViewController) + _detailViewController = [[CityDetailViewController alloc] initWithNibName:@"CityDetailViewController" bundle:nil]; + return _detailViewController; +} + +- (NSArray *)capitals +{ + if (!_capitals) + { + NSString * path = [[NSBundle mainBundle] pathForResource:@"capitals" ofType:@"plist"]; + _capitals = [NSArray arrayWithContentsOfFile:path]; + } + return _capitals; +} + - (void)showAllCitiesOnTheMap:(id)sender { - size_t const capitalsCount = sizeof(CAPITALS)/sizeof(CAPITALS[0]); + NSMutableArray * array = [[NSMutableArray alloc] initWithCapacity:[self.capitals count]]; - NSMutableArray * array = [[NSMutableArray alloc] initWithCapacity:capitalsCount]; - - for (size_t i = 0; i < capitalsCount; ++i) + for (NSInteger i = 0; i < [self.capitals count]; ++i) { - NSString * pinId = [[[NSString alloc] initWithFormat:@"%ld", i] autorelease]; + NSString * pinId = [[NSString alloc] initWithFormat:@"%i", i]; // Note that url is empty - it means "More details" button for a pin in MapsWithMe will lead back to this example app - MWMPin * pin = [[[MWMPin alloc] initWithLat:CAPITALS[i].lat lon:CAPITALS[i].lon title:CAPITALS[i].name andId:pinId] autorelease]; + NSDictionary * city = self.capitals[i]; + MWMPin * pin = [[MWMPin alloc] initWithLat:[city[@"lat"] doubleValue] lon:[city[@"lon"] doubleValue] title:city[@"name"] andId:pinId]; [array addObject:pin]; } [MWMApi showPins:array]; - - [array release]; } - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil @@ -59,7 +78,7 @@ if (self) { self.title = NSLocalizedString(@"World Capitals", nil); - if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) + if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) { self.clearsSelectionOnViewWillAppear = NO; self.contentSizeForViewInPopover = CGSizeMake(320.0, 600.0); @@ -68,17 +87,11 @@ return self; } -- (void)dealloc -{ - self.detailViewController = nil; - [super dealloc]; -} - - (void)viewDidLoad { [super viewDidLoad]; - UIBarButtonItem * showMapButton = [[[UIBarButtonItem alloc] initWithTitle:@"Show All" style:UIBarButtonItemStyleDone target:self action:@selector(showAllCitiesOnTheMap:)] autorelease]; + UIBarButtonItem * showMapButton = [[UIBarButtonItem alloc] initWithTitle:@"Show All" style:UIBarButtonItemStyleDone target:self action:@selector(showAllCitiesOnTheMap:)]; self.navigationItem.rightBarButtonItem = showMapButton; } @@ -91,12 +104,12 @@ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - return sizeof(CAPITALS)/sizeof(CAPITALS[0]); + return [self.capitals count]; } - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { - UILabel * label = [[[UILabel alloc] initWithFrame:CGRectMake(0, 0, 240, tableView.rowHeight)] autorelease]; + UILabel * label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 240, tableView.rowHeight)]; label.text = [MWMApi isApiSupported] ? @"MapsWithMe is installed" : @"MapsWithMe is not installed"; label.textAlignment = UITextAlignmentCenter; label.backgroundColor = [UIColor clearColor]; @@ -115,26 +128,21 @@ UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:cellId]; if (cell == nil) { - cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellId] autorelease]; - if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) + cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellId]; + if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone) cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; } - cell.textLabel.text = CAPITALS[indexPath.row].name; + cell.textLabel.text = self.capitals[indexPath.row][@"name"]; return cell; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) - self.detailViewController.cityIndex = indexPath.row; - else - { - if (!self.detailViewController) - self.detailViewController = [[[CityDetailViewController alloc] initWithNibName:@"CityDetailViewController" bundle:nil] autorelease]; - self.detailViewController.cityIndex = indexPath.row; + self.detailViewController.city = self.capitals[indexPath.row]; + self.detailViewController.cityIndex = indexPath.row; + if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone) [self.navigationController pushViewController:self.detailViewController animated:YES]; - } } @end diff --git a/capitals-example/Capitals/capitals.plist b/capitals-example/Capitals/capitals.plist new file mode 100644 index 0000000..2837fb4 --- /dev/null +++ b/capitals-example/Capitals/capitals.plist @@ -0,0 +1,3380 @@ + + + + + + countryCode + AE + lat + 24.466670000000001 + lon + 54.366669999999999 + name + Abu Dhabi + population + 603492 + timeZone + Asia/Dubai + + + countryCode + NG + lat + 9.0685300000000009 + lon + 7.4837499999999997 + name + Abuja + population + 590400 + timeZone + Africa/Lagos + + + countryCode + GH + lat + 5.5560200000000002 + lon + -0.19689999999999999 + name + Accra + population + 1963264 + timeZone + Africa/Accra + + + countryCode + PN + lat + -25.06597 + lon + -130.10149999999999 + name + Adamstown + population + 46 + timeZone + Pacific/Pitcairn + + + countryCode + ET + lat + 9.0249699999999997 + lon + 38.74689 + name + Addis Ababa + population + 2757729 + timeZone + Africa/Addis_Ababa + + + countryCode + DZ + lat + 36.752499999999998 + lon + 3.0419700000000001 + name + Algiers + population + 1977663 + timeZone + Africa/Algiers + + + countryCode + NU + lat + -19.059519999999999 + lon + -169.9187 + name + Alofi + population + 624 + timeZone + Pacific/Niue + + + countryCode + JO + lat + 31.955220000000001 + lon + 35.945030000000003 + name + Amman + population + 1275857 + timeZone + Asia/Amman + + + countryCode + NL + lat + 52.374029999999998 + lon + 4.8896899999999999 + name + Amsterdam + population + 741636 + timeZone + Europe/Amsterdam + + + countryCode + AD + lat + 42.50779 + lon + 1.5210900000000001 + name + Andorra la Vella + population + 20430 + timeZone + Europe/Andorra + + + countryCode + TR + lat + 39.919870000000003 + lon + 32.85427 + name + Ankara + population + 3517182 + timeZone + Europe/Istanbul + + + countryCode + MG + lat + -18.913679999999999 + lon + 47.53613 + name + Antananarivo + population + 1391433 + timeZone + Indian/Antananarivo + + + countryCode + WS + lat + -13.83333 + lon + -171.76669999999999 + name + Apia + population + 40407 + timeZone + Pacific/Apia + + + countryCode + TM + lat + 37.950000000000003 + lon + 58.383330000000001 + name + Ashgabat + population + 727700 + timeZone + Asia/Ashgabat + + + countryCode + ER + lat + 15.338050000000001 + lon + 38.931840000000001 + name + Asmara + population + 563930 + timeZone + Africa/Asmara + + + countryCode + KZ + lat + 51.180100000000003 + lon + 71.445980000000006 + name + Astana + population + 345604 + timeZone + Asia/Almaty + + + countryCode + PY + lat + -25.300660000000001 + lon + -57.635910000000003 + name + Asunción + population + 1482200 + timeZone + America/Asuncion + + + countryCode + GR + lat + 37.97945 + lon + 23.71622 + name + Athens + population + 729137 + timeZone + Europe/Athens + + + countryCode + CK + lat + -21.20778 + lon + -159.77500000000001 + name + Avarua + population + 13373 + timeZone + Pacific/Rarotonga + + + countryCode + IQ + lat + 33.340580000000003 + lon + 44.400880000000001 + name + Baghdad + population + 5672513 + timeZone + Asia/Baghdad + + + countryCode + AZ + lat + 40.377670000000002 + lon + 49.892009999999999 + name + Baku + population + 1116513 + timeZone + Asia/Baku + + + countryCode + ML + lat + 12.65 + lon + -8 + name + Bamako + population + 1297281 + timeZone + Africa/Bamako + + + countryCode + BN + lat + 4.9402900000000001 + lon + 114.9481 + name + Bandar Seri Begawan + population + 64409 + timeZone + Asia/Brunei + + + countryCode + TH + lat + 13.75398 + lon + 100.5014 + name + Bangkok + population + 5104476 + timeZone + Asia/Bangkok + + + countryCode + CF + lat + 4.3612200000000003 + lon + 18.554960000000001 + name + Bangui + population + 542393 + timeZone + Africa/Bangui + + + countryCode + GM + lat + 13.45274 + lon + -16.578029999999998 + name + Banjul + population + 34589 + timeZone + Africa/Banjul + + + countryCode + GP + lat + 15.99854 + lon + -61.725479999999997 + name + Basse-Terre + population + 11472 + timeZone + America/Guadeloupe + + + countryCode + KN + lat + 17.294840000000001 + lon + -62.726100000000002 + name + Basseterre + population + 12920 + timeZone + America/St_Kitts + + + countryCode + CN + lat + 39.907499999999999 + lon + 116.3972 + name + Beijing + population + 7480601 + timeZone + Asia/Shanghai + + + countryCode + LB + lat + 33.888939999999998 + lon + 35.494419999999998 + name + Beirut + population + 1916100 + timeZone + Asia/Beirut + + + countryCode + RS + lat + 44.804009999999998 + lon + 20.465129999999998 + name + Belgrade + population + 1273651 + timeZone + Europe/Belgrade + + + countryCode + BZ + lat + 17.25 + lon + -88.766670000000005 + name + Belmopan + population + 13381 + timeZone + America/Belize + + + countryCode + DE + lat + 52.524369999999998 + lon + 13.41053 + name + Berlin + population + 3426354 + timeZone + Europe/Berlin + + + countryCode + CH + lat + 46.948090000000001 + lon + 7.4474400000000003 + name + Bern + population + 121631 + timeZone + Europe/Zurich + + + countryCode + KG + lat + 42.869999999999997 + lon + 74.590000000000003 + name + Bishkek + population + 900000 + timeZone + Asia/Bishkek + + + countryCode + GW + lat + 11.863569999999999 + lon + -15.597670000000001 + name + Bissau + population + 388028 + timeZone + Africa/Bissau + + + countryCode + CO + lat + 4.6097099999999998 + lon + -74.08175 + name + Bogotá + population + 7102602 + timeZone + America/Bogota + + + countryCode + BR + lat + -15.779719999999999 + lon + -47.929720000000003 + name + Brasília + population + 2207718 + timeZone + America/Sao_Paulo + + + countryCode + SK + lat + 48.148159999999997 + lon + 17.106739999999999 + name + Bratislava + population + 423737 + timeZone + Europe/Bratislava + + + countryCode + CG + lat + -4.2661300000000004 + lon + 15.28318 + name + Brazzaville + population + 1284609 + timeZone + Africa/Brazzaville + + + countryCode + BB + lat + 13.1 + lon + -59.616669999999999 + name + Bridgetown + population + 98511 + timeZone + America/Barbados + + + countryCode + BE + lat + 50.850450000000002 + lon + 4.3487799999999996 + name + Brussels + population + 1019022 + timeZone + Europe/Brussels + + + countryCode + RO + lat + 44.432250000000003 + lon + 26.106259999999999 + name + Bucharest + population + 1877155 + timeZone + Europe/Bucharest + + + countryCode + HU + lat + 47.498010000000001 + lon + 19.039909999999999 + name + Budapest + population + 1696128 + timeZone + Europe/Budapest + + + countryCode + AR + lat + -34.613149999999997 + lon + -58.377229999999997 + name + Buenos Aires + population + 13076300 + timeZone + America/Argentina/Buenos_Aires + + + countryCode + BI + lat + -3.3822000000000001 + lon + 29.3644 + name + Bujumbura + population + 331700 + timeZone + Africa/Bujumbura + + + countryCode + EG + lat + 30.062629999999999 + lon + 31.249669999999998 + name + Cairo + population + 7734614 + timeZone + Africa/Cairo + + + countryCode + AU + lat + -35.283459999999998 + lon + 149.12809999999999 + name + Canberra + population + 327700 + timeZone + Australia/Sydney + + + countryCode + VE + lat + 10.488009999999999 + lon + -66.879189999999994 + name + Caracas + population + 3000000 + timeZone + America/Caracas + + + countryCode + LC + lat + 13.995699999999999 + lon + -61.006140000000002 + name + Castries + population + 10000 + timeZone + America/St_Lucia + + + countryCode + GF + lat + 4.9333299999999998 + lon + -52.333329999999997 + name + Cayenne + population + 61550 + timeZone + America/Cayenne + + + countryCode + VI + lat + 18.341899999999999 + lon + -64.930700000000002 + name + Charlotte Amalie + population + 20000 + timeZone + America/St_Thomas + + + countryCode + MD + lat + 47.005560000000003 + lon + 28.857500000000002 + name + Chişinău + population + 635994 + timeZone + Europe/Chisinau + + + countryCode + TC + lat + 21.461220000000001 + lon + -71.14188 + name + Cockburn Town + population + 3720 + timeZone + America/Grand_Turk + + + countryCode + LK + lat + 6.93194 + lon + 79.84778 + name + Colombo + population + 648034 + timeZone + Asia/Colombo + + + countryCode + GN + lat + 9.5379500000000004 + lon + -13.677289999999999 + name + Conakry + population + 1767200 + timeZone + Africa/Conakry + + + countryCode + DK + lat + 55.675939999999997 + lon + 12.565530000000001 + name + Copenhagen + population + 1153615 + timeZone + Europe/Copenhagen + + + countryCode + SN + lat + 14.6937 + lon + -17.44406 + name + Dakar + population + 2476400 + timeZone + Africa/Dakar + + + countryCode + SY + lat + 33.510199999999998 + lon + 36.29128 + name + Damascus + population + 1569394 + timeZone + Asia/Damascus + + + countryCode + BD + lat + 23.7104 + lon + 90.407439999999994 + name + Dhaka + population + 10356500 + timeZone + Asia/Dhaka + + + countryCode + TL + lat + -8.5586099999999998 + lon + 125.5736 + name + Dili + population + 150000 + timeZone + Asia/Dili + + + countryCode + DJ + lat + 11.58901 + lon + 43.145029999999998 + name + Djibouti + population + 623891 + timeZone + Africa/Djibouti + + + countryCode + TZ + lat + -6.1722099999999998 + lon + 35.739469999999997 + name + Dodoma + population + 180541 + timeZone + Africa/Dar_es_Salaam + + + countryCode + QA + lat + 25.279319999999998 + lon + 51.522449999999999 + name + Doha + population + 344939 + timeZone + Asia/Qatar + + + countryCode + IM + lat + 54.149999999999999 + lon + -4.4833299999999996 + name + Douglas + population + 26218 + timeZone + Europe/Isle_of_Man + + + countryCode + IE + lat + 53.333060000000003 + lon + -6.2488900000000003 + name + Dublin + population + 1024027 + timeZone + Europe/Dublin + + + countryCode + TJ + lat + 38.53575 + lon + 68.779049999999998 + name + Dushanbe + population + 543107 + timeZone + Asia/Dushanbe + + + countryCode + CX + lat + -10.421720000000001 + lon + 105.67910000000001 + name + Flying Fish Cove + population + 500 + timeZone + Indian/Christmas + + + countryCode + MQ + lat + 14.608919999999999 + lon + -61.073340000000002 + name + Fort-de-France + population + 89995 + timeZone + America/Martinique + + + countryCode + SL + lat + 8.484 + lon + -13.229939999999999 + name + Freetown + population + 802639 + timeZone + Africa/Freetown + + + countryCode + TV + lat + -8.5242500000000003 + lon + 179.1942 + name + Funafuti + population + 4492 + timeZone + Pacific/Funafuti + + + countryCode + BW + lat + -24.654509999999998 + lon + 25.90859 + name + Gaborone + population + 208411 + timeZone + Africa/Gaborone + + + countryCode + KY + lat + 19.286919999999999 + lon + -81.367059999999995 + name + George Town + population + 29370 + timeZone + America/Cayman + + + countryCode + GY + lat + 6.8044799999999999 + lon + -58.155270000000002 + name + Georgetown + population + 235017 + timeZone + America/Guyana + + + countryCode + GI + lat + 36.144739999999999 + lon + -5.3525700000000001 + name + Gibraltar + population + 26544 + timeZone + Europe/Gibraltar + + + countryCode + GS + lat + -54.281109999999998 + lon + -36.5092 + name + Grytviken + population + 2 + timeZone + Atlantic/South_Georgia + + + countryCode + GT + lat + 14.64072 + lon + -90.513270000000006 + name + Guatemala City + population + 994938 + timeZone + America/Guatemala + + + countryCode + BL + lat + 17.896180000000001 + lon + -62.849780000000003 + name + Gustavia + population + 5988 + timeZone + America/St_Barthelemy + + + countryCode + GU + lat + 13.475669999999999 + lon + 144.74889999999999 + name + Hagåtña + population + 1051 + timeZone + Pacific/Guam + + + countryCode + BM + lat + 32.291490000000003 + lon + -64.777969999999996 + name + Hamilton + population + 902 + timeZone + Atlantic/Bermuda + + + countryCode + ZW + lat + -17.827719999999999 + lon + 31.053370000000001 + name + Harare + population + 1542813 + timeZone + Africa/Harare + + + countryCode + CU + lat + 23.133019999999998 + lon + -82.383039999999994 + name + Havana + population + 2163824 + timeZone + America/Havana + + + countryCode + FI + lat + 60.169519999999999 + lon + 24.935449999999999 + name + Helsinki + population + 558457 + timeZone + Europe/Helsinki + + + countryCode + HK + lat + 22.285520000000002 + lon + 114.15770000000001 + name + Hong Kong + population + 7012738 + timeZone + Asia/Hong_Kong + + + countryCode + SB + lat + -9.4333299999999998 + lon + 159.94999999999999 + name + Honiara + population + 56298 + timeZone + Pacific/Guadalcanal + + + countryCode + VN + lat + 21.0245 + lon + 105.8412 + name + Hà Nội + population + 1431270 + timeZone + Asia/Ho_Chi_Minh + + + countryCode + PK + lat + 33.72148 + lon + 73.043289999999999 + name + Islamabad + population + 601600 + timeZone + Asia/Karachi + + + countryCode + ID + lat + -6.21462 + lon + 106.8451 + name + Jakarta + population + 8540121 + timeZone + Asia/Jakarta + + + countryCode + SH + lat + -15.93872 + lon + -5.7167500000000002 + name + Jamestown + population + 637 + timeZone + Atlantic/St_Helena + + + countryCode + SS + lat + 4.8516500000000002 + lon + 31.582470000000001 + name + Juba + population + 300000 + timeZone + Africa/Juba + + + countryCode + AF + lat + 34.528129999999997 + lon + 69.172330000000002 + name + Kabul + population + 3043532 + timeZone + Asia/Kabul + + + countryCode + UG + lat + 0.31628000000000001 + lon + 32.582189999999997 + name + Kampala + population + 1353189 + timeZone + Africa/Kampala + + + countryCode + NP + lat + 27.701689999999999 + lon + 85.320599999999999 + name + Kathmandu + population + 1442271 + timeZone + Asia/Kathmandu + + + countryCode + SD + lat + 15.551769999999999 + lon + 32.532409999999999 + name + Khartoum + population + 1974647 + timeZone + Africa/Khartoum + + + countryCode + UA + lat + 50.454659999999997 + lon + 30.523800000000001 + name + Kiev + population + 2514227 + timeZone + Europe/Kiev + + + countryCode + RW + lat + -1.9499500000000001 + lon + 30.05885 + name + Kigali + population + 745261 + timeZone + Africa/Kigali + + + countryCode + NF + lat + -29.054590000000001 + lon + 167.96629999999999 + name + Kingston + population + 880 + timeZone + Pacific/Norfolk + + + countryCode + JM + lat + 17.997019999999999 + lon + -76.793580000000006 + name + Kingston + population + 937700 + timeZone + America/Jamaica + + + countryCode + VC + lat + 13.158720000000001 + lon + -61.22475 + name + Kingstown + population + 24518 + timeZone + America/St_Vincent + + + countryCode + CD + lat + -4.3214199999999998 + lon + 15.308070000000001 + name + Kinshasa + population + 7785965 + timeZone + Africa/Kinshasa + + + countryCode + BQ + lat + 12.15 + lon + -68.266670000000005 + name + Kralendijk + population + 3081 + timeZone + America/Kralendijk + + + countryCode + MY + lat + 3.1412 + lon + 101.6865 + name + Kuala Lumpur + population + 1453975 + timeZone + Asia/Kuala_Lumpur + + + countryCode + KW + lat + 29.369720000000001 + lon + 47.97833 + name + Kuwait City + population + 60064 + timeZone + Asia/Kuwait + + + countryCode + EH + lat + 27.162240000000001 + lon + -13.203150000000001 + name + El Aaiún + population + 188084 + timeZone + Africa/El_Aaiun + + + countryCode + GA + lat + 0.39240999999999998 + lon + 9.4535599999999995 + name + Libreville + population + 578156 + timeZone + Africa/Libreville + + + countryCode + MW + lat + -13.96692 + lon + 33.78725 + name + Lilongwe + population + 646750 + timeZone + Africa/Blantyre + + + countryCode + PE + lat + -12.04318 + lon + -77.028239999999997 + name + Lima + population + 7737002 + timeZone + America/Lima + + + countryCode + PT + lat + 38.716670000000001 + lon + -9.1333300000000008 + name + Lisbon + population + 517802 + timeZone + Europe/Lisbon + + + countryCode + SI + lat + 46.051079999999999 + lon + 14.505129999999999 + name + Ljubljana + population + 255115 + timeZone + Europe/Ljubljana + + + countryCode + TG + lat + 6.13748 + lon + 1.21227 + name + Lomé + population + 749700 + timeZone + Africa/Lome + + + countryCode + GB + lat + 51.50853 + lon + -0.12573999999999999 + name + London + population + 7556900 + timeZone + Europe/London + + + countryCode + SJ + lat + 78.218599999999995 + lon + 15.64007 + name + Longyearbyen + population + 2060 + timeZone + Arctic/Longyearbyen + + + countryCode + AO + lat + -8.8368199999999995 + lon + 13.23432 + name + Luanda + population + 2776168 + timeZone + Africa/Luanda + + + countryCode + ZM + lat + -15.406689999999999 + lon + 28.287130000000001 + name + Lusaka + population + 1267440 + timeZone + Africa/Lusaka + + + countryCode + LU + lat + 49.611669999999997 + lon + 6.1299999999999999 + name + Luxembourg + population + 76684 + timeZone + Europe/Luxembourg + + + countryCode + MO + lat + 22.200559999999999 + lon + 113.5461 + name + Macau + population + 520400 + timeZone + Asia/Macau + + + countryCode + ES + lat + 40.416499999999999 + lon + -3.7025600000000001 + name + Madrid + population + 3255944 + timeZone + Europe/Madrid + + + countryCode + MH + lat + 7.0897100000000002 + lon + 171.38030000000001 + name + Majuro + population + 25400 + timeZone + Pacific/Majuro + + + countryCode + GQ + lat + 3.75 + lon + 8.7833299999999994 + name + Malabo + population + 155963 + timeZone + Africa/Malabo + + + countryCode + MV + lat + 4.1748000000000003 + lon + 73.508880000000005 + name + Male + population + 103693 + timeZone + Indian/Maldives + + + countryCode + YT + lat + -12.779439999999999 + lon + 45.227220000000003 + name + Mamoudzou + population + 54831 + timeZone + Indian/Mayotte + + + countryCode + NI + lat + 12.132820000000001 + lon + -86.250399999999999 + name + Managua + population + 973087 + timeZone + America/Managua + + + countryCode + BH + lat + 26.21536 + lon + 50.583199999999998 + name + Manama + population + 147074 + timeZone + Asia/Bahrain + + + countryCode + PH + lat + 14.604200000000001 + lon + 120.98220000000001 + name + Manila + population + 10444527 + timeZone + Asia/Manila + + + countryCode + MZ + lat + -25.965530000000001 + lon + 32.583219999999997 + name + Maputo + population + 1191613 + timeZone + Africa/Maputo + + + countryCode + AX + lat + 60.097259999999999 + lon + 19.934809999999999 + name + Mariehamn + population + 10682 + timeZone + Europe/Mariehamn + + + countryCode + MF + lat + 18.066669999999998 + lon + -63.083329999999997 + name + Marigot + population + 5700 + timeZone + America/Marigot + + + countryCode + LS + lat + -29.316669999999998 + lon + 27.483329999999999 + name + Maseru + population + 118355 + timeZone + Africa/Maseru + + + countryCode + WF + lat + -13.28163 + lon + -176.17449999999999 + name + Mata-Utu + population + 1200 + timeZone + Pacific/Wallis + + + countryCode + SZ + lat + -26.316669999999998 + lon + 31.133330000000001 + name + Mbabane + population + 76218 + timeZone + Africa/Mbabane + + + countryCode + PW + lat + 7.5004299999999997 + lon + 134.62350000000001 + name + Melekeok + population + 0 + timeZone + Pacific/Palau + + + countryCode + MX + lat + 19.428470000000001 + lon + -99.127660000000006 + name + Mexico City + population + 12294193 + timeZone + America/Mexico_City + + + countryCode + BY + lat + 53.899999999999999 + lon + 27.566669999999998 + name + Minsk + population + 1742124 + timeZone + Europe/Minsk + + + countryCode + SO + lat + 2.0371100000000002 + lon + 45.34375 + name + Mogadishu + population + 2587183 + timeZone + Africa/Mogadishu + + + countryCode + MC + lat + 43.733330000000002 + lon + 7.4166699999999999 + name + Monaco + population + 32965 + timeZone + Europe/Monaco + + + countryCode + LR + lat + 6.3005399999999998 + lon + -10.796900000000001 + name + Monrovia + population + 939524 + timeZone + Africa/Monrovia + + + countryCode + UY + lat + -34.833460000000002 + lon + -56.167349999999999 + name + Montevideo + population + 1270737 + timeZone + America/Montevideo + + + countryCode + KM + lat + -11.702159999999999 + lon + 43.25506 + name + Moroni + population + 42872 + timeZone + Indian/Comoro + + + countryCode + RU + lat + 55.752220000000001 + lon + 37.615560000000002 + name + Moscow + population + 10381222 + timeZone + Europe/Moscow + + + countryCode + OM + lat + 23.613869999999999 + lon + 58.592199999999998 + name + Muscat + population + 797000 + timeZone + Asia/Muscat + + + countryCode + TD + lat + 12.106719999999999 + lon + 15.0444 + name + N'Djamena + population + 721081 + timeZone + Africa/Ndjamena + + + countryCode + KE + lat + -1.2833300000000001 + lon + 36.816670000000002 + name + Nairobi + population + 2750547 + timeZone + Africa/Nairobi + + + countryCode + BS + lat + 25.058229999999998 + lon + -77.343059999999994 + name + Nassau + population + 227940 + timeZone + America/Nassau + + + countryCode + MM + lat + 19.745000000000001 + lon + 96.129720000000006 + name + Nay Pyi Taw + population + 925000 + timeZone + Asia/Rangoon + + + countryCode + IN + lat + 28.635760000000001 + lon + 77.224450000000004 + name + New Delhi + population + 317797 + timeZone + Asia/Kolkata + + + countryCode + NE + lat + 13.51366 + lon + 2.1097999999999999 + name + Niamey + population + 774235 + timeZone + Africa/Niamey + + + countryCode + CY + lat + 35.166670000000003 + lon + 33.366669999999999 + name + Nicosia + population + 200452 + timeZone + Asia/Nicosia + + + countryCode + MR + lat + 18.085809999999999 + lon + -15.9785 + name + Nouakchott + population + 661400 + timeZone + Africa/Nouakchott + + + countryCode + NC + lat + -22.276309999999999 + lon + 166.4572 + name + Nouméa + population + 93060 + timeZone + Pacific/Noumea + + + countryCode + TO + lat + -21.139379999999999 + lon + -175.20179999999999 + name + Nuku‘alofa + population + 22400 + timeZone + Pacific/Tongatapu + + + countryCode + GL + lat + 64.18347 + lon + -51.72157 + name + Nuuk + population + 14798 + timeZone + America/Godthab + + + countryCode + AW + lat + 12.52398 + lon + -70.027029999999996 + name + Oranjestad + population + 29998 + timeZone + America/Aruba + + + countryCode + NO + lat + 59.912730000000003 + lon + 10.746090000000001 + name + Oslo + population + 580000 + timeZone + Europe/Oslo + + + countryCode + CA + lat + 45.411169999999998 + lon + -75.698120000000003 + name + Ottawa + population + 812129 + timeZone + America/Toronto + + + countryCode + BF + lat + 12.36566 + lon + -1.5338799999999999 + name + Ouagadougou + population + 1086505 + timeZone + Africa/Ouagadougou + + + countryCode + AS + lat + -14.27806 + lon + -170.70249999999999 + name + Pago Pago + population + 11500 + timeZone + Pacific/Pago_Pago + + + countryCode + FM + lat + 6.9247699999999996 + lon + 158.1611 + name + Palikir - National Government Center + population + 0 + timeZone + Pacific/Pohnpei + + + countryCode + PA + lat + 8.9936000000000007 + lon + -79.519729999999996 + name + Panamá + population + 408168 + timeZone + America/Panama + + + countryCode + PF + lat + -17.533329999999999 + lon + -149.5667 + name + Papeete + population + 26357 + timeZone + Pacific/Tahiti + + + countryCode + SR + lat + 5.8663800000000004 + lon + -55.166820000000001 + name + Paramaribo + population + 223757 + timeZone + America/Paramaribo + + + countryCode + FR + lat + 48.853409999999997 + lon + 2.3488000000000002 + name + Paris + population + 2138551 + timeZone + Europe/Paris + + + countryCode + SX + lat + 18.026 + lon + -63.045819999999999 + name + Philipsburg + population + 1400 + timeZone + America/Lower_Princes + + + countryCode + KH + lat + 11.56245 + lon + 104.916 + name + Phnom Penh + population + 1573544 + timeZone + Asia/Phnom_Penh + + + countryCode + MS + lat + 16.705549999999999 + lon + -62.212919999999997 + name + Plymouth + population + 0 + timeZone + America/Montserrat + + + countryCode + ME + lat + 42.441110000000002 + lon + 19.26361 + name + Podgorica + population + 136473 + timeZone + Europe/Podgorica + + + countryCode + MU + lat + -20.161940000000001 + lon + 57.498890000000003 + name + Port Louis + population + 155226 + timeZone + Indian/Mauritius + + + countryCode + PG + lat + -9.4431399999999996 + lon + 147.1797 + name + Port Moresby + population + 283733 + timeZone + Pacific/Port_Moresby + + + countryCode + VU + lat + -17.733809999999998 + lon + 168.3219 + name + Port-Vila + population + 35901 + timeZone + Pacific/Efate + + + countryCode + HT + lat + 18.539169999999999 + lon + -72.334999999999994 + name + Port-au-Prince + population + 1234742 + timeZone + America/Port-au-Prince + + + countryCode + TF + lat + -49.350000000000001 + lon + 70.216669999999993 + name + Port-aux-Français + population + 45 + timeZone + Indian/Kerguelen + + + countryCode + TT + lat + 10.666169999999999 + lon + -61.516570000000002 + name + Port-of-Spain + population + 49031 + timeZone + America/Port_of_Spain + + + countryCode + BJ + lat + 6.4964599999999999 + lon + 2.6035900000000001 + name + Porto-Novo + population + 234168 + timeZone + Africa/Porto-Novo + + + countryCode + CZ + lat + 50.088039999999999 + lon + 14.42076 + name + Prague + population + 1165581 + timeZone + Europe/Prague + + + countryCode + CV + lat + 14.931520000000001 + lon + -23.512540000000001 + name + Praia + population + 113364 + timeZone + Atlantic/Cape_Verde + + + countryCode + ZA + lat + -25.744859999999999 + lon + 28.187830000000002 + name + Pretoria + population + 1619438 + timeZone + Africa/Johannesburg + + + countryCode + XK + lat + 42.672719999999998 + lon + 21.166879999999999 + name + Pristina + population + 550000 + timeZone + Europe/Belgrade + + + countryCode + KP + lat + 39.033850000000001 + lon + 125.7543 + name + Pyongyang + population + 3222000 + timeZone + Asia/Pyongyang + + + countryCode + EC + lat + -0.22985 + lon + -78.524950000000004 + name + Quito + population + 1399814 + timeZone + America/Guayaquil + + + countryCode + MA + lat + 34.013249999999999 + lon + -6.8325500000000003 + name + Rabat + population + 1655753 + timeZone + Africa/Casablanca + + + countryCode + IS + lat + 64.135480000000001 + lon + -21.895409999999998 + name + Reykjavík + population + 113906 + timeZone + Atlantic/Reykjavik + + + countryCode + LV + lat + 56.945999999999998 + lon + 24.105889999999999 + name + Riga + population + 742572 + timeZone + Europe/Riga + + + countryCode + SA + lat + 24.687729999999998 + lon + 46.721850000000003 + name + Riyadh + population + 4205961 + timeZone + Asia/Riyadh + + + countryCode + VG + lat + 18.41667 + lon + -64.616669999999999 + name + Road Town + population + 8449 + timeZone + America/Tortola + + + countryCode + IT + lat + 41.894739999999999 + lon + 12.4839 + name + Rome + population + 2563241 + timeZone + Europe/Rome + + + countryCode + DM + lat + 15.301740000000001 + lon + -61.388080000000002 + name + Roseau + population + 16571 + timeZone + America/Dominica + + + countryCode + GD + lat + 12.05644 + lon + -61.748489999999997 + name + Saint George's + population + 7500 + timeZone + America/Grenada + + + countryCode + JE + lat + 49.188040000000001 + lon + -2.1049099999999998 + name + Saint Helier + population + 28000 + timeZone + Europe/Jersey + + + countryCode + AG + lat + 17.116669999999999 + lon + -61.850000000000001 + name + Saint John’s + population + 24226 + timeZone + America/Antigua + + + countryCode + GG + lat + 49.459809999999997 + lon + -2.5352700000000001 + name + Saint Peter Port + population + 16488 + timeZone + Europe/Guernsey + + + countryCode + RE + lat + -20.88231 + lon + 55.450400000000002 + name + Saint-Denis + population + 137195 + timeZone + Indian/Reunion + + + countryCode + PM + lat + 46.780909999999999 + lon + -56.171959999999999 + name + Saint-Pierre + population + 6200 + timeZone + America/Miquelon + + + countryCode + MP + lat + 15.21233 + lon + 145.75450000000001 + name + Saipan + population + 48220 + timeZone + Pacific/Saipan + + + countryCode + CR + lat + 9.9333299999999998 + lon + -84.083330000000004 + name + San José + population + 335007 + timeZone + America/Costa_Rica + + + countryCode + PR + lat + 18.466329999999999 + lon + -66.105720000000005 + name + San Juan + population + 418140 + timeZone + America/Puerto_Rico + + + countryCode + SM + lat + 43.936669999999999 + lon + 12.446389999999999 + name + San Marino + population + 4500 + timeZone + Europe/San_Marino + + + countryCode + SV + lat + 13.689349999999999 + lon + -89.187179999999998 + name + San Salvador + population + 525990 + timeZone + America/El_Salvador + + + countryCode + YE + lat + 15.35472 + lon + 44.206670000000003 + name + Sanaa + population + 1937451 + timeZone + Asia/Aden + + + countryCode + CL + lat + -33.456940000000003 + lon + -70.648269999999997 + name + Santiago + population + 4837295 + timeZone + America/Santiago + + + countryCode + DO + lat + 18.500119999999999 + lon + -69.988569999999996 + name + Santo Domingo + population + 2201941 + timeZone + America/Santo_Domingo + + + countryCode + BA + lat + 43.848640000000003 + lon + 18.356439999999999 + name + Sarajevo + population + 696731 + timeZone + Europe/Sarajevo + + + countryCode + KR + lat + 37.568260000000002 + lon + 126.9778 + name + Seoul + population + 10349312 + timeZone + Asia/Seoul + + + countryCode + SG + lat + 1.2896700000000001 + lon + 103.8501 + name + Singapore + population + 3547809 + timeZone + Asia/Singapore + + + countryCode + MK + lat + 42.001220000000004 + lon + 21.42878 + name + Skopje + population + 474889 + timeZone + Europe/Skopje + + + countryCode + BG + lat + 42.697510000000001 + lon + 23.324149999999999 + name + Sofia + population + 1152556 + timeZone + Europe/Sofia + + + countryCode + FK + lat + -51.700000000000003 + lon + -57.850000000000001 + name + Stanley + population + 2213 + timeZone + Atlantic/Stanley + + + countryCode + SE + lat + 59.33258 + lon + 18.064900000000002 + name + Stockholm + population + 1253309 + timeZone + Europe/Stockholm + + + countryCode + BO + lat + -19.03332 + lon + -65.262739999999994 + name + Sucre + population + 224838 + timeZone + America/La_Paz + + + countryCode + FJ + lat + -18.14161 + lon + 178.44149999999999 + name + Suva + population + 77366 + timeZone + Pacific/Fiji + + + countryCode + ST + lat + 0.33654000000000001 + lon + 6.7273199999999997 + name + São Tomé + population + 53300 + timeZone + Africa/Sao_Tome + + + countryCode + TW + lat + 25.04776 + lon + 121.53189999999999 + name + Taipei + population + 7871900 + timeZone + Asia/Taipei + + + countryCode + EE + lat + 59.436959999999999 + lon + 24.753530000000001 + name + Tallinn + population + 394024 + timeZone + Europe/Tallinn + + + countryCode + KI + lat + 1.3278000000000001 + lon + 172.977 + name + Tarawa + population + 40311 + timeZone + Pacific/Tarawa + + + countryCode + UZ + lat + 41.264650000000003 + lon + 69.216269999999994 + name + Tashkent + population + 1978028 + timeZone + Asia/Tashkent + + + countryCode + GE + lat + 41.694110000000002 + lon + 44.833680000000001 + name + Tbilisi + population + 1049498 + timeZone + Asia/Tbilisi + + + countryCode + HN + lat + 14.081799999999999 + lon + -87.206810000000004 + name + Tegucigalpa + population + 850848 + timeZone + America/Tegucigalpa + + + countryCode + IR + lat + 35.694389999999999 + lon + 51.421509999999998 + name + Tehrān + population + 7153309 + timeZone + Asia/Tehran + + + countryCode + AI + lat + 18.217040000000001 + lon + -63.057830000000003 + name + The Valley + population + 2035 + timeZone + America/Anguilla + + + countryCode + BT + lat + 27.466090000000001 + lon + 89.641909999999996 + name + Thimphu + population + 98676 + timeZone + Asia/Thimphu + + + countryCode + AL + lat + 41.327500000000001 + lon + 19.81889 + name + Tirana + population + 374801 + timeZone + Europe/Tirane + + + countryCode + JP + lat + 35.689500000000002 + lon + 139.6917 + name + Tokyo + population + 8336599 + timeZone + Asia/Tokyo + + + countryCode + LY + lat + 32.875190000000003 + lon + 13.18746 + name + Tripoli + population + 1150989 + timeZone + Africa/Tripoli + + + countryCode + TN + lat + 36.81897 + lon + 10.165789999999999 + name + Tunis + population + 693210 + timeZone + Africa/Tunis + + + countryCode + FO + lat + 62.009729999999998 + lon + -6.7716399999999997 + name + Tórshavn + population + 13200 + timeZone + Atlantic/Faroe + + + countryCode + MN + lat + 47.907710000000002 + lon + 106.8832 + name + Ulaanbaatar + population + 844818 + timeZone + Asia/Ulaanbaatar + + + countryCode + LI + lat + 47.141509999999997 + lon + 9.5215399999999999 + name + Vaduz + population + 5197 + timeZone + Europe/Vaduz + + + countryCode + MT + lat + 35.899720000000002 + lon + 14.514720000000001 + name + Valletta + population + 6794 + timeZone + Europe/Malta + + + countryCode + VA + lat + 41.902360000000002 + lon + 12.45332 + name + Vatican City + population + 829 + timeZone + Europe/Vatican + + + countryCode + SC + lat + -4.6166700000000001 + lon + 55.450000000000003 + name + Victoria + population + 22881 + timeZone + Indian/Mahe + + + countryCode + AT + lat + 48.208489999999998 + lon + 16.37208 + name + Vienna + population + 1691468 + timeZone + Europe/Vienna + + + countryCode + LA + lat + 17.966670000000001 + lon + 102.59999999999999 + name + Vientiane + population + 196731 + timeZone + Asia/Vientiane + + + countryCode + LT + lat + 54.689160000000001 + lon + 25.279800000000002 + name + Vilnius + population + 542366 + timeZone + Europe/Vilnius + + + countryCode + PL + lat + 52.229770000000002 + lon + 21.011780000000002 + name + Warsaw + population + 1702139 + timeZone + Europe/Warsaw + + + countryCode + US + lat + 38.895110000000003 + lon + -77.036370000000005 + name + Washington, D. C. + population + 601723 + timeZone + America/New_York + + + countryCode + NZ + lat + -41.286639999999998 + lon + 174.7756 + name + Wellington + population + 381900 + timeZone + Pacific/Auckland + + + countryCode + CC + lat + -12.15681 + lon + 96.822509999999994 + name + West Island + population + 120 + timeZone + Indian/Cocos + + + countryCode + CW + lat + 12.1084 + lon + -68.933539999999994 + name + Willemstad + population + 125000 + timeZone + America/Curacao + + + countryCode + NA + lat + -22.55941 + lon + 17.08323 + name + Windhoek + population + 268132 + timeZone + Africa/Windhoek + + + countryCode + CI + lat + 6.8205499999999999 + lon + -5.2767400000000002 + name + Yamoussoukro + population + 194530 + timeZone + Africa/Abidjan + + + countryCode + CM + lat + 3.8666700000000001 + lon + 11.51667 + name + Yaoundé + population + 1299369 + timeZone + Africa/Douala + + + countryCode + AM + lat + 40.181109999999997 + lon + 44.51361 + name + Yerevan + population + 1093485 + timeZone + Asia/Yerevan + + + countryCode + HR + lat + 45.814439999999998 + lon + 15.977980000000001 + name + Zagreb + population + 698966 + timeZone + Europe/Zagreb + + +