liuxiulin преди 1 месец
ревизия
8bf3cbb0e1
променени са 100 файла, в които са добавени 40646 реда и са изтрити 0 реда
  1. BIN
      .DS_Store
  2. 0 0
      .gitignore
  3. 13 0
      NotificationService/Info.plist
  4. 12 0
      NotificationService/NotificationService.h
  5. 35 0
      NotificationService/NotificationService.m
  6. 30 0
      Podfile
  7. 138 0
      Podfile.lock
  8. BIN
      Pods/.DS_Store
  9. BIN
      Pods/AFNetworking/.DS_Store
  10. 49 0
      Pods/AFNetworking/AFNetworking/AFCompatibilityMacros.h
  11. 285 0
      Pods/AFNetworking/AFNetworking/AFHTTPSessionManager.h
  12. 357 0
      Pods/AFNetworking/AFNetworking/AFHTTPSessionManager.m
  13. 216 0
      Pods/AFNetworking/AFNetworking/AFNetworkReachabilityManager.h
  14. 269 0
      Pods/AFNetworking/AFNetworking/AFNetworkReachabilityManager.m
  15. 41 0
      Pods/AFNetworking/AFNetworking/AFNetworking.h
  16. 161 0
      Pods/AFNetworking/AFNetworking/AFSecurityPolicy.h
  17. 341 0
      Pods/AFNetworking/AFNetworking/AFSecurityPolicy.m
  18. 479 0
      Pods/AFNetworking/AFNetworking/AFURLRequestSerialization.h
  19. 1399 0
      Pods/AFNetworking/AFNetworking/AFURLRequestSerialization.m
  20. 313 0
      Pods/AFNetworking/AFNetworking/AFURLResponseSerialization.h
  21. 836 0
      Pods/AFNetworking/AFNetworking/AFURLResponseSerialization.m
  22. 516 0
      Pods/AFNetworking/AFNetworking/AFURLSessionManager.h
  23. 1274 0
      Pods/AFNetworking/AFNetworking/AFURLSessionManager.m
  24. 19 0
      Pods/AFNetworking/LICENSE
  25. 298 0
      Pods/AFNetworking/README.md
  26. 160 0
      Pods/AFNetworking/UIKit+AFNetworking/AFAutoPurgingImageCache.h
  27. 205 0
      Pods/AFNetworking/UIKit+AFNetworking/AFAutoPurgingImageCache.m
  28. 171 0
      Pods/AFNetworking/UIKit+AFNetworking/AFImageDownloader.h
  29. 421 0
      Pods/AFNetworking/UIKit+AFNetworking/AFImageDownloader.m
  30. 103 0
      Pods/AFNetworking/UIKit+AFNetworking/AFNetworkActivityIndicatorManager.h
  31. 239 0
      Pods/AFNetworking/UIKit+AFNetworking/AFNetworkActivityIndicatorManager.m
  32. 48 0
      Pods/AFNetworking/UIKit+AFNetworking/UIActivityIndicatorView+AFNetworking.h
  33. 114 0
      Pods/AFNetworking/UIKit+AFNetworking/UIActivityIndicatorView+AFNetworking.m
  34. 175 0
      Pods/AFNetworking/UIKit+AFNetworking/UIButton+AFNetworking.h
  35. 302 0
      Pods/AFNetworking/UIKit+AFNetworking/UIButton+AFNetworking.m
  36. 109 0
      Pods/AFNetworking/UIKit+AFNetworking/UIImageView+AFNetworking.h
  37. 159 0
      Pods/AFNetworking/UIKit+AFNetworking/UIImageView+AFNetworking.m
  38. 43 0
      Pods/AFNetworking/UIKit+AFNetworking/UIKit+AFNetworking.h
  39. 64 0
      Pods/AFNetworking/UIKit+AFNetworking/UIProgressView+AFNetworking.h
  40. 126 0
      Pods/AFNetworking/UIKit+AFNetworking/UIProgressView+AFNetworking.m
  41. 53 0
      Pods/AFNetworking/UIKit+AFNetworking/UIRefreshControl+AFNetworking.h
  42. 113 0
      Pods/AFNetworking/UIKit+AFNetworking/UIRefreshControl+AFNetworking.m
  43. 80 0
      Pods/AFNetworking/UIKit+AFNetworking/WKWebView+AFNetworking.h
  44. 154 0
      Pods/AFNetworking/UIKit+AFNetworking/WKWebView+AFNetworking.m
  45. 16 0
      Pods/BRPickerView/BRPickerView/BRPickerView.h
  46. 73 0
      Pods/BRPickerView/BRPickerView/Core/BRPickerAlertView.h
  47. 398 0
      Pods/BRPickerView/BRPickerView/Core/BRPickerAlertView.m
  48. 261 0
      Pods/BRPickerView/BRPickerView/Core/BRPickerStyle.h
  49. 508 0
      Pods/BRPickerView/BRPickerView/Core/BRPickerStyle.m
  50. 35 0
      Pods/BRPickerView/BRPickerView/Core/BRPickerView.bundle/en.lproj/Localizable.strings
  51. 35 0
      Pods/BRPickerView/BRPickerView/Core/BRPickerView.bundle/zh-Hans.lproj/Localizable.strings
  52. 35 0
      Pods/BRPickerView/BRPickerView/Core/BRPickerView.bundle/zh-Hant.lproj/Localizable.strings
  53. 87 0
      Pods/BRPickerView/BRPickerView/Core/BRPickerViewMacro.h
  54. 26 0
      Pods/BRPickerView/BRPickerView/Core/NSBundle+BRPickerView.h
  55. 63 0
      Pods/BRPickerView/BRPickerView/Core/NSBundle+BRPickerView.m
  56. 111 0
      Pods/BRPickerView/BRPickerView/DatePicker/BRDatePickerView+BR.h
  57. 792 0
      Pods/BRPickerView/BRPickerView/DatePicker/BRDatePickerView+BR.m
  58. 287 0
      Pods/BRPickerView/BRPickerView/DatePicker/BRDatePickerView.h
  59. 2078 0
      Pods/BRPickerView/BRPickerView/DatePicker/BRDatePickerView.m
  60. 121 0
      Pods/BRPickerView/BRPickerView/DatePicker/NSDate+BRPickerView.h
  61. 398 0
      Pods/BRPickerView/BRPickerView/DatePicker/NSDate+BRPickerView.m
  62. 51 0
      Pods/BRPickerView/BRPickerView/Deprecated/AddressPickerView/BRAddressModel.h
  63. 24 0
      Pods/BRPickerView/BRPickerView/Deprecated/AddressPickerView/BRAddressModel.m
  64. 15394 0
      Pods/BRPickerView/BRPickerView/Deprecated/AddressPickerView/BRAddressPickerView.bundle/BRCity.json
  65. 134 0
      Pods/BRPickerView/BRPickerView/Deprecated/AddressPickerView/BRAddressPickerView.h
  66. 640 0
      Pods/BRPickerView/BRPickerView/Deprecated/AddressPickerView/BRAddressPickerView.m
  67. 16 0
      Pods/BRPickerView/BRPickerView/Deprecated/Base/BRBaseView.h
  68. 14 0
      Pods/BRPickerView/BRPickerView/Deprecated/Base/BRBaseView.m
  69. 36 0
      Pods/BRPickerView/BRPickerView/Deprecated/StringPickerView/BRResultModel.h
  70. 41 0
      Pods/BRPickerView/BRPickerView/Deprecated/StringPickerView/BRResultModel.m
  71. 199 0
      Pods/BRPickerView/BRPickerView/Deprecated/StringPickerView/BRStringPickerView.h
  72. 695 0
      Pods/BRPickerView/BRPickerView/Deprecated/StringPickerView/BRStringPickerView.m
  73. 14 0
      Pods/BRPickerView/BRPickerView/PrivacyInfo.xcprivacy
  74. 62 0
      Pods/BRPickerView/BRPickerView/TextPicker/BRTextModel.h
  75. 174 0
      Pods/BRPickerView/BRPickerView/TextPicker/BRTextModel.m
  76. 172 0
      Pods/BRPickerView/BRPickerView/TextPicker/BRTextPickerView.h
  77. 568 0
      Pods/BRPickerView/BRPickerView/TextPicker/BRTextPickerView.m
  78. 21 0
      Pods/BRPickerView/LICENSE
  79. 913 0
      Pods/BRPickerView/README.md
  80. 85 0
      Pods/CircleProgressBar/CircleProgressBarDemo/CircleProgressBar/CircleProgressBar.h
  81. 310 0
      Pods/CircleProgressBar/CircleProgressBarDemo/CircleProgressBar/CircleProgressBar.m
  82. 22 0
      Pods/CircleProgressBar/LICENSE
  83. 115 0
      Pods/CircleProgressBar/README.md
  84. 58 0
      Pods/FDFullscreenPopGesture/FDFullscreenPopGesture/UINavigationController+FDFullscreenPopGesture.h
  85. 227 0
      Pods/FDFullscreenPopGesture/FDFullscreenPopGesture/UINavigationController+FDFullscreenPopGesture.m
  86. 22 0
      Pods/FDFullscreenPopGesture/LICENSE
  87. 62 0
      Pods/FDFullscreenPopGesture/README.md
  88. BIN
      Pods/FMDB/.DS_Store
  89. 28 0
      Pods/FMDB/LICENSE.txt
  90. 546 0
      Pods/FMDB/README.markdown
  91. 14 0
      Pods/FMDB/privacy/PrivacyInfo.xcprivacy
  92. 10 0
      Pods/FMDB/src/fmdb/FMDB.h
  93. 1494 0
      Pods/FMDB/src/fmdb/FMDatabase.h
  94. 1529 0
      Pods/FMDB/src/fmdb/FMDatabase.m
  95. 243 0
      Pods/FMDB/src/fmdb/FMDatabaseAdditions.h
  96. 245 0
      Pods/FMDB/src/fmdb/FMDatabaseAdditions.m
  97. 280 0
      Pods/FMDB/src/fmdb/FMDatabasePool.h
  98. 335 0
      Pods/FMDB/src/fmdb/FMDatabasePool.m
  99. 295 0
      Pods/FMDB/src/fmdb/FMDatabaseQueue.h
  100. 314 0
      Pods/FMDB/src/fmdb/FMDatabaseQueue.m

BIN
.DS_Store


+ 0 - 0
.gitignore


+ 13 - 0
NotificationService/Info.plist

@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>NSExtension</key>
+	<dict>
+		<key>NSExtensionPointIdentifier</key>
+		<string>com.apple.usernotifications.service</string>
+		<key>NSExtensionPrincipalClass</key>
+		<string>NotificationService</string>
+	</dict>
+</dict>
+</plist>

+ 12 - 0
NotificationService/NotificationService.h

@@ -0,0 +1,12 @@
+//
+//  NotificationService.h
+//  NotificationService
+//
+//  Created by gtjx-z on 2025/4/10.
+//
+
+#import <UserNotifications/UserNotifications.h>
+
+@interface NotificationService : UNNotificationServiceExtension
+
+@end

+ 35 - 0
NotificationService/NotificationService.m

@@ -0,0 +1,35 @@
+//
+//  NotificationService.m
+//  NotificationService
+//
+//  Created by gtjx-z on 2025/4/10.
+//
+
+#import "NotificationService.h"
+
+@interface NotificationService ()
+
+@property (nonatomic, strong) void (^contentHandler)(UNNotificationContent *contentToDeliver);
+@property (nonatomic, strong) UNMutableNotificationContent *bestAttemptContent;
+
+@end
+
+@implementation NotificationService
+
+- (void)didReceiveNotificationRequest:(UNNotificationRequest *)request withContentHandler:(void (^)(UNNotificationContent * _Nonnull))contentHandler {
+    self.contentHandler = contentHandler;
+    self.bestAttemptContent = [request.content mutableCopy];
+    
+    // Modify the notification content here...
+    self.bestAttemptContent.title = [NSString stringWithFormat:@"%@ [modified]", self.bestAttemptContent.title];
+    
+    self.contentHandler(self.bestAttemptContent);
+}
+
+- (void)serviceExtensionTimeWillExpire {
+    // Called just before the extension will be terminated by the system.
+    // Use this as an opportunity to deliver your "best attempt" at modified content, otherwise the original push payload will be used.
+    self.contentHandler(self.bestAttemptContent);
+}
+
+@end

+ 30 - 0
Podfile

@@ -0,0 +1,30 @@
+
+platform :ios, '13.0'
+use_frameworks!
+
+target 'Temperature' do
+pod 'AFNetworking'
+pod 'SDWebImage'
+pod 'SVProgressHUD'
+pod 'FMDB'
+pod 'MJRefresh'
+pod 'MJExtension'
+pod 'Masonry'
+pod 'FDFullscreenPopGesture'   #全屏侧滑返回
+pod 'MMKV'
+pod 'TYPagerController'
+pod 'YBPopupMenu'
+#pod 'WebViewJavascriptBridge', '~> 6.0'
+pod 'YYKit'
+pod 'BRPickerView'
+pod 'CircleProgressBar'
+pod 'SDCycleScrollView'
+pod 'GTSDK'
+
+end
+
+post_install do |installer|
+    installer.pods_project.build_configurations.each do |config|
+        config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
+    end
+end

+ 138 - 0
Podfile.lock

@@ -0,0 +1,138 @@
+PODS:
+  - AFNetworking (4.0.1):
+    - AFNetworking/NSURLSession (= 4.0.1)
+    - AFNetworking/Reachability (= 4.0.1)
+    - AFNetworking/Security (= 4.0.1)
+    - AFNetworking/Serialization (= 4.0.1)
+    - AFNetworking/UIKit (= 4.0.1)
+  - AFNetworking/NSURLSession (4.0.1):
+    - AFNetworking/Reachability
+    - AFNetworking/Security
+    - AFNetworking/Serialization
+  - AFNetworking/Reachability (4.0.1)
+  - AFNetworking/Security (4.0.1)
+  - AFNetworking/Serialization (4.0.1)
+  - AFNetworking/UIKit (4.0.1):
+    - AFNetworking/NSURLSession
+  - BRPickerView (2.9.5):
+    - BRPickerView/All (= 2.9.5)
+  - BRPickerView/All (2.9.5):
+    - BRPickerView/Default
+    - BRPickerView/Deprecated
+  - BRPickerView/Core (2.9.5)
+  - BRPickerView/DatePicker (2.9.5):
+    - BRPickerView/Core
+  - BRPickerView/Default (2.9.5):
+    - BRPickerView/DatePicker
+    - BRPickerView/TextPicker
+  - BRPickerView/Deprecated (2.9.5):
+    - BRPickerView/Core
+    - BRPickerView/Deprecated/AddressPickerView (= 2.9.5)
+    - BRPickerView/Deprecated/Base (= 2.9.5)
+    - BRPickerView/Deprecated/StringPickerView (= 2.9.5)
+  - BRPickerView/Deprecated/AddressPickerView (2.9.5):
+    - BRPickerView/Core
+    - BRPickerView/Deprecated/Base
+  - BRPickerView/Deprecated/Base (2.9.5):
+    - BRPickerView/Core
+  - BRPickerView/Deprecated/StringPickerView (2.9.5):
+    - BRPickerView/Core
+    - BRPickerView/Deprecated/Base
+  - BRPickerView/TextPicker (2.9.5):
+    - BRPickerView/Core
+  - CircleProgressBar (0.32)
+  - FDFullscreenPopGesture (1.1)
+  - FMDB (2.7.12):
+    - FMDB/standard (= 2.7.12)
+  - FMDB/Core (2.7.12)
+  - FMDB/standard (2.7.12):
+    - FMDB/Core
+  - GTCommonSDK (3.1.9.0):
+    - ZXSDK
+  - GTSDK (3.0.10.0):
+    - GTCommonSDK (> 3.0.9.0)
+  - Masonry (1.1.0)
+  - MJExtension (3.4.2)
+  - MJRefresh (3.7.9)
+  - MMKV (2.2.2):
+    - MMKVCore (~> 2.2.2)
+  - MMKVCore (2.2.2)
+  - SDCycleScrollView (1.82):
+    - SDWebImage (>= 5.0.0)
+  - SDWebImage (5.21.0):
+    - SDWebImage/Core (= 5.21.0)
+  - SDWebImage/Core (5.21.0)
+  - SVProgressHUD (2.3.1):
+    - SVProgressHUD/Core (= 2.3.1)
+  - SVProgressHUD/Core (2.3.1)
+  - TYPagerController (2.1.2)
+  - YBPopupMenu (1.3.1)
+  - YYKit (1.0.9):
+    - YYKit/no-arc (= 1.0.9)
+  - YYKit/no-arc (1.0.9)
+  - ZXSDK (3.3.2)
+
+DEPENDENCIES:
+  - AFNetworking
+  - BRPickerView
+  - CircleProgressBar
+  - FDFullscreenPopGesture
+  - FMDB
+  - GTSDK
+  - Masonry
+  - MJExtension
+  - MJRefresh
+  - MMKV
+  - SDCycleScrollView
+  - SDWebImage
+  - SVProgressHUD
+  - TYPagerController
+  - YBPopupMenu
+  - YYKit
+
+SPEC REPOS:
+  trunk:
+    - AFNetworking
+    - BRPickerView
+    - CircleProgressBar
+    - FDFullscreenPopGesture
+    - FMDB
+    - GTCommonSDK
+    - GTSDK
+    - Masonry
+    - MJExtension
+    - MJRefresh
+    - MMKV
+    - MMKVCore
+    - SDCycleScrollView
+    - SDWebImage
+    - SVProgressHUD
+    - TYPagerController
+    - YBPopupMenu
+    - YYKit
+    - ZXSDK
+
+SPEC CHECKSUMS:
+  AFNetworking: 3bd23d814e976cd148d7d44c3ab78017b744cd58
+  BRPickerView: 6eb731d84385cc99c3ab4fec49af3336ed26c803
+  CircleProgressBar: 3920079be5224b62b3d9ed6eeb23ac01c835b681
+  FDFullscreenPopGesture: a8a620179e3d9c40e8e00256dcee1c1a27c6d0f0
+  FMDB: 728731dd336af3936ce00f91d9d8495f5718a0e6
+  GTCommonSDK: 5f23150656349e33595ddc544e89312085234cb7
+  GTSDK: 1a2e62b50cf265046c2e48cdb88cd3d8e62bd7ea
+  Masonry: 678fab65091a9290e40e2832a55e7ab731aad201
+  MJExtension: e97d164cb411aa9795cf576093a1fa208b4a8dd8
+  MJRefresh: ff9e531227924c84ce459338414550a05d2aea78
+  MMKV: b4802ebd5a7c68fc0c4a5ccb4926fbdfb62d68e0
+  MMKVCore: a255341a3746955f50da2ad9121b18cb2b346e61
+  SDCycleScrollView: a0d74c3384caa72bdfc81470bdbc8c14b3e1fbcf
+  SDWebImage: f84b0feeb08d2d11e6a9b843cb06d75ebf5b8868
+  SVProgressHUD: 4837c74bdfe2e51e8821c397825996a8d7de6e22
+  TYPagerController: 262556ecef99986d26ed77fb1288a198ed42f4af
+  YBPopupMenu: e67e5af42cf242cee89a6dd0c38cb814a1e91c17
+  YYKit: 7cda43304a8dc3696c449041e2cb3107b4e236e7
+  ZXSDK: 786338c0a18e98e03eda00699c3bfd2700b97117
+
+PODFILE CHECKSUM: a90fc6cef13d653fd77f691cfc6ebd7090a4bc37
+
+COCOAPODS: 1.16.2

BIN
Pods/.DS_Store


BIN
Pods/AFNetworking/.DS_Store


+ 49 - 0
Pods/AFNetworking/AFNetworking/AFCompatibilityMacros.h

@@ -0,0 +1,49 @@
+// AFCompatibilityMacros.h
+// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#ifndef AFCompatibilityMacros_h
+#define AFCompatibilityMacros_h
+
+#ifdef API_AVAILABLE
+    #define AF_API_AVAILABLE(...) API_AVAILABLE(__VA_ARGS__)
+#else
+    #define AF_API_AVAILABLE(...)
+#endif // API_AVAILABLE
+
+#ifdef API_UNAVAILABLE
+    #define AF_API_UNAVAILABLE(...) API_UNAVAILABLE(__VA_ARGS__)
+#else
+    #define AF_API_UNAVAILABLE(...)
+#endif // API_UNAVAILABLE
+
+#if __has_warning("-Wunguarded-availability-new")
+    #define AF_CAN_USE_AT_AVAILABLE 1
+#else
+    #define AF_CAN_USE_AT_AVAILABLE 0
+#endif
+
+#if ((__IPHONE_OS_VERSION_MAX_ALLOWED && __IPHONE_OS_VERSION_MAX_ALLOWED < 100000) || (__MAC_OS_VERSION_MAX_ALLOWED && __MAC_OS_VERSION_MAX_ALLOWED < 101200) ||(__WATCH_OS_MAX_VERSION_ALLOWED && __WATCH_OS_MAX_VERSION_ALLOWED < 30000) ||(__TV_OS_MAX_VERSION_ALLOWED && __TV_OS_MAX_VERSION_ALLOWED < 100000))
+    #define AF_CAN_INCLUDE_SESSION_TASK_METRICS 0
+#else
+    #define AF_CAN_INCLUDE_SESSION_TASK_METRICS 1
+#endif
+
+#endif /* AFCompatibilityMacros_h */

+ 285 - 0
Pods/AFNetworking/AFNetworking/AFHTTPSessionManager.h

@@ -0,0 +1,285 @@
+// AFHTTPSessionManager.h
+// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import <Foundation/Foundation.h>
+#if !TARGET_OS_WATCH
+#import <SystemConfiguration/SystemConfiguration.h>
+#endif
+#import <TargetConditionals.h>
+
+#import "AFURLSessionManager.h"
+
+/**
+ `AFHTTPSessionManager` is a subclass of `AFURLSessionManager` with convenience methods for making HTTP requests. When a `baseURL` is provided, requests made with the `GET` / `POST` / et al. convenience methods can be made with relative paths.
+
+ ## Subclassing Notes
+
+ Developers targeting iOS 7 or Mac OS X 10.9 or later that deal extensively with a web service are encouraged to subclass `AFHTTPSessionManager`, providing a class method that returns a shared singleton object on which authentication and other configuration can be shared across the application.
+
+ ## Methods to Override
+
+ To change the behavior of all data task operation construction, which is also used in the `GET` / `POST` / et al. convenience methods, override `dataTaskWithRequest:uploadProgress:downloadProgress:completionHandler:`.
+
+ ## Serialization
+
+ Requests created by an HTTP client will contain default headers and encode parameters according to the `requestSerializer` property, which is an object conforming to `<AFURLRequestSerialization>`.
+
+ Responses received from the server are automatically validated and serialized by the `responseSerializers` property, which is an object conforming to `<AFURLResponseSerialization>`
+
+ ## URL Construction Using Relative Paths
+
+ For HTTP convenience methods, the request serializer constructs URLs from the path relative to the `-baseURL`, using `NSURL +URLWithString:relativeToURL:`, when provided. If `baseURL` is `nil`, `path` needs to resolve to a valid `NSURL` object using `NSURL +URLWithString:`.
+
+ Below are a few examples of how `baseURL` and relative paths interact:
+
+    NSURL *baseURL = [NSURL URLWithString:@"http://example.com/v1/"];
+    [NSURL URLWithString:@"foo" relativeToURL:baseURL];                  // http://example.com/v1/foo
+    [NSURL URLWithString:@"foo?bar=baz" relativeToURL:baseURL];          // http://example.com/v1/foo?bar=baz
+    [NSURL URLWithString:@"/foo" relativeToURL:baseURL];                 // http://example.com/foo
+    [NSURL URLWithString:@"foo/" relativeToURL:baseURL];                 // http://example.com/v1/foo
+    [NSURL URLWithString:@"/foo/" relativeToURL:baseURL];                // http://example.com/foo/
+    [NSURL URLWithString:@"http://example2.com/" relativeToURL:baseURL]; // http://example2.com/
+
+ Also important to note is that a trailing slash will be added to any `baseURL` without one. This would otherwise cause unexpected behavior when constructing URLs using paths without a leading slash.
+
+ @warning Managers for background sessions must be owned for the duration of their use. This can be accomplished by creating an application-wide or shared singleton instance.
+ */
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface AFHTTPSessionManager : AFURLSessionManager <NSSecureCoding, NSCopying>
+
+/**
+ The URL used to construct requests from relative paths in methods like `requestWithMethod:URLString:parameters:`, and the `GET` / `POST` / et al. convenience methods.
+ */
+@property (readonly, nonatomic, strong, nullable) NSURL *baseURL;
+
+/**
+ Requests created with `requestWithMethod:URLString:parameters:` & `multipartFormRequestWithMethod:URLString:parameters:constructingBodyWithBlock:` are constructed with a set of default headers using a parameter serialization specified by this property. By default, this is set to an instance of `AFHTTPRequestSerializer`, which serializes query string parameters for `GET`, `HEAD`, and `DELETE` requests, or otherwise URL-form-encodes HTTP message bodies.
+
+ @warning `requestSerializer` must not be `nil`.
+ */
+@property (nonatomic, strong) AFHTTPRequestSerializer <AFURLRequestSerialization> * requestSerializer;
+
+/**
+ Responses sent from the server in data tasks created with `dataTaskWithRequest:success:failure:` and run using the `GET` / `POST` / et al. convenience methods are automatically validated and serialized by the response serializer. By default, this property is set to an instance of `AFJSONResponseSerializer`.
+
+ @warning `responseSerializer` must not be `nil`.
+ */
+@property (nonatomic, strong) AFHTTPResponseSerializer <AFURLResponseSerialization> * responseSerializer;
+
+///-------------------------------
+/// @name Managing Security Policy
+///-------------------------------
+
+/**
+ The security policy used by created session to evaluate server trust for secure connections. `AFURLSessionManager` uses the `defaultPolicy` unless otherwise specified. A security policy configured with `AFSSLPinningModePublicKey` or `AFSSLPinningModeCertificate` can only be applied on a session manager initialized with a secure base URL (i.e. https). Applying a security policy with pinning enabled on an insecure session manager throws an `Invalid Security Policy` exception.
+ */
+@property (nonatomic, strong) AFSecurityPolicy *securityPolicy;
+
+///---------------------
+/// @name Initialization
+///---------------------
+
+/**
+ Creates and returns an `AFHTTPSessionManager` object.
+ */
++ (instancetype)manager;
+
+/**
+ Initializes an `AFHTTPSessionManager` object with the specified base URL.
+
+ @param url The base URL for the HTTP client.
+
+ @return The newly-initialized HTTP client
+ */
+- (instancetype)initWithBaseURL:(nullable NSURL *)url;
+
+/**
+ Initializes an `AFHTTPSessionManager` object with the specified base URL.
+
+ This is the designated initializer.
+
+ @param url The base URL for the HTTP client.
+ @param configuration The configuration used to create the managed session.
+
+ @return The newly-initialized HTTP client
+ */
+- (instancetype)initWithBaseURL:(nullable NSURL *)url
+           sessionConfiguration:(nullable NSURLSessionConfiguration *)configuration NS_DESIGNATED_INITIALIZER;
+
+///---------------------------
+/// @name Making HTTP Requests
+///---------------------------
+
+/**
+ Creates and runs an `NSURLSessionDataTask` with a `GET` request.
+ 
+ @param URLString The URL string used to create the request URL.
+ @param parameters The parameters to be encoded according to the client request serializer.
+ @param headers The headers appended to the default headers for this request.
+ @param downloadProgress A block object to be executed when the download progress is updated. Note this block is called on the session queue, not the main queue.
+ @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer.
+ @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred.
+ 
+ @see -dataTaskWithRequest:uploadProgress:downloadProgress:completionHandler:
+ */
+- (nullable NSURLSessionDataTask *)GET:(NSString *)URLString
+                            parameters:(nullable id)parameters
+                               headers:(nullable NSDictionary <NSString *, NSString *> *)headers
+                              progress:(nullable void (^)(NSProgress *downloadProgress))downloadProgress
+                               success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success
+                               failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure;
+
+/**
+ Creates and runs an `NSURLSessionDataTask` with a `HEAD` request.
+ 
+ @param URLString The URL string used to create the request URL.
+ @param parameters The parameters to be encoded according to the client request serializer.
+ @param headers The headers appended to the default headers for this request.
+ @param success A block object to be executed when the task finishes successfully. This block has no return value and takes a single arguments: the data task.
+ @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred.
+ 
+ @see -dataTaskWithRequest:completionHandler:
+ */
+- (nullable NSURLSessionDataTask *)HEAD:(NSString *)URLString
+                             parameters:(nullable id)parameters
+                                headers:(nullable NSDictionary <NSString *, NSString *> *)headers
+                                success:(nullable void (^)(NSURLSessionDataTask *task))success
+                                failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure;
+
+/**
+ Creates and runs an `NSURLSessionDataTask` with a `POST` request.
+ 
+ @param URLString The URL string used to create the request URL.
+ @param parameters The parameters to be encoded according to the client request serializer.
+ @param headers The headers appended to the default headers for this request.
+ @param uploadProgress A block object to be executed when the upload progress is updated. Note this block is called on the session queue, not the main queue.
+ @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer.
+ @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred.
+ 
+ @see -dataTaskWithRequest:uploadProgress:downloadProgress:completionHandler:
+ */
+- (nullable NSURLSessionDataTask *)POST:(NSString *)URLString
+                             parameters:(nullable id)parameters
+                                headers:(nullable NSDictionary <NSString *, NSString *> *)headers
+                               progress:(nullable void (^)(NSProgress *uploadProgress))uploadProgress
+                                success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success
+                                failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure;
+
+/**
+ Creates and runs an `NSURLSessionDataTask` with a multipart `POST` request.
+ 
+ @param URLString The URL string used to create the request URL.
+ @param parameters The parameters to be encoded according to the client request serializer.
+ @param headers The headers appended to the default headers for this request.
+ @param block A block that takes a single argument and appends data to the HTTP body. The block argument is an object adopting the `AFMultipartFormData` protocol.
+ @param uploadProgress A block object to be executed when the upload progress is updated. Note this block is called on the session queue, not the main queue.
+ @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer.
+ @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred.
+ 
+ @see -dataTaskWithRequest:uploadProgress:downloadProgress:completionHandler:
+ */
+- (nullable NSURLSessionDataTask *)POST:(NSString *)URLString
+                             parameters:(nullable id)parameters
+                                headers:(nullable NSDictionary <NSString *, NSString *> *)headers
+              constructingBodyWithBlock:(nullable void (^)(id <AFMultipartFormData> formData))block
+                               progress:(nullable void (^)(NSProgress *uploadProgress))uploadProgress
+                                success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success
+                                failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure;
+
+/**
+ Creates and runs an `NSURLSessionDataTask` with a `PUT` request.
+ 
+ @param URLString The URL string used to create the request URL.
+ @param parameters The parameters to be encoded according to the client request serializer.
+ @param headers The headers appended to the default headers for this request.
+ @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer.
+ @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred.
+ 
+ @see -dataTaskWithRequest:completionHandler:
+ */
+- (nullable NSURLSessionDataTask *)PUT:(NSString *)URLString
+                            parameters:(nullable id)parameters
+                               headers:(nullable NSDictionary <NSString *, NSString *> *)headers
+                               success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success
+                               failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure;
+
+/**
+ Creates and runs an `NSURLSessionDataTask` with a `PATCH` request.
+ 
+ @param URLString The URL string used to create the request URL.
+ @param parameters The parameters to be encoded according to the client request serializer.
+ @param headers The headers appended to the default headers for this request.
+ @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer.
+ @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred.
+ 
+ @see -dataTaskWithRequest:completionHandler:
+ */
+- (nullable NSURLSessionDataTask *)PATCH:(NSString *)URLString
+                              parameters:(nullable id)parameters
+                                 headers:(nullable NSDictionary <NSString *, NSString *> *)headers
+                                 success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success
+                                 failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure;
+
+/**
+ Creates and runs an `NSURLSessionDataTask` with a `DELETE` request.
+ 
+ @param URLString The URL string used to create the request URL.
+ @param parameters The parameters to be encoded according to the client request serializer.
+ @param headers The headers appended to the default headers for this request.
+ @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer.
+ @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred.
+ 
+ @see -dataTaskWithRequest:completionHandler:
+ */
+- (nullable NSURLSessionDataTask *)DELETE:(NSString *)URLString
+                               parameters:(nullable id)parameters
+                                  headers:(nullable NSDictionary <NSString *, NSString *> *)headers
+                                  success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success
+                                  failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure;
+
+/**
+ Creates an `NSURLSessionDataTask` with a custom `HTTPMethod` request.
+
+ @param method The HTTPMethod string used to create the request.
+ @param URLString The URL string used to create the request URL.
+ @param parameters The parameters to be encoded according to the client request serializer.
+ @param headers The headers appended to the default headers for this request.
+ @param uploadProgress A block object to be executed when the upload progress is updated. Note this block is called on the session queue, not the main queue.
+ @param downloadProgress A block object to be executed when the download progress is updated. Note this block is called on the session queue, not the main queue.
+ @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer.
+ @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred.
+
+ @see -dataTaskWithRequest:uploadProgress:downloadProgress:completionHandler:
+ */
+- (nullable NSURLSessionDataTask *)dataTaskWithHTTPMethod:(NSString *)method
+                                                URLString:(NSString *)URLString
+                                               parameters:(nullable id)parameters
+                                                  headers:(nullable NSDictionary <NSString *, NSString *> *)headers
+                                           uploadProgress:(nullable void (^)(NSProgress *uploadProgress))uploadProgress
+                                         downloadProgress:(nullable void (^)(NSProgress *downloadProgress))downloadProgress
+                                                  success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success
+                                                  failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure;
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 357 - 0
Pods/AFNetworking/AFNetworking/AFHTTPSessionManager.m

@@ -0,0 +1,357 @@
+// AFHTTPSessionManager.m
+// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import "AFHTTPSessionManager.h"
+
+#import "AFURLRequestSerialization.h"
+#import "AFURLResponseSerialization.h"
+
+#import <Availability.h>
+#import <TargetConditionals.h>
+#import <Security/Security.h>
+
+#import <netinet/in.h>
+#import <netinet6/in6.h>
+#import <arpa/inet.h>
+#import <ifaddrs.h>
+#import <netdb.h>
+
+#if TARGET_OS_IOS || TARGET_OS_TV
+#import <UIKit/UIKit.h>
+#elif TARGET_OS_WATCH
+#import <WatchKit/WatchKit.h>
+#endif
+
+@interface AFHTTPSessionManager ()
+@property (readwrite, nonatomic, strong) NSURL *baseURL;
+@end
+
+@implementation AFHTTPSessionManager
+@dynamic responseSerializer;
+
++ (instancetype)manager {
+    return [[[self class] alloc] initWithBaseURL:nil];
+}
+
+- (instancetype)init {
+    return [self initWithBaseURL:nil];
+}
+
+- (instancetype)initWithBaseURL:(NSURL *)url {
+    return [self initWithBaseURL:url sessionConfiguration:nil];
+}
+
+- (instancetype)initWithSessionConfiguration:(NSURLSessionConfiguration *)configuration {
+    return [self initWithBaseURL:nil sessionConfiguration:configuration];
+}
+
+- (instancetype)initWithBaseURL:(NSURL *)url
+           sessionConfiguration:(NSURLSessionConfiguration *)configuration
+{
+    self = [super initWithSessionConfiguration:configuration];
+    if (!self) {
+        return nil;
+    }
+
+    // Ensure terminal slash for baseURL path, so that NSURL +URLWithString:relativeToURL: works as expected
+    if ([[url path] length] > 0 && ![[url absoluteString] hasSuffix:@"/"]) {
+        url = [url URLByAppendingPathComponent:@""];
+    }
+
+    self.baseURL = url;
+
+    self.requestSerializer = [AFHTTPRequestSerializer serializer];
+    self.responseSerializer = [AFJSONResponseSerializer serializer];
+
+    return self;
+}
+
+#pragma mark -
+
+- (void)setRequestSerializer:(AFHTTPRequestSerializer <AFURLRequestSerialization> *)requestSerializer {
+    NSParameterAssert(requestSerializer);
+
+    _requestSerializer = requestSerializer;
+}
+
+- (void)setResponseSerializer:(AFHTTPResponseSerializer <AFURLResponseSerialization> *)responseSerializer {
+    NSParameterAssert(responseSerializer);
+
+    [super setResponseSerializer:responseSerializer];
+}
+
+@dynamic securityPolicy;
+
+- (void)setSecurityPolicy:(AFSecurityPolicy *)securityPolicy {
+    if (securityPolicy.SSLPinningMode != AFSSLPinningModeNone && ![self.baseURL.scheme isEqualToString:@"https"]) {
+        NSString *pinningMode = @"Unknown Pinning Mode";
+        switch (securityPolicy.SSLPinningMode) {
+            case AFSSLPinningModeNone:        pinningMode = @"AFSSLPinningModeNone"; break;
+            case AFSSLPinningModeCertificate: pinningMode = @"AFSSLPinningModeCertificate"; break;
+            case AFSSLPinningModePublicKey:   pinningMode = @"AFSSLPinningModePublicKey"; break;
+        }
+        NSString *reason = [NSString stringWithFormat:@"A security policy configured with `%@` can only be applied on a manager with a secure base URL (i.e. https)", pinningMode];
+        @throw [NSException exceptionWithName:@"Invalid Security Policy" reason:reason userInfo:nil];
+    }
+
+    [super setSecurityPolicy:securityPolicy];
+}
+
+#pragma mark -
+
+- (NSURLSessionDataTask *)GET:(NSString *)URLString
+                   parameters:(nullable id)parameters
+                      headers:(nullable NSDictionary <NSString *, NSString *> *)headers
+                     progress:(nullable void (^)(NSProgress * _Nonnull))downloadProgress
+                      success:(nullable void (^)(NSURLSessionDataTask * _Nonnull, id _Nullable))success
+                      failure:(nullable void (^)(NSURLSessionDataTask * _Nullable, NSError * _Nonnull))failure
+{
+    
+    NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@"GET"
+                                                        URLString:URLString
+                                                       parameters:parameters
+                                                          headers:headers
+                                                   uploadProgress:nil
+                                                 downloadProgress:downloadProgress
+                                                          success:success
+                                                          failure:failure];
+    
+    [dataTask resume];
+    
+    return dataTask;
+}
+
+- (NSURLSessionDataTask *)HEAD:(NSString *)URLString
+                    parameters:(nullable id)parameters
+                       headers:(nullable NSDictionary<NSString *,NSString *> *)headers
+                       success:(nullable void (^)(NSURLSessionDataTask * _Nonnull))success
+                       failure:(nullable void (^)(NSURLSessionDataTask * _Nullable, NSError * _Nonnull))failure
+{
+    NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@"HEAD" URLString:URLString parameters:parameters headers:headers uploadProgress:nil downloadProgress:nil success:^(NSURLSessionDataTask *task, __unused id responseObject) {
+        if (success) {
+            success(task);
+        }
+    } failure:failure];
+    
+    [dataTask resume];
+    
+    return dataTask;
+}
+
+- (nullable NSURLSessionDataTask *)POST:(NSString *)URLString
+                             parameters:(nullable id)parameters
+                                headers:(nullable NSDictionary <NSString *, NSString *> *)headers
+                               progress:(nullable void (^)(NSProgress *uploadProgress))uploadProgress
+                                success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success
+                                failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure
+{
+    NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@"POST" URLString:URLString parameters:parameters headers:headers uploadProgress:uploadProgress downloadProgress:nil success:success failure:failure];
+    
+    [dataTask resume];
+    
+    return dataTask;
+}
+
+- (NSURLSessionDataTask *)POST:(NSString *)URLString
+                    parameters:(nullable id)parameters
+                       headers:(nullable NSDictionary<NSString *,NSString *> *)headers
+     constructingBodyWithBlock:(nullable void (^)(id<AFMultipartFormData> _Nonnull))block
+                      progress:(nullable void (^)(NSProgress * _Nonnull))uploadProgress
+                       success:(nullable void (^)(NSURLSessionDataTask * _Nonnull, id _Nullable))success failure:(void (^)(NSURLSessionDataTask * _Nullable, NSError * _Nonnull))failure
+{
+    NSError *serializationError = nil;
+    NSMutableURLRequest *request = [self.requestSerializer multipartFormRequestWithMethod:@"POST" URLString:[[NSURL URLWithString:URLString relativeToURL:self.baseURL] absoluteString] parameters:parameters constructingBodyWithBlock:block error:&serializationError];
+    for (NSString *headerField in headers.keyEnumerator) {
+        [request setValue:headers[headerField] forHTTPHeaderField:headerField];
+    }
+    if (serializationError) {
+        if (failure) {
+            dispatch_async(self.completionQueue ?: dispatch_get_main_queue(), ^{
+                failure(nil, serializationError);
+            });
+        }
+        
+        return nil;
+    }
+    
+    __block NSURLSessionDataTask *task = [self uploadTaskWithStreamedRequest:request progress:uploadProgress completionHandler:^(NSURLResponse * __unused response, id responseObject, NSError *error) {
+        if (error) {
+            if (failure) {
+                failure(task, error);
+            }
+        } else {
+            if (success) {
+                success(task, responseObject);
+            }
+        }
+    }];
+    
+    [task resume];
+    
+    return task;
+}
+
+- (NSURLSessionDataTask *)PUT:(NSString *)URLString
+                   parameters:(nullable id)parameters
+                      headers:(nullable NSDictionary<NSString *,NSString *> *)headers
+                      success:(nullable void (^)(NSURLSessionDataTask *task, id responseObject))success
+                      failure:(nullable void (^)(NSURLSessionDataTask *task, NSError *error))failure
+{
+    NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@"PUT" URLString:URLString parameters:parameters headers:headers uploadProgress:nil downloadProgress:nil success:success failure:failure];
+    
+    [dataTask resume];
+    
+    return dataTask;
+}
+
+- (NSURLSessionDataTask *)PATCH:(NSString *)URLString
+                     parameters:(nullable id)parameters
+                        headers:(nullable NSDictionary<NSString *,NSString *> *)headers
+                        success:(nullable void (^)(NSURLSessionDataTask *task, id responseObject))success
+                        failure:(nullable void (^)(NSURLSessionDataTask *task, NSError *error))failure
+{
+    NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@"PATCH" URLString:URLString parameters:parameters headers:headers uploadProgress:nil downloadProgress:nil success:success failure:failure];
+    
+    [dataTask resume];
+    
+    return dataTask;
+}
+
+- (NSURLSessionDataTask *)DELETE:(NSString *)URLString
+                      parameters:(nullable id)parameters
+                         headers:(nullable NSDictionary<NSString *,NSString *> *)headers
+                         success:(nullable void (^)(NSURLSessionDataTask *task, id responseObject))success
+                         failure:(nullable void (^)(NSURLSessionDataTask *task, NSError *error))failure
+{
+    NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@"DELETE" URLString:URLString parameters:parameters headers:headers uploadProgress:nil downloadProgress:nil success:success failure:failure];
+    
+    [dataTask resume];
+    
+    return dataTask;
+}
+
+
+- (NSURLSessionDataTask *)dataTaskWithHTTPMethod:(NSString *)method
+                                       URLString:(NSString *)URLString
+                                      parameters:(nullable id)parameters
+                                         headers:(nullable NSDictionary <NSString *, NSString *> *)headers
+                                  uploadProgress:(nullable void (^)(NSProgress *uploadProgress)) uploadProgress
+                                downloadProgress:(nullable void (^)(NSProgress *downloadProgress)) downloadProgress
+                                         success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success
+                                         failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure
+{
+    NSError *serializationError = nil;
+    NSMutableURLRequest *request = [self.requestSerializer requestWithMethod:method URLString:[[NSURL URLWithString:URLString relativeToURL:self.baseURL] absoluteString] parameters:parameters error:&serializationError];
+    for (NSString *headerField in headers.keyEnumerator) {
+        [request setValue:headers[headerField] forHTTPHeaderField:headerField];
+    }
+    if (serializationError) {
+        if (failure) {
+            dispatch_async(self.completionQueue ?: dispatch_get_main_queue(), ^{
+                failure(nil, serializationError);
+            });
+        }
+
+        return nil;
+    }
+
+    __block NSURLSessionDataTask *dataTask = nil;
+    dataTask = [self dataTaskWithRequest:request
+                          uploadProgress:uploadProgress
+                        downloadProgress:downloadProgress
+                       completionHandler:^(NSURLResponse * __unused response, id responseObject, NSError *error) {
+        if (error) {
+            if (failure) {
+                failure(dataTask, error);
+            }
+        } else {
+            if (success) {
+                success(dataTask, responseObject);
+            }
+        }
+    }];
+
+    return dataTask;
+}
+
+#pragma mark - NSObject
+
+- (NSString *)description {
+    return [NSString stringWithFormat:@"<%@: %p, baseURL: %@, session: %@, operationQueue: %@>", NSStringFromClass([self class]), self, [self.baseURL absoluteString], self.session, self.operationQueue];
+}
+
+#pragma mark - NSSecureCoding
+
++ (BOOL)supportsSecureCoding {
+    return YES;
+}
+
+- (instancetype)initWithCoder:(NSCoder *)decoder {
+    NSURL *baseURL = [decoder decodeObjectOfClass:[NSURL class] forKey:NSStringFromSelector(@selector(baseURL))];
+    NSURLSessionConfiguration *configuration = [decoder decodeObjectOfClass:[NSURLSessionConfiguration class] forKey:@"sessionConfiguration"];
+    if (!configuration) {
+        NSString *configurationIdentifier = [decoder decodeObjectOfClass:[NSString class] forKey:@"identifier"];
+        if (configurationIdentifier) {
+            configuration = [NSURLSessionConfiguration backgroundSessionConfigurationWithIdentifier:configurationIdentifier];
+        }
+    }
+
+    self = [self initWithBaseURL:baseURL sessionConfiguration:configuration];
+    if (!self) {
+        return nil;
+    }
+
+    self.requestSerializer = [decoder decodeObjectOfClass:[AFHTTPRequestSerializer class] forKey:NSStringFromSelector(@selector(requestSerializer))];
+    self.responseSerializer = [decoder decodeObjectOfClass:[AFHTTPResponseSerializer class] forKey:NSStringFromSelector(@selector(responseSerializer))];
+    AFSecurityPolicy *decodedPolicy = [decoder decodeObjectOfClass:[AFSecurityPolicy class] forKey:NSStringFromSelector(@selector(securityPolicy))];
+    if (decodedPolicy) {
+        self.securityPolicy = decodedPolicy;
+    }
+
+    return self;
+}
+
+- (void)encodeWithCoder:(NSCoder *)coder {
+    [super encodeWithCoder:coder];
+
+    [coder encodeObject:self.baseURL forKey:NSStringFromSelector(@selector(baseURL))];
+    if ([self.session.configuration conformsToProtocol:@protocol(NSCoding)]) {
+        [coder encodeObject:self.session.configuration forKey:@"sessionConfiguration"];
+    } else {
+        [coder encodeObject:self.session.configuration.identifier forKey:@"identifier"];
+    }
+    [coder encodeObject:self.requestSerializer forKey:NSStringFromSelector(@selector(requestSerializer))];
+    [coder encodeObject:self.responseSerializer forKey:NSStringFromSelector(@selector(responseSerializer))];
+    [coder encodeObject:self.securityPolicy forKey:NSStringFromSelector(@selector(securityPolicy))];
+}
+
+#pragma mark - NSCopying
+
+- (instancetype)copyWithZone:(NSZone *)zone {
+    AFHTTPSessionManager *HTTPClient = [[[self class] allocWithZone:zone] initWithBaseURL:self.baseURL sessionConfiguration:self.session.configuration];
+
+    HTTPClient.requestSerializer = [self.requestSerializer copyWithZone:zone];
+    HTTPClient.responseSerializer = [self.responseSerializer copyWithZone:zone];
+    HTTPClient.securityPolicy = [self.securityPolicy copyWithZone:zone];
+    return HTTPClient;
+}
+
+@end

+ 216 - 0
Pods/AFNetworking/AFNetworking/AFNetworkReachabilityManager.h

@@ -0,0 +1,216 @@
+// AFNetworkReachabilityManager.h
+// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import <Foundation/Foundation.h>
+
+#if !TARGET_OS_WATCH
+#import <SystemConfiguration/SystemConfiguration.h>
+
+typedef NS_ENUM(NSInteger, AFNetworkReachabilityStatus) {
+    AFNetworkReachabilityStatusUnknown          = -1,
+    AFNetworkReachabilityStatusNotReachable     = 0,
+    AFNetworkReachabilityStatusReachableViaWWAN = 1,
+    AFNetworkReachabilityStatusReachableViaWiFi = 2,
+};
+
+NS_ASSUME_NONNULL_BEGIN
+
+/**
+ `AFNetworkReachabilityManager` monitors the reachability of domains, and addresses for both WWAN and WiFi network interfaces.
+
+ Reachability can be used to determine background information about why a network operation failed, or to trigger a network operation retrying when a connection is established. It should not be used to prevent a user from initiating a network request, as it's possible that an initial request may be required to establish reachability.
+
+ See Apple's Reachability Sample Code ( https://developer.apple.com/library/ios/samplecode/reachability/ )
+
+ @warning Instances of `AFNetworkReachabilityManager` must be started with `-startMonitoring` before reachability status can be determined.
+ */
+@interface AFNetworkReachabilityManager : NSObject
+
+/**
+ The current network reachability status.
+ */
+@property (readonly, nonatomic, assign) AFNetworkReachabilityStatus networkReachabilityStatus;
+
+/**
+ Whether or not the network is currently reachable.
+ */
+@property (readonly, nonatomic, assign, getter = isReachable) BOOL reachable;
+
+/**
+ Whether or not the network is currently reachable via WWAN.
+ */
+@property (readonly, nonatomic, assign, getter = isReachableViaWWAN) BOOL reachableViaWWAN;
+
+/**
+ Whether or not the network is currently reachable via WiFi.
+ */
+@property (readonly, nonatomic, assign, getter = isReachableViaWiFi) BOOL reachableViaWiFi;
+
+///---------------------
+/// @name Initialization
+///---------------------
+
+/**
+ Returns the shared network reachability manager.
+ */
++ (instancetype)sharedManager;
+
+/**
+ Creates and returns a network reachability manager with the default socket address.
+ 
+ @return An initialized network reachability manager, actively monitoring the default socket address.
+ */
++ (instancetype)manager;
+
+/**
+ Creates and returns a network reachability manager for the specified domain.
+
+ @param domain The domain used to evaluate network reachability.
+
+ @return An initialized network reachability manager, actively monitoring the specified domain.
+ */
++ (instancetype)managerForDomain:(NSString *)domain;
+
+/**
+ Creates and returns a network reachability manager for the socket address.
+
+ @param address The socket address (`sockaddr_in6`) used to evaluate network reachability.
+
+ @return An initialized network reachability manager, actively monitoring the specified socket address.
+ */
++ (instancetype)managerForAddress:(const void *)address;
+
+/**
+ Initializes an instance of a network reachability manager from the specified reachability object.
+
+ @param reachability The reachability object to monitor.
+
+ @return An initialized network reachability manager, actively monitoring the specified reachability.
+ */
+- (instancetype)initWithReachability:(SCNetworkReachabilityRef)reachability NS_DESIGNATED_INITIALIZER;
+
+/**
+ *  Unavailable initializer
+ */
++ (instancetype)new NS_UNAVAILABLE;
+
+/**
+ *  Unavailable initializer
+ */
+- (instancetype)init NS_UNAVAILABLE;
+
+///--------------------------------------------------
+/// @name Starting & Stopping Reachability Monitoring
+///--------------------------------------------------
+
+/**
+ Starts monitoring for changes in network reachability status.
+ */
+- (void)startMonitoring;
+
+/**
+ Stops monitoring for changes in network reachability status.
+ */
+- (void)stopMonitoring;
+
+///-------------------------------------------------
+/// @name Getting Localized Reachability Description
+///-------------------------------------------------
+
+/**
+ Returns a localized string representation of the current network reachability status.
+ */
+- (NSString *)localizedNetworkReachabilityStatusString;
+
+///---------------------------------------------------
+/// @name Setting Network Reachability Change Callback
+///---------------------------------------------------
+
+/**
+ Sets a callback to be executed when the network availability of the `baseURL` host changes.
+
+ @param block A block object to be executed when the network availability of the `baseURL` host changes.. This block has no return value and takes a single argument which represents the various reachability states from the device to the `baseURL`.
+ */
+- (void)setReachabilityStatusChangeBlock:(nullable void (^)(AFNetworkReachabilityStatus status))block;
+
+@end
+
+///----------------
+/// @name Constants
+///----------------
+
+/**
+ ## Network Reachability
+
+ The following constants are provided by `AFNetworkReachabilityManager` as possible network reachability statuses.
+
+ enum {
+ AFNetworkReachabilityStatusUnknown,
+ AFNetworkReachabilityStatusNotReachable,
+ AFNetworkReachabilityStatusReachableViaWWAN,
+ AFNetworkReachabilityStatusReachableViaWiFi,
+ }
+
+ `AFNetworkReachabilityStatusUnknown`
+ The `baseURL` host reachability is not known.
+
+ `AFNetworkReachabilityStatusNotReachable`
+ The `baseURL` host cannot be reached.
+
+ `AFNetworkReachabilityStatusReachableViaWWAN`
+ The `baseURL` host can be reached via a cellular connection, such as EDGE or GPRS.
+
+ `AFNetworkReachabilityStatusReachableViaWiFi`
+ The `baseURL` host can be reached via a Wi-Fi connection.
+
+ ### Keys for Notification UserInfo Dictionary
+
+ Strings that are used as keys in a `userInfo` dictionary in a network reachability status change notification.
+
+ `AFNetworkingReachabilityNotificationStatusItem`
+ A key in the userInfo dictionary in a `AFNetworkingReachabilityDidChangeNotification` notification.
+ The corresponding value is an `NSNumber` object representing the `AFNetworkReachabilityStatus` value for the current reachability status.
+ */
+
+///--------------------
+/// @name Notifications
+///--------------------
+
+/**
+ Posted when network reachability changes.
+ This notification assigns no notification object. The `userInfo` dictionary contains an `NSNumber` object under the `AFNetworkingReachabilityNotificationStatusItem` key, representing the `AFNetworkReachabilityStatus` value for the current network reachability.
+
+ @warning In order for network reachability to be monitored, include the `SystemConfiguration` framework in the active target's "Link Binary With Library" build phase, and add `#import <SystemConfiguration/SystemConfiguration.h>` to the header prefix of the project (`Prefix.pch`).
+ */
+FOUNDATION_EXPORT NSString * const AFNetworkingReachabilityDidChangeNotification;
+FOUNDATION_EXPORT NSString * const AFNetworkingReachabilityNotificationStatusItem;
+
+///--------------------
+/// @name Functions
+///--------------------
+
+/**
+ Returns a localized string representation of an `AFNetworkReachabilityStatus` value.
+ */
+FOUNDATION_EXPORT NSString * AFStringFromNetworkReachabilityStatus(AFNetworkReachabilityStatus status);
+
+NS_ASSUME_NONNULL_END
+#endif

+ 269 - 0
Pods/AFNetworking/AFNetworking/AFNetworkReachabilityManager.m

@@ -0,0 +1,269 @@
+// AFNetworkReachabilityManager.m
+// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import "AFNetworkReachabilityManager.h"
+#if !TARGET_OS_WATCH
+
+#import <netinet/in.h>
+#import <netinet6/in6.h>
+#import <arpa/inet.h>
+#import <ifaddrs.h>
+#import <netdb.h>
+
+NSString * const AFNetworkingReachabilityDidChangeNotification = @"com.alamofire.networking.reachability.change";
+NSString * const AFNetworkingReachabilityNotificationStatusItem = @"AFNetworkingReachabilityNotificationStatusItem";
+
+typedef void (^AFNetworkReachabilityStatusBlock)(AFNetworkReachabilityStatus status);
+typedef AFNetworkReachabilityManager * (^AFNetworkReachabilityStatusCallback)(AFNetworkReachabilityStatus status);
+
+NSString * AFStringFromNetworkReachabilityStatus(AFNetworkReachabilityStatus status) {
+    switch (status) {
+        case AFNetworkReachabilityStatusNotReachable:
+            return NSLocalizedStringFromTable(@"Not Reachable", @"AFNetworking", nil);
+        case AFNetworkReachabilityStatusReachableViaWWAN:
+            return NSLocalizedStringFromTable(@"Reachable via WWAN", @"AFNetworking", nil);
+        case AFNetworkReachabilityStatusReachableViaWiFi:
+            return NSLocalizedStringFromTable(@"Reachable via WiFi", @"AFNetworking", nil);
+        case AFNetworkReachabilityStatusUnknown:
+        default:
+            return NSLocalizedStringFromTable(@"Unknown", @"AFNetworking", nil);
+    }
+}
+
+static AFNetworkReachabilityStatus AFNetworkReachabilityStatusForFlags(SCNetworkReachabilityFlags flags) {
+    BOOL isReachable = ((flags & kSCNetworkReachabilityFlagsReachable) != 0);
+    BOOL needsConnection = ((flags & kSCNetworkReachabilityFlagsConnectionRequired) != 0);
+    BOOL canConnectionAutomatically = (((flags & kSCNetworkReachabilityFlagsConnectionOnDemand ) != 0) || ((flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) != 0));
+    BOOL canConnectWithoutUserInteraction = (canConnectionAutomatically && (flags & kSCNetworkReachabilityFlagsInterventionRequired) == 0);
+    BOOL isNetworkReachable = (isReachable && (!needsConnection || canConnectWithoutUserInteraction));
+
+    AFNetworkReachabilityStatus status = AFNetworkReachabilityStatusUnknown;
+    if (isNetworkReachable == NO) {
+        status = AFNetworkReachabilityStatusNotReachable;
+    }
+#if	TARGET_OS_IPHONE
+    else if ((flags & kSCNetworkReachabilityFlagsIsWWAN) != 0) {
+        status = AFNetworkReachabilityStatusReachableViaWWAN;
+    }
+#endif
+    else {
+        status = AFNetworkReachabilityStatusReachableViaWiFi;
+    }
+
+    return status;
+}
+
+/**
+ * Queue a status change notification for the main thread.
+ *
+ * This is done to ensure that the notifications are received in the same order
+ * as they are sent. If notifications are sent directly, it is possible that
+ * a queued notification (for an earlier status condition) is processed after
+ * the later update, resulting in the listener being left in the wrong state.
+ */
+static void AFPostReachabilityStatusChange(SCNetworkReachabilityFlags flags, AFNetworkReachabilityStatusCallback block) {
+    AFNetworkReachabilityStatus status = AFNetworkReachabilityStatusForFlags(flags);
+    dispatch_async(dispatch_get_main_queue(), ^{
+        AFNetworkReachabilityManager *manager = nil;
+        if (block) {
+            manager = block(status);
+        }
+        NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
+        NSDictionary *userInfo = @{ AFNetworkingReachabilityNotificationStatusItem: @(status) };
+        [notificationCenter postNotificationName:AFNetworkingReachabilityDidChangeNotification object:manager userInfo:userInfo];
+    });
+}
+
+static void AFNetworkReachabilityCallback(SCNetworkReachabilityRef __unused target, SCNetworkReachabilityFlags flags, void *info) {
+    AFPostReachabilityStatusChange(flags, (__bridge AFNetworkReachabilityStatusCallback)info);
+}
+
+
+static const void * AFNetworkReachabilityRetainCallback(const void *info) {
+    return Block_copy(info);
+}
+
+static void AFNetworkReachabilityReleaseCallback(const void *info) {
+    if (info) {
+        Block_release(info);
+    }
+}
+
+@interface AFNetworkReachabilityManager ()
+@property (readonly, nonatomic, assign) SCNetworkReachabilityRef networkReachability;
+@property (readwrite, nonatomic, assign) AFNetworkReachabilityStatus networkReachabilityStatus;
+@property (readwrite, nonatomic, copy) AFNetworkReachabilityStatusBlock networkReachabilityStatusBlock;
+@end
+
+@implementation AFNetworkReachabilityManager
+
++ (instancetype)sharedManager {
+    static AFNetworkReachabilityManager *_sharedManager = nil;
+    static dispatch_once_t onceToken;
+    dispatch_once(&onceToken, ^{
+        _sharedManager = [self manager];
+    });
+
+    return _sharedManager;
+}
+
++ (instancetype)managerForDomain:(NSString *)domain {
+    SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithName(kCFAllocatorDefault, [domain UTF8String]);
+
+    AFNetworkReachabilityManager *manager = [[self alloc] initWithReachability:reachability];
+    
+    CFRelease(reachability);
+
+    return manager;
+}
+
++ (instancetype)managerForAddress:(const void *)address {
+    SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithAddress(kCFAllocatorDefault, (const struct sockaddr *)address);
+    AFNetworkReachabilityManager *manager = [[self alloc] initWithReachability:reachability];
+
+    CFRelease(reachability);
+    
+    return manager;
+}
+
++ (instancetype)manager
+{
+#if (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 90000) || (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100)
+    struct sockaddr_in6 address;
+    bzero(&address, sizeof(address));
+    address.sin6_len = sizeof(address);
+    address.sin6_family = AF_INET6;
+#else
+    struct sockaddr_in address;
+    bzero(&address, sizeof(address));
+    address.sin_len = sizeof(address);
+    address.sin_family = AF_INET;
+#endif
+    return [self managerForAddress:&address];
+}
+
+- (instancetype)initWithReachability:(SCNetworkReachabilityRef)reachability {
+    self = [super init];
+    if (!self) {
+        return nil;
+    }
+
+    _networkReachability = CFRetain(reachability);
+    self.networkReachabilityStatus = AFNetworkReachabilityStatusUnknown;
+
+    return self;
+}
+
+- (instancetype)init
+{
+    @throw [NSException exceptionWithName:NSGenericException
+                                   reason:@"`-init` unavailable. Use `-initWithReachability:` instead"
+                                 userInfo:nil];
+    return nil;
+}
+
+- (void)dealloc {
+    [self stopMonitoring];
+    
+    if (_networkReachability != NULL) {
+        CFRelease(_networkReachability);
+    }
+}
+
+#pragma mark -
+
+- (BOOL)isReachable {
+    return [self isReachableViaWWAN] || [self isReachableViaWiFi];
+}
+
+- (BOOL)isReachableViaWWAN {
+    return self.networkReachabilityStatus == AFNetworkReachabilityStatusReachableViaWWAN;
+}
+
+- (BOOL)isReachableViaWiFi {
+    return self.networkReachabilityStatus == AFNetworkReachabilityStatusReachableViaWiFi;
+}
+
+#pragma mark -
+
+- (void)startMonitoring {
+    [self stopMonitoring];
+
+    if (!self.networkReachability) {
+        return;
+    }
+
+    __weak __typeof(self)weakSelf = self;
+    AFNetworkReachabilityStatusCallback callback = ^(AFNetworkReachabilityStatus status) {
+        __strong __typeof(weakSelf)strongSelf = weakSelf;
+
+        strongSelf.networkReachabilityStatus = status;
+        if (strongSelf.networkReachabilityStatusBlock) {
+            strongSelf.networkReachabilityStatusBlock(status);
+        }
+        
+        return strongSelf;
+    };
+
+    SCNetworkReachabilityContext context = {0, (__bridge void *)callback, AFNetworkReachabilityRetainCallback, AFNetworkReachabilityReleaseCallback, NULL};
+    SCNetworkReachabilitySetCallback(self.networkReachability, AFNetworkReachabilityCallback, &context);
+    SCNetworkReachabilityScheduleWithRunLoop(self.networkReachability, CFRunLoopGetMain(), kCFRunLoopCommonModes);
+
+    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0),^{
+        SCNetworkReachabilityFlags flags;
+        if (SCNetworkReachabilityGetFlags(self.networkReachability, &flags)) {
+            AFPostReachabilityStatusChange(flags, callback);
+        }
+    });
+}
+
+- (void)stopMonitoring {
+    if (!self.networkReachability) {
+        return;
+    }
+
+    SCNetworkReachabilityUnscheduleFromRunLoop(self.networkReachability, CFRunLoopGetMain(), kCFRunLoopCommonModes);
+}
+
+#pragma mark -
+
+- (NSString *)localizedNetworkReachabilityStatusString {
+    return AFStringFromNetworkReachabilityStatus(self.networkReachabilityStatus);
+}
+
+#pragma mark -
+
+- (void)setReachabilityStatusChangeBlock:(void (^)(AFNetworkReachabilityStatus status))block {
+    self.networkReachabilityStatusBlock = block;
+}
+
+#pragma mark - NSKeyValueObserving
+
++ (NSSet *)keyPathsForValuesAffectingValueForKey:(NSString *)key {
+    if ([key isEqualToString:@"reachable"] || [key isEqualToString:@"reachableViaWWAN"] || [key isEqualToString:@"reachableViaWiFi"]) {
+        return [NSSet setWithObject:@"networkReachabilityStatus"];
+    }
+
+    return [super keyPathsForValuesAffectingValueForKey:key];
+}
+
+@end
+#endif

+ 41 - 0
Pods/AFNetworking/AFNetworking/AFNetworking.h

@@ -0,0 +1,41 @@
+// AFNetworking.h
+//
+// Copyright (c) 2013 AFNetworking (http://afnetworking.com/)
+// 
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+// 
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import <Foundation/Foundation.h>
+#import <Availability.h>
+#import <TargetConditionals.h>
+
+#ifndef _AFNETWORKING_
+    #define _AFNETWORKING_
+
+    #import "AFURLRequestSerialization.h"
+    #import "AFURLResponseSerialization.h"
+    #import "AFSecurityPolicy.h"
+
+#if !TARGET_OS_WATCH
+    #import "AFNetworkReachabilityManager.h"
+#endif
+
+    #import "AFURLSessionManager.h"
+    #import "AFHTTPSessionManager.h"
+
+#endif /* _AFNETWORKING_ */

+ 161 - 0
Pods/AFNetworking/AFNetworking/AFSecurityPolicy.h

@@ -0,0 +1,161 @@
+// AFSecurityPolicy.h
+// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import <Foundation/Foundation.h>
+#import <Security/Security.h>
+
+typedef NS_ENUM(NSUInteger, AFSSLPinningMode) {
+    AFSSLPinningModeNone,
+    AFSSLPinningModePublicKey,
+    AFSSLPinningModeCertificate,
+};
+
+/**
+ `AFSecurityPolicy` evaluates server trust against pinned X.509 certificates and public keys over secure connections.
+
+ Adding pinned SSL certificates to your app helps prevent man-in-the-middle attacks and other vulnerabilities. Applications dealing with sensitive customer data or financial information are strongly encouraged to route all communication over an HTTPS connection with SSL pinning configured and enabled.
+ */
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface AFSecurityPolicy : NSObject <NSSecureCoding, NSCopying>
+
+/**
+ The criteria by which server trust should be evaluated against the pinned SSL certificates. Defaults to `AFSSLPinningModeNone`.
+ */
+@property (readonly, nonatomic, assign) AFSSLPinningMode SSLPinningMode;
+
+/**
+ The certificates used to evaluate server trust according to the SSL pinning mode. 
+ 
+ Note that if pinning is enabled, `evaluateServerTrust:forDomain:` will return true if any pinned certificate matches.
+
+ @see policyWithPinningMode:withPinnedCertificates:
+ */
+@property (nonatomic, strong, nullable) NSSet <NSData *> *pinnedCertificates;
+
+/**
+ Whether or not to trust servers with an invalid or expired SSL certificates. Defaults to `NO`.
+ */
+@property (nonatomic, assign) BOOL allowInvalidCertificates;
+
+/**
+ Whether or not to validate the domain name in the certificate's CN field. Defaults to `YES`.
+ */
+@property (nonatomic, assign) BOOL validatesDomainName;
+
+///-----------------------------------------
+/// @name Getting Certificates from the Bundle
+///-----------------------------------------
+
+/**
+ Returns any certificates included in the bundle. If you are using AFNetworking as an embedded framework, you must use this method to find the certificates you have included in your app bundle, and use them when creating your security policy by calling `policyWithPinningMode:withPinnedCertificates`.
+
+ @return The certificates included in the given bundle.
+ */
++ (NSSet <NSData *> *)certificatesInBundle:(NSBundle *)bundle;
+
+///-----------------------------------------
+/// @name Getting Specific Security Policies
+///-----------------------------------------
+
+/**
+ Returns the shared default security policy, which does not allow invalid certificates, validates domain name, and does not validate against pinned certificates or public keys.
+
+ @return The default security policy.
+ */
++ (instancetype)defaultPolicy;
+
+///---------------------
+/// @name Initialization
+///---------------------
+
+/**
+ Creates and returns a security policy with the specified pinning mode.
+ 
+ Certificates with the `.cer` extension found in the main bundle will be pinned. If you want more control over which certificates are pinned, please use `policyWithPinningMode:withPinnedCertificates:` instead.
+
+ @param pinningMode The SSL pinning mode.
+
+ @return A new security policy.
+
+ @see -policyWithPinningMode:withPinnedCertificates:
+ */
++ (instancetype)policyWithPinningMode:(AFSSLPinningMode)pinningMode;
+
+/**
+ Creates and returns a security policy with the specified pinning mode.
+
+ @param pinningMode The SSL pinning mode.
+ @param pinnedCertificates The certificates to pin against.
+
+ @return A new security policy.
+
+ @see +certificatesInBundle:
+ @see -pinnedCertificates
+*/
++ (instancetype)policyWithPinningMode:(AFSSLPinningMode)pinningMode withPinnedCertificates:(NSSet <NSData *> *)pinnedCertificates;
+
+///------------------------------
+/// @name Evaluating Server Trust
+///------------------------------
+
+/**
+ Whether or not the specified server trust should be accepted, based on the security policy.
+
+ This method should be used when responding to an authentication challenge from a server.
+
+ @param serverTrust The X.509 certificate trust of the server.
+ @param domain The domain of serverTrust. If `nil`, the domain will not be validated.
+
+ @return Whether or not to trust the server.
+ */
+- (BOOL)evaluateServerTrust:(SecTrustRef)serverTrust
+                  forDomain:(nullable NSString *)domain;
+
+@end
+
+NS_ASSUME_NONNULL_END
+
+///----------------
+/// @name Constants
+///----------------
+
+/**
+ ## SSL Pinning Modes
+
+ The following constants are provided by `AFSSLPinningMode` as possible SSL pinning modes.
+
+ enum {
+ AFSSLPinningModeNone,
+ AFSSLPinningModePublicKey,
+ AFSSLPinningModeCertificate,
+ }
+
+ `AFSSLPinningModeNone`
+ Do not used pinned certificates to validate servers.
+
+ `AFSSLPinningModePublicKey`
+ Validate host certificates against public keys of pinned certificates.
+
+ `AFSSLPinningModeCertificate`
+ Validate host certificates against pinned certificates.
+*/

+ 341 - 0
Pods/AFNetworking/AFNetworking/AFSecurityPolicy.m

@@ -0,0 +1,341 @@
+// AFSecurityPolicy.m
+// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import "AFSecurityPolicy.h"
+
+#import <AssertMacros.h>
+
+#if !TARGET_OS_IOS && !TARGET_OS_WATCH && !TARGET_OS_TV
+static NSData * AFSecKeyGetData(SecKeyRef key) {
+    CFDataRef data = NULL;
+
+    __Require_noErr_Quiet(SecItemExport(key, kSecFormatUnknown, kSecItemPemArmour, NULL, &data), _out);
+
+    return (__bridge_transfer NSData *)data;
+
+_out:
+    if (data) {
+        CFRelease(data);
+    }
+
+    return nil;
+}
+#endif
+
+static BOOL AFSecKeyIsEqualToKey(SecKeyRef key1, SecKeyRef key2) {
+#if TARGET_OS_IOS || TARGET_OS_WATCH || TARGET_OS_TV
+    return [(__bridge id)key1 isEqual:(__bridge id)key2];
+#else
+    return [AFSecKeyGetData(key1) isEqual:AFSecKeyGetData(key2)];
+#endif
+}
+
+static id AFPublicKeyForCertificate(NSData *certificate) {
+    id allowedPublicKey = nil;
+    SecCertificateRef allowedCertificate;
+    SecPolicyRef policy = nil;
+    SecTrustRef allowedTrust = nil;
+    SecTrustResultType result;
+
+    allowedCertificate = SecCertificateCreateWithData(NULL, (__bridge CFDataRef)certificate);
+    __Require_Quiet(allowedCertificate != NULL, _out);
+
+    policy = SecPolicyCreateBasicX509();
+    __Require_noErr_Quiet(SecTrustCreateWithCertificates(allowedCertificate, policy, &allowedTrust), _out);
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+    __Require_noErr_Quiet(SecTrustEvaluate(allowedTrust, &result), _out);
+#pragma clang diagnostic pop
+
+    allowedPublicKey = (__bridge_transfer id)SecTrustCopyPublicKey(allowedTrust);
+
+_out:
+    if (allowedTrust) {
+        CFRelease(allowedTrust);
+    }
+
+    if (policy) {
+        CFRelease(policy);
+    }
+
+    if (allowedCertificate) {
+        CFRelease(allowedCertificate);
+    }
+
+    return allowedPublicKey;
+}
+
+static BOOL AFServerTrustIsValid(SecTrustRef serverTrust) {
+    BOOL isValid = NO;
+    SecTrustResultType result;
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+    __Require_noErr_Quiet(SecTrustEvaluate(serverTrust, &result), _out);
+#pragma clang diagnostic pop
+
+    isValid = (result == kSecTrustResultUnspecified || result == kSecTrustResultProceed);
+
+_out:
+    return isValid;
+}
+
+static NSArray * AFCertificateTrustChainForServerTrust(SecTrustRef serverTrust) {
+    CFIndex certificateCount = SecTrustGetCertificateCount(serverTrust);
+    NSMutableArray *trustChain = [NSMutableArray arrayWithCapacity:(NSUInteger)certificateCount];
+
+    for (CFIndex i = 0; i < certificateCount; i++) {
+        SecCertificateRef certificate = SecTrustGetCertificateAtIndex(serverTrust, i);
+        [trustChain addObject:(__bridge_transfer NSData *)SecCertificateCopyData(certificate)];
+    }
+
+    return [NSArray arrayWithArray:trustChain];
+}
+
+static NSArray * AFPublicKeyTrustChainForServerTrust(SecTrustRef serverTrust) {
+    SecPolicyRef policy = SecPolicyCreateBasicX509();
+    CFIndex certificateCount = SecTrustGetCertificateCount(serverTrust);
+    NSMutableArray *trustChain = [NSMutableArray arrayWithCapacity:(NSUInteger)certificateCount];
+    for (CFIndex i = 0; i < certificateCount; i++) {
+        SecCertificateRef certificate = SecTrustGetCertificateAtIndex(serverTrust, i);
+
+        SecCertificateRef someCertificates[] = {certificate};
+        CFArrayRef certificates = CFArrayCreate(NULL, (const void **)someCertificates, 1, NULL);
+
+        SecTrustRef trust;
+        __Require_noErr_Quiet(SecTrustCreateWithCertificates(certificates, policy, &trust), _out);
+        SecTrustResultType result;
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+        __Require_noErr_Quiet(SecTrustEvaluate(trust, &result), _out);
+#pragma clang diagnostic pop
+        [trustChain addObject:(__bridge_transfer id)SecTrustCopyPublicKey(trust)];
+
+    _out:
+        if (trust) {
+            CFRelease(trust);
+        }
+
+        if (certificates) {
+            CFRelease(certificates);
+        }
+
+        continue;
+    }
+    CFRelease(policy);
+
+    return [NSArray arrayWithArray:trustChain];
+}
+
+#pragma mark -
+
+@interface AFSecurityPolicy()
+@property (readwrite, nonatomic, assign) AFSSLPinningMode SSLPinningMode;
+@property (readwrite, nonatomic, strong) NSSet *pinnedPublicKeys;
+@end
+
+@implementation AFSecurityPolicy
+
++ (NSSet *)certificatesInBundle:(NSBundle *)bundle {
+    NSArray *paths = [bundle pathsForResourcesOfType:@"cer" inDirectory:@"."];
+
+    NSMutableSet *certificates = [NSMutableSet setWithCapacity:[paths count]];
+    for (NSString *path in paths) {
+        NSData *certificateData = [NSData dataWithContentsOfFile:path];
+        [certificates addObject:certificateData];
+    }
+
+    return [NSSet setWithSet:certificates];
+}
+
++ (instancetype)defaultPolicy {
+    AFSecurityPolicy *securityPolicy = [[self alloc] init];
+    securityPolicy.SSLPinningMode = AFSSLPinningModeNone;
+
+    return securityPolicy;
+}
+
++ (instancetype)policyWithPinningMode:(AFSSLPinningMode)pinningMode {
+    NSSet <NSData *> *defaultPinnedCertificates = [self certificatesInBundle:[NSBundle mainBundle]];
+    return [self policyWithPinningMode:pinningMode withPinnedCertificates:defaultPinnedCertificates];
+}
+
++ (instancetype)policyWithPinningMode:(AFSSLPinningMode)pinningMode withPinnedCertificates:(NSSet *)pinnedCertificates {
+    AFSecurityPolicy *securityPolicy = [[self alloc] init];
+    securityPolicy.SSLPinningMode = pinningMode;
+
+    [securityPolicy setPinnedCertificates:pinnedCertificates];
+
+    return securityPolicy;
+}
+
+- (instancetype)init {
+    self = [super init];
+    if (!self) {
+        return nil;
+    }
+
+    self.validatesDomainName = YES;
+
+    return self;
+}
+
+- (void)setPinnedCertificates:(NSSet *)pinnedCertificates {
+    _pinnedCertificates = pinnedCertificates;
+
+    if (self.pinnedCertificates) {
+        NSMutableSet *mutablePinnedPublicKeys = [NSMutableSet setWithCapacity:[self.pinnedCertificates count]];
+        for (NSData *certificate in self.pinnedCertificates) {
+            id publicKey = AFPublicKeyForCertificate(certificate);
+            if (!publicKey) {
+                continue;
+            }
+            [mutablePinnedPublicKeys addObject:publicKey];
+        }
+        self.pinnedPublicKeys = [NSSet setWithSet:mutablePinnedPublicKeys];
+    } else {
+        self.pinnedPublicKeys = nil;
+    }
+}
+
+#pragma mark -
+
+- (BOOL)evaluateServerTrust:(SecTrustRef)serverTrust
+                  forDomain:(NSString *)domain
+{
+    if (domain && self.allowInvalidCertificates && self.validatesDomainName && (self.SSLPinningMode == AFSSLPinningModeNone || [self.pinnedCertificates count] == 0)) {
+        // https://developer.apple.com/library/mac/documentation/NetworkingInternet/Conceptual/NetworkingTopics/Articles/OverridingSSLChainValidationCorrectly.html
+        //  According to the docs, you should only trust your provided certs for evaluation.
+        //  Pinned certificates are added to the trust. Without pinned certificates,
+        //  there is nothing to evaluate against.
+        //
+        //  From Apple Docs:
+        //          "Do not implicitly trust self-signed certificates as anchors (kSecTrustOptionImplicitAnchors).
+        //           Instead, add your own (self-signed) CA certificate to the list of trusted anchors."
+        NSLog(@"In order to validate a domain name for self signed certificates, you MUST use pinning.");
+        return NO;
+    }
+
+    NSMutableArray *policies = [NSMutableArray array];
+    if (self.validatesDomainName) {
+        [policies addObject:(__bridge_transfer id)SecPolicyCreateSSL(true, (__bridge CFStringRef)domain)];
+    } else {
+        [policies addObject:(__bridge_transfer id)SecPolicyCreateBasicX509()];
+    }
+
+    SecTrustSetPolicies(serverTrust, (__bridge CFArrayRef)policies);
+
+    if (self.SSLPinningMode == AFSSLPinningModeNone) {
+        return self.allowInvalidCertificates || AFServerTrustIsValid(serverTrust);
+    } else if (!self.allowInvalidCertificates && !AFServerTrustIsValid(serverTrust)) {
+        return NO;
+    }
+
+    switch (self.SSLPinningMode) {
+        case AFSSLPinningModeCertificate: {
+            NSMutableArray *pinnedCertificates = [NSMutableArray array];
+            for (NSData *certificateData in self.pinnedCertificates) {
+                [pinnedCertificates addObject:(__bridge_transfer id)SecCertificateCreateWithData(NULL, (__bridge CFDataRef)certificateData)];
+            }
+            SecTrustSetAnchorCertificates(serverTrust, (__bridge CFArrayRef)pinnedCertificates);
+
+            if (!AFServerTrustIsValid(serverTrust)) {
+                return NO;
+            }
+
+            // obtain the chain after being validated, which *should* contain the pinned certificate in the last position (if it's the Root CA)
+            NSArray *serverCertificates = AFCertificateTrustChainForServerTrust(serverTrust);
+            
+            for (NSData *trustChainCertificate in [serverCertificates reverseObjectEnumerator]) {
+                if ([self.pinnedCertificates containsObject:trustChainCertificate]) {
+                    return YES;
+                }
+            }
+            
+            return NO;
+        }
+        case AFSSLPinningModePublicKey: {
+            NSUInteger trustedPublicKeyCount = 0;
+            NSArray *publicKeys = AFPublicKeyTrustChainForServerTrust(serverTrust);
+
+            for (id trustChainPublicKey in publicKeys) {
+                for (id pinnedPublicKey in self.pinnedPublicKeys) {
+                    if (AFSecKeyIsEqualToKey((__bridge SecKeyRef)trustChainPublicKey, (__bridge SecKeyRef)pinnedPublicKey)) {
+                        trustedPublicKeyCount += 1;
+                    }
+                }
+            }
+            return trustedPublicKeyCount > 0;
+        }
+            
+        default:
+            return NO;
+    }
+    
+    return NO;
+}
+
+#pragma mark - NSKeyValueObserving
+
++ (NSSet *)keyPathsForValuesAffectingPinnedPublicKeys {
+    return [NSSet setWithObject:@"pinnedCertificates"];
+}
+
+#pragma mark - NSSecureCoding
+
++ (BOOL)supportsSecureCoding {
+    return YES;
+}
+
+- (instancetype)initWithCoder:(NSCoder *)decoder {
+
+    self = [self init];
+    if (!self) {
+        return nil;
+    }
+
+    self.SSLPinningMode = [[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(SSLPinningMode))] unsignedIntegerValue];
+    self.allowInvalidCertificates = [decoder decodeBoolForKey:NSStringFromSelector(@selector(allowInvalidCertificates))];
+    self.validatesDomainName = [decoder decodeBoolForKey:NSStringFromSelector(@selector(validatesDomainName))];
+    self.pinnedCertificates = [decoder decodeObjectOfClass:[NSSet class] forKey:NSStringFromSelector(@selector(pinnedCertificates))];
+
+    return self;
+}
+
+- (void)encodeWithCoder:(NSCoder *)coder {
+    [coder encodeObject:[NSNumber numberWithUnsignedInteger:self.SSLPinningMode] forKey:NSStringFromSelector(@selector(SSLPinningMode))];
+    [coder encodeBool:self.allowInvalidCertificates forKey:NSStringFromSelector(@selector(allowInvalidCertificates))];
+    [coder encodeBool:self.validatesDomainName forKey:NSStringFromSelector(@selector(validatesDomainName))];
+    [coder encodeObject:self.pinnedCertificates forKey:NSStringFromSelector(@selector(pinnedCertificates))];
+}
+
+#pragma mark - NSCopying
+
+- (instancetype)copyWithZone:(NSZone *)zone {
+    AFSecurityPolicy *securityPolicy = [[[self class] allocWithZone:zone] init];
+    securityPolicy.SSLPinningMode = self.SSLPinningMode;
+    securityPolicy.allowInvalidCertificates = self.allowInvalidCertificates;
+    securityPolicy.validatesDomainName = self.validatesDomainName;
+    securityPolicy.pinnedCertificates = [self.pinnedCertificates copyWithZone:zone];
+
+    return securityPolicy;
+}
+
+@end

+ 479 - 0
Pods/AFNetworking/AFNetworking/AFURLRequestSerialization.h

@@ -0,0 +1,479 @@
+// AFURLRequestSerialization.h
+// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import <Foundation/Foundation.h>
+#import <TargetConditionals.h>
+
+#if TARGET_OS_IOS || TARGET_OS_TV
+#import <UIKit/UIKit.h>
+#elif TARGET_OS_WATCH
+#import <WatchKit/WatchKit.h>
+#endif
+
+NS_ASSUME_NONNULL_BEGIN
+
+/**
+ Returns a percent-escaped string following RFC 3986 for a query string key or value.
+ RFC 3986 states that the following characters are "reserved" characters.
+ - General Delimiters: ":", "#", "[", "]", "@", "?", "/"
+ - Sub-Delimiters: "!", "$", "&", "'", "(", ")", "*", "+", ",", ";", "="
+
+ In RFC 3986 - Section 3.4, it states that the "?" and "/" characters should not be escaped to allow
+ query strings to include a URL. Therefore, all "reserved" characters with the exception of "?" and "/"
+ should be percent-escaped in the query string.
+ 
+ @param string The string to be percent-escaped.
+ 
+ @return The percent-escaped string.
+ */
+FOUNDATION_EXPORT NSString * AFPercentEscapedStringFromString(NSString *string);
+
+/**
+ A helper method to generate encoded url query parameters for appending to the end of a URL.
+
+ @param parameters A dictionary of key/values to be encoded.
+
+ @return A url encoded query string
+ */
+FOUNDATION_EXPORT NSString * AFQueryStringFromParameters(NSDictionary *parameters);
+
+/**
+ The `AFURLRequestSerialization` protocol is adopted by an object that encodes parameters for a specified HTTP requests. Request serializers may encode parameters as query strings, HTTP bodies, setting the appropriate HTTP header fields as necessary.
+
+ For example, a JSON request serializer may set the HTTP body of the request to a JSON representation, and set the `Content-Type` HTTP header field value to `application/json`.
+ */
+@protocol AFURLRequestSerialization <NSObject, NSSecureCoding, NSCopying>
+
+/**
+ Returns a request with the specified parameters encoded into a copy of the original request.
+
+ @param request The original request.
+ @param parameters The parameters to be encoded.
+ @param error The error that occurred while attempting to encode the request parameters.
+
+ @return A serialized request.
+ */
+- (nullable NSURLRequest *)requestBySerializingRequest:(NSURLRequest *)request
+                               withParameters:(nullable id)parameters
+                                        error:(NSError * _Nullable __autoreleasing *)error NS_SWIFT_NOTHROW;
+
+@end
+
+#pragma mark -
+
+/**
+
+ */
+typedef NS_ENUM(NSUInteger, AFHTTPRequestQueryStringSerializationStyle) {
+    AFHTTPRequestQueryStringDefaultStyle = 0,
+};
+
+@protocol AFMultipartFormData;
+
+/**
+ `AFHTTPRequestSerializer` conforms to the `AFURLRequestSerialization` & `AFURLResponseSerialization` protocols, offering a concrete base implementation of query string / URL form-encoded parameter serialization and default request headers, as well as response status code and content type validation.
+
+ Any request or response serializer dealing with HTTP is encouraged to subclass `AFHTTPRequestSerializer` in order to ensure consistent default behavior.
+ */
+@interface AFHTTPRequestSerializer : NSObject <AFURLRequestSerialization>
+
+/**
+ The string encoding used to serialize parameters. `NSUTF8StringEncoding` by default.
+ */
+@property (nonatomic, assign) NSStringEncoding stringEncoding;
+
+/**
+ Whether created requests can use the device’s cellular radio (if present). `YES` by default.
+
+ @see NSMutableURLRequest -setAllowsCellularAccess:
+ */
+@property (nonatomic, assign) BOOL allowsCellularAccess;
+
+/**
+ The cache policy of created requests. `NSURLRequestUseProtocolCachePolicy` by default.
+
+ @see NSMutableURLRequest -setCachePolicy:
+ */
+@property (nonatomic, assign) NSURLRequestCachePolicy cachePolicy;
+
+/**
+ Whether created requests should use the default cookie handling. `YES` by default.
+
+ @see NSMutableURLRequest -setHTTPShouldHandleCookies:
+ */
+@property (nonatomic, assign) BOOL HTTPShouldHandleCookies;
+
+/**
+ Whether created requests can continue transmitting data before receiving a response from an earlier transmission. `NO` by default
+
+ @see NSMutableURLRequest -setHTTPShouldUsePipelining:
+ */
+@property (nonatomic, assign) BOOL HTTPShouldUsePipelining;
+
+/**
+ The network service type for created requests. `NSURLNetworkServiceTypeDefault` by default.
+
+ @see NSMutableURLRequest -setNetworkServiceType:
+ */
+@property (nonatomic, assign) NSURLRequestNetworkServiceType networkServiceType;
+
+/**
+ The timeout interval, in seconds, for created requests. The default timeout interval is 60 seconds.
+
+ @see NSMutableURLRequest -setTimeoutInterval:
+ */
+@property (nonatomic, assign) NSTimeInterval timeoutInterval;
+
+///---------------------------------------
+/// @name Configuring HTTP Request Headers
+///---------------------------------------
+
+/**
+ Default HTTP header field values to be applied to serialized requests. By default, these include the following:
+
+ - `Accept-Language` with the contents of `NSLocale +preferredLanguages`
+ - `User-Agent` with the contents of various bundle identifiers and OS designations
+
+ @discussion To add or remove default request headers, use `setValue:forHTTPHeaderField:`.
+ */
+@property (readonly, nonatomic, strong) NSDictionary <NSString *, NSString *> *HTTPRequestHeaders;
+
+/**
+ Creates and returns a serializer with default configuration.
+ */
++ (instancetype)serializer;
+
+/**
+ Sets the value for the HTTP headers set in request objects made by the HTTP client. If `nil`, removes the existing value for that header.
+
+ @param field The HTTP header to set a default value for
+ @param value The value set as default for the specified header, or `nil`
+ */
+- (void)setValue:(nullable NSString *)value
+forHTTPHeaderField:(NSString *)field;
+
+/**
+ Returns the value for the HTTP headers set in the request serializer.
+
+ @param field The HTTP header to retrieve the default value for
+
+ @return The value set as default for the specified header, or `nil`
+ */
+- (nullable NSString *)valueForHTTPHeaderField:(NSString *)field;
+
+/**
+ Sets the "Authorization" HTTP header set in request objects made by the HTTP client to a basic authentication value with Base64-encoded username and password. This overwrites any existing value for this header.
+
+ @param username The HTTP basic auth username
+ @param password The HTTP basic auth password
+ */
+- (void)setAuthorizationHeaderFieldWithUsername:(NSString *)username
+                                       password:(NSString *)password;
+
+/**
+ Clears any existing value for the "Authorization" HTTP header.
+ */
+- (void)clearAuthorizationHeader;
+
+///-------------------------------------------------------
+/// @name Configuring Query String Parameter Serialization
+///-------------------------------------------------------
+
+/**
+ HTTP methods for which serialized requests will encode parameters as a query string. `GET`, `HEAD`, and `DELETE` by default.
+ */
+@property (nonatomic, strong) NSSet <NSString *> *HTTPMethodsEncodingParametersInURI;
+
+/**
+ Set the method of query string serialization according to one of the pre-defined styles.
+
+ @param style The serialization style.
+
+ @see AFHTTPRequestQueryStringSerializationStyle
+ */
+- (void)setQueryStringSerializationWithStyle:(AFHTTPRequestQueryStringSerializationStyle)style;
+
+/**
+ Set the a custom method of query string serialization according to the specified block.
+
+ @param block A block that defines a process of encoding parameters into a query string. This block returns the query string and takes three arguments: the request, the parameters to encode, and the error that occurred when attempting to encode parameters for the given request.
+ */
+- (void)setQueryStringSerializationWithBlock:(nullable NSString * _Nullable (^)(NSURLRequest *request, id parameters, NSError * __autoreleasing *error))block;
+
+///-------------------------------
+/// @name Creating Request Objects
+///-------------------------------
+
+/**
+ Creates an `NSMutableURLRequest` object with the specified HTTP method and URL string.
+
+ If the HTTP method is `GET`, `HEAD`, or `DELETE`, the parameters will be used to construct a url-encoded query string that is appended to the request's URL. Otherwise, the parameters will be encoded according to the value of the `parameterEncoding` property, and set as the request body.
+
+ @param method The HTTP method for the request, such as `GET`, `POST`, `PUT`, or `DELETE`. This parameter must not be `nil`.
+ @param URLString The URL string used to create the request URL.
+ @param parameters The parameters to be either set as a query string for `GET` requests, or the request HTTP body.
+ @param error The error that occurred while constructing the request.
+
+ @return An `NSMutableURLRequest` object.
+ */
+- (nullable NSMutableURLRequest *)requestWithMethod:(NSString *)method
+                                          URLString:(NSString *)URLString
+                                         parameters:(nullable id)parameters
+                                              error:(NSError * _Nullable __autoreleasing *)error;
+
+/**
+ Creates an `NSMutableURLRequest` object with the specified HTTP method and URLString, and constructs a `multipart/form-data` HTTP body, using the specified parameters and multipart form data block. See http://www.w3.org/TR/html4/interact/forms.html#h-17.13.4.2
+
+ Multipart form requests are automatically streamed, reading files directly from disk along with in-memory data in a single HTTP body. The resulting `NSMutableURLRequest` object has an `HTTPBodyStream` property, so refrain from setting `HTTPBodyStream` or `HTTPBody` on this request object, as it will clear out the multipart form body stream.
+
+ @param method The HTTP method for the request. This parameter must not be `GET` or `HEAD`, or `nil`.
+ @param URLString The URL string used to create the request URL.
+ @param parameters The parameters to be encoded and set in the request HTTP body.
+ @param block A block that takes a single argument and appends data to the HTTP body. The block argument is an object adopting the `AFMultipartFormData` protocol.
+ @param error The error that occurred while constructing the request.
+
+ @return An `NSMutableURLRequest` object
+ */
+- (NSMutableURLRequest *)multipartFormRequestWithMethod:(NSString *)method
+                                              URLString:(NSString *)URLString
+                                             parameters:(nullable NSDictionary <NSString *, id> *)parameters
+                              constructingBodyWithBlock:(nullable void (^)(id <AFMultipartFormData> formData))block
+                                                  error:(NSError * _Nullable __autoreleasing *)error;
+
+/**
+ Creates an `NSMutableURLRequest` by removing the `HTTPBodyStream` from a request, and asynchronously writing its contents into the specified file, invoking the completion handler when finished.
+
+ @param request The multipart form request. The `HTTPBodyStream` property of `request` must not be `nil`.
+ @param fileURL The file URL to write multipart form contents to.
+ @param handler A handler block to execute.
+
+ @discussion There is a bug in `NSURLSessionTask` that causes requests to not send a `Content-Length` header when streaming contents from an HTTP body, which is notably problematic when interacting with the Amazon S3 webservice. As a workaround, this method takes a request constructed with `multipartFormRequestWithMethod:URLString:parameters:constructingBodyWithBlock:error:`, or any other request with an `HTTPBodyStream`, writes the contents to the specified file and returns a copy of the original request with the `HTTPBodyStream` property set to `nil`. From here, the file can either be passed to `AFURLSessionManager -uploadTaskWithRequest:fromFile:progress:completionHandler:`, or have its contents read into an `NSData` that's assigned to the `HTTPBody` property of the request.
+
+ @see https://github.com/AFNetworking/AFNetworking/issues/1398
+ */
+- (NSMutableURLRequest *)requestWithMultipartFormRequest:(NSURLRequest *)request
+                             writingStreamContentsToFile:(NSURL *)fileURL
+                                       completionHandler:(nullable void (^)(NSError * _Nullable error))handler;
+
+@end
+
+#pragma mark -
+
+/**
+ The `AFMultipartFormData` protocol defines the methods supported by the parameter in the block argument of `AFHTTPRequestSerializer -multipartFormRequestWithMethod:URLString:parameters:constructingBodyWithBlock:`.
+ */
+@protocol AFMultipartFormData
+
+/**
+ Appends the HTTP header `Content-Disposition: file; filename=#{generated filename}; name=#{name}"` and `Content-Type: #{generated mimeType}`, followed by the encoded file data and the multipart form boundary.
+
+ The filename and MIME type for this data in the form will be automatically generated, using the last path component of the `fileURL` and system associated MIME type for the `fileURL` extension, respectively.
+
+ @param fileURL The URL corresponding to the file whose content will be appended to the form. This parameter must not be `nil`.
+ @param name The name to be associated with the specified data. This parameter must not be `nil`.
+ @param error If an error occurs, upon return contains an `NSError` object that describes the problem.
+
+ @return `YES` if the file data was successfully appended, otherwise `NO`.
+ */
+- (BOOL)appendPartWithFileURL:(NSURL *)fileURL
+                         name:(NSString *)name
+                        error:(NSError * _Nullable __autoreleasing *)error;
+
+/**
+ Appends the HTTP header `Content-Disposition: file; filename=#{filename}; name=#{name}"` and `Content-Type: #{mimeType}`, followed by the encoded file data and the multipart form boundary.
+
+ @param fileURL The URL corresponding to the file whose content will be appended to the form. This parameter must not be `nil`.
+ @param name The name to be associated with the specified data. This parameter must not be `nil`.
+ @param fileName The file name to be used in the `Content-Disposition` header. This parameter must not be `nil`.
+ @param mimeType The declared MIME type of the file data. This parameter must not be `nil`.
+ @param error If an error occurs, upon return contains an `NSError` object that describes the problem.
+
+ @return `YES` if the file data was successfully appended otherwise `NO`.
+ */
+- (BOOL)appendPartWithFileURL:(NSURL *)fileURL
+                         name:(NSString *)name
+                     fileName:(NSString *)fileName
+                     mimeType:(NSString *)mimeType
+                        error:(NSError * _Nullable __autoreleasing *)error;
+
+/**
+ Appends the HTTP header `Content-Disposition: file; filename=#{filename}; name=#{name}"` and `Content-Type: #{mimeType}`, followed by the data from the input stream and the multipart form boundary.
+
+ @param inputStream The input stream to be appended to the form data
+ @param name The name to be associated with the specified input stream. This parameter must not be `nil`.
+ @param fileName The filename to be associated with the specified input stream. This parameter must not be `nil`.
+ @param length The length of the specified input stream in bytes.
+ @param mimeType The MIME type of the specified data. (For example, the MIME type for a JPEG image is image/jpeg.) For a list of valid MIME types, see http://www.iana.org/assignments/media-types/. This parameter must not be `nil`.
+ */
+- (void)appendPartWithInputStream:(nullable NSInputStream *)inputStream
+                             name:(NSString *)name
+                         fileName:(NSString *)fileName
+                           length:(int64_t)length
+                         mimeType:(NSString *)mimeType;
+
+/**
+ Appends the HTTP header `Content-Disposition: file; filename=#{filename}; name=#{name}"` and `Content-Type: #{mimeType}`, followed by the encoded file data and the multipart form boundary.
+
+ @param data The data to be encoded and appended to the form data.
+ @param name The name to be associated with the specified data. This parameter must not be `nil`.
+ @param fileName The filename to be associated with the specified data. This parameter must not be `nil`.
+ @param mimeType The MIME type of the specified data. (For example, the MIME type for a JPEG image is image/jpeg.) For a list of valid MIME types, see http://www.iana.org/assignments/media-types/. This parameter must not be `nil`.
+ */
+- (void)appendPartWithFileData:(NSData *)data
+                          name:(NSString *)name
+                      fileName:(NSString *)fileName
+                      mimeType:(NSString *)mimeType;
+
+/**
+ Appends the HTTP headers `Content-Disposition: form-data; name=#{name}"`, followed by the encoded data and the multipart form boundary.
+
+ @param data The data to be encoded and appended to the form data.
+ @param name The name to be associated with the specified data. This parameter must not be `nil`.
+ */
+
+- (void)appendPartWithFormData:(NSData *)data
+                          name:(NSString *)name;
+
+
+/**
+ Appends HTTP headers, followed by the encoded data and the multipart form boundary.
+
+ @param headers The HTTP headers to be appended to the form data.
+ @param body The data to be encoded and appended to the form data. This parameter must not be `nil`.
+ */
+- (void)appendPartWithHeaders:(nullable NSDictionary <NSString *, NSString *> *)headers
+                         body:(NSData *)body;
+
+/**
+ Throttles request bandwidth by limiting the packet size and adding a delay for each chunk read from the upload stream.
+
+ When uploading over a 3G or EDGE connection, requests may fail with "request body stream exhausted". Setting a maximum packet size and delay according to the recommended values (`kAFUploadStream3GSuggestedPacketSize` and `kAFUploadStream3GSuggestedDelay`) lowers the risk of the input stream exceeding its allocated bandwidth. Unfortunately, there is no definite way to distinguish between a 3G, EDGE, or LTE connection over `NSURLConnection`. As such, it is not recommended that you throttle bandwidth based solely on network reachability. Instead, you should consider checking for the "request body stream exhausted" in a failure block, and then retrying the request with throttled bandwidth.
+
+ @param numberOfBytes Maximum packet size, in number of bytes. The default packet size for an input stream is 16kb.
+ @param delay Duration of delay each time a packet is read. By default, no delay is set.
+ */
+- (void)throttleBandwidthWithPacketSize:(NSUInteger)numberOfBytes
+                                  delay:(NSTimeInterval)delay;
+
+@end
+
+#pragma mark -
+
+/**
+ `AFJSONRequestSerializer` is a subclass of `AFHTTPRequestSerializer` that encodes parameters as JSON using `NSJSONSerialization`, setting the `Content-Type` of the encoded request to `application/json`.
+ */
+@interface AFJSONRequestSerializer : AFHTTPRequestSerializer
+
+/**
+ Options for writing the request JSON data from Foundation objects. For possible values, see the `NSJSONSerialization` documentation section "NSJSONWritingOptions". `0` by default.
+ */
+@property (nonatomic, assign) NSJSONWritingOptions writingOptions;
+
+/**
+ Creates and returns a JSON serializer with specified reading and writing options.
+
+ @param writingOptions The specified JSON writing options.
+ */
++ (instancetype)serializerWithWritingOptions:(NSJSONWritingOptions)writingOptions;
+
+@end
+
+#pragma mark -
+
+/**
+ `AFPropertyListRequestSerializer` is a subclass of `AFHTTPRequestSerializer` that encodes parameters as JSON using `NSPropertyListSerializer`, setting the `Content-Type` of the encoded request to `application/x-plist`.
+ */
+@interface AFPropertyListRequestSerializer : AFHTTPRequestSerializer
+
+/**
+ The property list format. Possible values are described in "NSPropertyListFormat".
+ */
+@property (nonatomic, assign) NSPropertyListFormat format;
+
+/**
+ @warning The `writeOptions` property is currently unused.
+ */
+@property (nonatomic, assign) NSPropertyListWriteOptions writeOptions;
+
+/**
+ Creates and returns a property list serializer with a specified format, read options, and write options.
+
+ @param format The property list format.
+ @param writeOptions The property list write options.
+
+ @warning The `writeOptions` property is currently unused.
+ */
++ (instancetype)serializerWithFormat:(NSPropertyListFormat)format
+                        writeOptions:(NSPropertyListWriteOptions)writeOptions;
+
+@end
+
+#pragma mark -
+
+///----------------
+/// @name Constants
+///----------------
+
+/**
+ ## Error Domains
+
+ The following error domain is predefined.
+
+ - `NSString * const AFURLRequestSerializationErrorDomain`
+
+ ### Constants
+
+ `AFURLRequestSerializationErrorDomain`
+ AFURLRequestSerializer errors. Error codes for `AFURLRequestSerializationErrorDomain` correspond to codes in `NSURLErrorDomain`.
+ */
+FOUNDATION_EXPORT NSString * const AFURLRequestSerializationErrorDomain;
+
+/**
+ ## User info dictionary keys
+
+ These keys may exist in the user info dictionary, in addition to those defined for NSError.
+
+ - `NSString * const AFNetworkingOperationFailingURLRequestErrorKey`
+
+ ### Constants
+
+ `AFNetworkingOperationFailingURLRequestErrorKey`
+ The corresponding value is an `NSURLRequest` containing the request of the operation associated with an error. This key is only present in the `AFURLRequestSerializationErrorDomain`.
+ */
+FOUNDATION_EXPORT NSString * const AFNetworkingOperationFailingURLRequestErrorKey;
+
+/**
+ ## Throttling Bandwidth for HTTP Request Input Streams
+
+ @see -throttleBandwidthWithPacketSize:delay:
+
+ ### Constants
+
+ `kAFUploadStream3GSuggestedPacketSize`
+ Maximum packet size, in number of bytes. Equal to 16kb.
+
+ `kAFUploadStream3GSuggestedDelay`
+ Duration of delay each time a packet is read. Equal to 0.2 seconds.
+ */
+FOUNDATION_EXPORT NSUInteger const kAFUploadStream3GSuggestedPacketSize;
+FOUNDATION_EXPORT NSTimeInterval const kAFUploadStream3GSuggestedDelay;
+
+NS_ASSUME_NONNULL_END

+ 1399 - 0
Pods/AFNetworking/AFNetworking/AFURLRequestSerialization.m

@@ -0,0 +1,1399 @@
+// AFURLRequestSerialization.m
+// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import "AFURLRequestSerialization.h"
+
+#if TARGET_OS_IOS || TARGET_OS_WATCH || TARGET_OS_TV
+#import <MobileCoreServices/MobileCoreServices.h>
+#else
+#import <CoreServices/CoreServices.h>
+#endif
+
+NSString * const AFURLRequestSerializationErrorDomain = @"com.alamofire.error.serialization.request";
+NSString * const AFNetworkingOperationFailingURLRequestErrorKey = @"com.alamofire.serialization.request.error.response";
+
+typedef NSString * (^AFQueryStringSerializationBlock)(NSURLRequest *request, id parameters, NSError *__autoreleasing *error);
+
+/**
+ Returns a percent-escaped string following RFC 3986 for a query string key or value.
+ RFC 3986 states that the following characters are "reserved" characters.
+    - General Delimiters: ":", "#", "[", "]", "@", "?", "/"
+    - Sub-Delimiters: "!", "$", "&", "'", "(", ")", "*", "+", ",", ";", "="
+
+ In RFC 3986 - Section 3.4, it states that the "?" and "/" characters should not be escaped to allow
+ query strings to include a URL. Therefore, all "reserved" characters with the exception of "?" and "/"
+ should be percent-escaped in the query string.
+    - parameter string: The string to be percent-escaped.
+    - returns: The percent-escaped string.
+ */
+NSString * AFPercentEscapedStringFromString(NSString *string) {
+    static NSString * const kAFCharactersGeneralDelimitersToEncode = @":#[]@"; // does not include "?" or "/" due to RFC 3986 - Section 3.4
+    static NSString * const kAFCharactersSubDelimitersToEncode = @"!$&'()*+,;=";
+
+    NSMutableCharacterSet * allowedCharacterSet = [[NSCharacterSet URLQueryAllowedCharacterSet] mutableCopy];
+    [allowedCharacterSet removeCharactersInString:[kAFCharactersGeneralDelimitersToEncode stringByAppendingString:kAFCharactersSubDelimitersToEncode]];
+
+	// FIXME: https://github.com/AFNetworking/AFNetworking/pull/3028
+    // return [string stringByAddingPercentEncodingWithAllowedCharacters:allowedCharacterSet];
+
+    static NSUInteger const batchSize = 50;
+
+    NSUInteger index = 0;
+    NSMutableString *escaped = @"".mutableCopy;
+
+    while (index < string.length) {
+        NSUInteger length = MIN(string.length - index, batchSize);
+        NSRange range = NSMakeRange(index, length);
+
+        // To avoid breaking up character sequences such as 👴🏻👮🏽
+        range = [string rangeOfComposedCharacterSequencesForRange:range];
+
+        NSString *substring = [string substringWithRange:range];
+        NSString *encoded = [substring stringByAddingPercentEncodingWithAllowedCharacters:allowedCharacterSet];
+        [escaped appendString:encoded];
+
+        index += range.length;
+    }
+
+	return escaped;
+}
+
+#pragma mark -
+
+@interface AFQueryStringPair : NSObject
+@property (readwrite, nonatomic, strong) id field;
+@property (readwrite, nonatomic, strong) id value;
+
+- (instancetype)initWithField:(id)field value:(id)value;
+
+- (NSString *)URLEncodedStringValue;
+@end
+
+@implementation AFQueryStringPair
+
+- (instancetype)initWithField:(id)field value:(id)value {
+    self = [super init];
+    if (!self) {
+        return nil;
+    }
+
+    self.field = field;
+    self.value = value;
+
+    return self;
+}
+
+- (NSString *)URLEncodedStringValue {
+    if (!self.value || [self.value isEqual:[NSNull null]]) {
+        return AFPercentEscapedStringFromString([self.field description]);
+    } else {
+        return [NSString stringWithFormat:@"%@=%@", AFPercentEscapedStringFromString([self.field description]), AFPercentEscapedStringFromString([self.value description])];
+    }
+}
+
+@end
+
+#pragma mark -
+
+FOUNDATION_EXPORT NSArray * AFQueryStringPairsFromDictionary(NSDictionary *dictionary);
+FOUNDATION_EXPORT NSArray * AFQueryStringPairsFromKeyAndValue(NSString *key, id value);
+
+NSString * AFQueryStringFromParameters(NSDictionary *parameters) {
+    NSMutableArray *mutablePairs = [NSMutableArray array];
+    for (AFQueryStringPair *pair in AFQueryStringPairsFromDictionary(parameters)) {
+        [mutablePairs addObject:[pair URLEncodedStringValue]];
+    }
+
+    return [mutablePairs componentsJoinedByString:@"&"];
+}
+
+NSArray * AFQueryStringPairsFromDictionary(NSDictionary *dictionary) {
+    return AFQueryStringPairsFromKeyAndValue(nil, dictionary);
+}
+
+NSArray * AFQueryStringPairsFromKeyAndValue(NSString *key, id value) {
+    NSMutableArray *mutableQueryStringComponents = [NSMutableArray array];
+
+    NSSortDescriptor *sortDescriptor = [NSSortDescriptor sortDescriptorWithKey:@"description" ascending:YES selector:@selector(compare:)];
+
+    if ([value isKindOfClass:[NSDictionary class]]) {
+        NSDictionary *dictionary = value;
+        // Sort dictionary keys to ensure consistent ordering in query string, which is important when deserializing potentially ambiguous sequences, such as an array of dictionaries
+        for (id nestedKey in [dictionary.allKeys sortedArrayUsingDescriptors:@[ sortDescriptor ]]) {
+            id nestedValue = dictionary[nestedKey];
+            if (nestedValue) {
+                [mutableQueryStringComponents addObjectsFromArray:AFQueryStringPairsFromKeyAndValue((key ? [NSString stringWithFormat:@"%@[%@]", key, nestedKey] : nestedKey), nestedValue)];
+            }
+        }
+    } else if ([value isKindOfClass:[NSArray class]]) {
+        NSArray *array = value;
+        for (id nestedValue in array) {
+            [mutableQueryStringComponents addObjectsFromArray:AFQueryStringPairsFromKeyAndValue([NSString stringWithFormat:@"%@[]", key], nestedValue)];
+        }
+    } else if ([value isKindOfClass:[NSSet class]]) {
+        NSSet *set = value;
+        for (id obj in [set sortedArrayUsingDescriptors:@[ sortDescriptor ]]) {
+            [mutableQueryStringComponents addObjectsFromArray:AFQueryStringPairsFromKeyAndValue(key, obj)];
+        }
+    } else {
+        [mutableQueryStringComponents addObject:[[AFQueryStringPair alloc] initWithField:key value:value]];
+    }
+
+    return mutableQueryStringComponents;
+}
+
+#pragma mark -
+
+@interface AFStreamingMultipartFormData : NSObject <AFMultipartFormData>
+- (instancetype)initWithURLRequest:(NSMutableURLRequest *)urlRequest
+                    stringEncoding:(NSStringEncoding)encoding;
+
+- (NSMutableURLRequest *)requestByFinalizingMultipartFormData;
+@end
+
+#pragma mark -
+
+static NSArray * AFHTTPRequestSerializerObservedKeyPaths() {
+    static NSArray *_AFHTTPRequestSerializerObservedKeyPaths = nil;
+    static dispatch_once_t onceToken;
+    dispatch_once(&onceToken, ^{
+        _AFHTTPRequestSerializerObservedKeyPaths = @[NSStringFromSelector(@selector(allowsCellularAccess)), NSStringFromSelector(@selector(cachePolicy)), NSStringFromSelector(@selector(HTTPShouldHandleCookies)), NSStringFromSelector(@selector(HTTPShouldUsePipelining)), NSStringFromSelector(@selector(networkServiceType)), NSStringFromSelector(@selector(timeoutInterval))];
+    });
+
+    return _AFHTTPRequestSerializerObservedKeyPaths;
+}
+
+static void *AFHTTPRequestSerializerObserverContext = &AFHTTPRequestSerializerObserverContext;
+
+@interface AFHTTPRequestSerializer ()
+@property (readwrite, nonatomic, strong) NSMutableSet *mutableObservedChangedKeyPaths;
+@property (readwrite, nonatomic, strong) NSMutableDictionary *mutableHTTPRequestHeaders;
+@property (readwrite, nonatomic, strong) dispatch_queue_t requestHeaderModificationQueue;
+@property (readwrite, nonatomic, assign) AFHTTPRequestQueryStringSerializationStyle queryStringSerializationStyle;
+@property (readwrite, nonatomic, copy) AFQueryStringSerializationBlock queryStringSerialization;
+@end
+
+@implementation AFHTTPRequestSerializer
+
++ (instancetype)serializer {
+    return [[self alloc] init];
+}
+
+- (instancetype)init {
+    self = [super init];
+    if (!self) {
+        return nil;
+    }
+
+    self.stringEncoding = NSUTF8StringEncoding;
+
+    self.mutableHTTPRequestHeaders = [NSMutableDictionary dictionary];
+    self.requestHeaderModificationQueue = dispatch_queue_create("requestHeaderModificationQueue", DISPATCH_QUEUE_CONCURRENT);
+
+    // Accept-Language HTTP Header; see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.4
+    NSMutableArray *acceptLanguagesComponents = [NSMutableArray array];
+    [[NSLocale preferredLanguages] enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
+        float q = 1.0f - (idx * 0.1f);
+        [acceptLanguagesComponents addObject:[NSString stringWithFormat:@"%@;q=%0.1g", obj, q]];
+        *stop = q <= 0.5f;
+    }];
+    [self setValue:[acceptLanguagesComponents componentsJoinedByString:@", "] forHTTPHeaderField:@"Accept-Language"];
+
+    // User-Agent Header; see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.43
+    NSString *userAgent = nil;
+#if TARGET_OS_IOS
+    userAgent = [NSString stringWithFormat:@"%@/%@ (%@; iOS %@; Scale/%0.2f)", [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleExecutableKey] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleIdentifierKey], [[NSBundle mainBundle] infoDictionary][@"CFBundleShortVersionString"] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleVersionKey], [[UIDevice currentDevice] model], [[UIDevice currentDevice] systemVersion], [[UIScreen mainScreen] scale]];
+#elif TARGET_OS_TV
+    userAgent = [NSString stringWithFormat:@"%@/%@ (%@; tvOS %@; Scale/%0.2f)", [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleExecutableKey] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleIdentifierKey], [[NSBundle mainBundle] infoDictionary][@"CFBundleShortVersionString"] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleVersionKey], [[UIDevice currentDevice] model], [[UIDevice currentDevice] systemVersion], [[UIScreen mainScreen] scale]];
+#elif TARGET_OS_WATCH
+    userAgent = [NSString stringWithFormat:@"%@/%@ (%@; watchOS %@; Scale/%0.2f)", [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleExecutableKey] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleIdentifierKey], [[NSBundle mainBundle] infoDictionary][@"CFBundleShortVersionString"] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleVersionKey], [[WKInterfaceDevice currentDevice] model], [[WKInterfaceDevice currentDevice] systemVersion], [[WKInterfaceDevice currentDevice] screenScale]];
+#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
+    userAgent = [NSString stringWithFormat:@"%@/%@ (Mac OS X %@)", [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleExecutableKey] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleIdentifierKey], [[NSBundle mainBundle] infoDictionary][@"CFBundleShortVersionString"] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleVersionKey], [[NSProcessInfo processInfo] operatingSystemVersionString]];
+#endif
+    if (userAgent) {
+        if (![userAgent canBeConvertedToEncoding:NSASCIIStringEncoding]) {
+            NSMutableString *mutableUserAgent = [userAgent mutableCopy];
+            if (CFStringTransform((__bridge CFMutableStringRef)(mutableUserAgent), NULL, (__bridge CFStringRef)@"Any-Latin; Latin-ASCII; [:^ASCII:] Remove", false)) {
+                userAgent = mutableUserAgent;
+            }
+        }
+        [self setValue:userAgent forHTTPHeaderField:@"User-Agent"];
+    }
+
+    // HTTP Method Definitions; see http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html
+    self.HTTPMethodsEncodingParametersInURI = [NSSet setWithObjects:@"GET", @"HEAD", @"DELETE", nil];
+
+    self.mutableObservedChangedKeyPaths = [NSMutableSet set];
+    for (NSString *keyPath in AFHTTPRequestSerializerObservedKeyPaths()) {
+        if ([self respondsToSelector:NSSelectorFromString(keyPath)]) {
+            [self addObserver:self forKeyPath:keyPath options:NSKeyValueObservingOptionNew context:AFHTTPRequestSerializerObserverContext];
+        }
+    }
+
+    return self;
+}
+
+- (void)dealloc {
+    for (NSString *keyPath in AFHTTPRequestSerializerObservedKeyPaths()) {
+        if ([self respondsToSelector:NSSelectorFromString(keyPath)]) {
+            [self removeObserver:self forKeyPath:keyPath context:AFHTTPRequestSerializerObserverContext];
+        }
+    }
+}
+
+#pragma mark -
+
+// Workarounds for crashing behavior using Key-Value Observing with XCTest
+// See https://github.com/AFNetworking/AFNetworking/issues/2523
+
+- (void)setAllowsCellularAccess:(BOOL)allowsCellularAccess {
+    [self willChangeValueForKey:NSStringFromSelector(@selector(allowsCellularAccess))];
+    _allowsCellularAccess = allowsCellularAccess;
+    [self didChangeValueForKey:NSStringFromSelector(@selector(allowsCellularAccess))];
+}
+
+- (void)setCachePolicy:(NSURLRequestCachePolicy)cachePolicy {
+    [self willChangeValueForKey:NSStringFromSelector(@selector(cachePolicy))];
+    _cachePolicy = cachePolicy;
+    [self didChangeValueForKey:NSStringFromSelector(@selector(cachePolicy))];
+}
+
+- (void)setHTTPShouldHandleCookies:(BOOL)HTTPShouldHandleCookies {
+    [self willChangeValueForKey:NSStringFromSelector(@selector(HTTPShouldHandleCookies))];
+    _HTTPShouldHandleCookies = HTTPShouldHandleCookies;
+    [self didChangeValueForKey:NSStringFromSelector(@selector(HTTPShouldHandleCookies))];
+}
+
+- (void)setHTTPShouldUsePipelining:(BOOL)HTTPShouldUsePipelining {
+    [self willChangeValueForKey:NSStringFromSelector(@selector(HTTPShouldUsePipelining))];
+    _HTTPShouldUsePipelining = HTTPShouldUsePipelining;
+    [self didChangeValueForKey:NSStringFromSelector(@selector(HTTPShouldUsePipelining))];
+}
+
+- (void)setNetworkServiceType:(NSURLRequestNetworkServiceType)networkServiceType {
+    [self willChangeValueForKey:NSStringFromSelector(@selector(networkServiceType))];
+    _networkServiceType = networkServiceType;
+    [self didChangeValueForKey:NSStringFromSelector(@selector(networkServiceType))];
+}
+
+- (void)setTimeoutInterval:(NSTimeInterval)timeoutInterval {
+    [self willChangeValueForKey:NSStringFromSelector(@selector(timeoutInterval))];
+    _timeoutInterval = timeoutInterval;
+    [self didChangeValueForKey:NSStringFromSelector(@selector(timeoutInterval))];
+}
+
+#pragma mark -
+
+- (NSDictionary *)HTTPRequestHeaders {
+    NSDictionary __block *value;
+    dispatch_sync(self.requestHeaderModificationQueue, ^{
+        value = [NSDictionary dictionaryWithDictionary:self.mutableHTTPRequestHeaders];
+    });
+    return value;
+}
+
+- (void)setValue:(NSString *)value
+forHTTPHeaderField:(NSString *)field
+{
+    dispatch_barrier_sync(self.requestHeaderModificationQueue, ^{
+        [self.mutableHTTPRequestHeaders setValue:value forKey:field];
+    });
+}
+
+- (NSString *)valueForHTTPHeaderField:(NSString *)field {
+    NSString __block *value;
+    dispatch_sync(self.requestHeaderModificationQueue, ^{
+        value = [self.mutableHTTPRequestHeaders valueForKey:field];
+    });
+    return value;
+}
+
+- (void)setAuthorizationHeaderFieldWithUsername:(NSString *)username
+                                       password:(NSString *)password
+{
+    NSData *basicAuthCredentials = [[NSString stringWithFormat:@"%@:%@", username, password] dataUsingEncoding:NSUTF8StringEncoding];
+    NSString *base64AuthCredentials = [basicAuthCredentials base64EncodedStringWithOptions:(NSDataBase64EncodingOptions)0];
+    [self setValue:[NSString stringWithFormat:@"Basic %@", base64AuthCredentials] forHTTPHeaderField:@"Authorization"];
+}
+
+- (void)clearAuthorizationHeader {
+    dispatch_barrier_sync(self.requestHeaderModificationQueue, ^{
+        [self.mutableHTTPRequestHeaders removeObjectForKey:@"Authorization"];
+    });
+}
+
+#pragma mark -
+
+- (void)setQueryStringSerializationWithStyle:(AFHTTPRequestQueryStringSerializationStyle)style {
+    self.queryStringSerializationStyle = style;
+    self.queryStringSerialization = nil;
+}
+
+- (void)setQueryStringSerializationWithBlock:(NSString *(^)(NSURLRequest *, id, NSError *__autoreleasing *))block {
+    self.queryStringSerialization = block;
+}
+
+#pragma mark -
+
+- (NSMutableURLRequest *)requestWithMethod:(NSString *)method
+                                 URLString:(NSString *)URLString
+                                parameters:(id)parameters
+                                     error:(NSError *__autoreleasing *)error
+{
+    NSParameterAssert(method);
+    NSParameterAssert(URLString);
+
+    NSURL *url = [NSURL URLWithString:URLString];
+
+    NSParameterAssert(url);
+
+    NSMutableURLRequest *mutableRequest = [[NSMutableURLRequest alloc] initWithURL:url];
+    mutableRequest.HTTPMethod = method;
+
+    for (NSString *keyPath in AFHTTPRequestSerializerObservedKeyPaths()) {
+        if ([self.mutableObservedChangedKeyPaths containsObject:keyPath]) {
+            [mutableRequest setValue:[self valueForKeyPath:keyPath] forKey:keyPath];
+        }
+    }
+
+    mutableRequest = [[self requestBySerializingRequest:mutableRequest withParameters:parameters error:error] mutableCopy];
+
+	return mutableRequest;
+}
+
+- (NSMutableURLRequest *)multipartFormRequestWithMethod:(NSString *)method
+                                              URLString:(NSString *)URLString
+                                             parameters:(NSDictionary *)parameters
+                              constructingBodyWithBlock:(void (^)(id <AFMultipartFormData> formData))block
+                                                  error:(NSError *__autoreleasing *)error
+{
+    NSParameterAssert(method);
+    NSParameterAssert(![method isEqualToString:@"GET"] && ![method isEqualToString:@"HEAD"]);
+
+    NSMutableURLRequest *mutableRequest = [self requestWithMethod:method URLString:URLString parameters:nil error:error];
+
+    __block AFStreamingMultipartFormData *formData = [[AFStreamingMultipartFormData alloc] initWithURLRequest:mutableRequest stringEncoding:NSUTF8StringEncoding];
+
+    if (parameters) {
+        for (AFQueryStringPair *pair in AFQueryStringPairsFromDictionary(parameters)) {
+            NSData *data = nil;
+            if ([pair.value isKindOfClass:[NSData class]]) {
+                data = pair.value;
+            } else if ([pair.value isEqual:[NSNull null]]) {
+                data = [NSData data];
+            } else {
+                data = [[pair.value description] dataUsingEncoding:self.stringEncoding];
+            }
+
+            if (data) {
+                [formData appendPartWithFormData:data name:[pair.field description]];
+            }
+        }
+    }
+
+    if (block) {
+        block(formData);
+    }
+
+    return [formData requestByFinalizingMultipartFormData];
+}
+
+- (NSMutableURLRequest *)requestWithMultipartFormRequest:(NSURLRequest *)request
+                             writingStreamContentsToFile:(NSURL *)fileURL
+                                       completionHandler:(void (^)(NSError *error))handler
+{
+    NSParameterAssert(request.HTTPBodyStream);
+    NSParameterAssert([fileURL isFileURL]);
+
+    NSInputStream *inputStream = request.HTTPBodyStream;
+    NSOutputStream *outputStream = [[NSOutputStream alloc] initWithURL:fileURL append:NO];
+    __block NSError *error = nil;
+
+    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+        [inputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
+        [outputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
+
+        [inputStream open];
+        [outputStream open];
+
+        while ([inputStream hasBytesAvailable] && [outputStream hasSpaceAvailable]) {
+            uint8_t buffer[1024];
+
+            NSInteger bytesRead = [inputStream read:buffer maxLength:1024];
+            if (inputStream.streamError || bytesRead < 0) {
+                error = inputStream.streamError;
+                break;
+            }
+
+            NSInteger bytesWritten = [outputStream write:buffer maxLength:(NSUInteger)bytesRead];
+            if (outputStream.streamError || bytesWritten < 0) {
+                error = outputStream.streamError;
+                break;
+            }
+
+            if (bytesRead == 0 && bytesWritten == 0) {
+                break;
+            }
+        }
+
+        [outputStream close];
+        [inputStream close];
+
+        if (handler) {
+            dispatch_async(dispatch_get_main_queue(), ^{
+                handler(error);
+            });
+        }
+    });
+
+    NSMutableURLRequest *mutableRequest = [request mutableCopy];
+    mutableRequest.HTTPBodyStream = nil;
+
+    return mutableRequest;
+}
+
+#pragma mark - AFURLRequestSerialization
+
+- (NSURLRequest *)requestBySerializingRequest:(NSURLRequest *)request
+                               withParameters:(id)parameters
+                                        error:(NSError *__autoreleasing *)error
+{
+    NSParameterAssert(request);
+
+    NSMutableURLRequest *mutableRequest = [request mutableCopy];
+
+    [self.HTTPRequestHeaders enumerateKeysAndObjectsUsingBlock:^(id field, id value, BOOL * __unused stop) {
+        if (![request valueForHTTPHeaderField:field]) {
+            [mutableRequest setValue:value forHTTPHeaderField:field];
+        }
+    }];
+
+    NSString *query = nil;
+    if (parameters) {
+        if (self.queryStringSerialization) {
+            NSError *serializationError;
+            query = self.queryStringSerialization(request, parameters, &serializationError);
+
+            if (serializationError) {
+                if (error) {
+                    *error = serializationError;
+                }
+
+                return nil;
+            }
+        } else {
+            switch (self.queryStringSerializationStyle) {
+                case AFHTTPRequestQueryStringDefaultStyle:
+                    query = AFQueryStringFromParameters(parameters);
+                    break;
+            }
+        }
+    }
+
+    if ([self.HTTPMethodsEncodingParametersInURI containsObject:[[request HTTPMethod] uppercaseString]]) {
+        if (query && query.length > 0) {
+            mutableRequest.URL = [NSURL URLWithString:[[mutableRequest.URL absoluteString] stringByAppendingFormat:mutableRequest.URL.query ? @"&%@" : @"?%@", query]];
+        }
+    } else {
+        // #2864: an empty string is a valid x-www-form-urlencoded payload
+        if (!query) {
+            query = @"";
+        }
+        if (![mutableRequest valueForHTTPHeaderField:@"Content-Type"]) {
+            [mutableRequest setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
+        }
+        [mutableRequest setHTTPBody:[query dataUsingEncoding:self.stringEncoding]];
+    }
+
+    return mutableRequest;
+}
+
+#pragma mark - NSKeyValueObserving
+
++ (BOOL)automaticallyNotifiesObserversForKey:(NSString *)key {
+    if ([AFHTTPRequestSerializerObservedKeyPaths() containsObject:key]) {
+        return NO;
+    }
+
+    return [super automaticallyNotifiesObserversForKey:key];
+}
+
+- (void)observeValueForKeyPath:(NSString *)keyPath
+                      ofObject:(__unused id)object
+                        change:(NSDictionary *)change
+                       context:(void *)context
+{
+    if (context == AFHTTPRequestSerializerObserverContext) {
+        if ([change[NSKeyValueChangeNewKey] isEqual:[NSNull null]]) {
+            [self.mutableObservedChangedKeyPaths removeObject:keyPath];
+        } else {
+            [self.mutableObservedChangedKeyPaths addObject:keyPath];
+        }
+    }
+}
+
+#pragma mark - NSSecureCoding
+
++ (BOOL)supportsSecureCoding {
+    return YES;
+}
+
+- (instancetype)initWithCoder:(NSCoder *)decoder {
+    self = [self init];
+    if (!self) {
+        return nil;
+    }
+
+    self.mutableHTTPRequestHeaders = [[decoder decodeObjectOfClass:[NSDictionary class] forKey:NSStringFromSelector(@selector(mutableHTTPRequestHeaders))] mutableCopy];
+    self.queryStringSerializationStyle = (AFHTTPRequestQueryStringSerializationStyle)[[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(queryStringSerializationStyle))] unsignedIntegerValue];
+
+    return self;
+}
+
+- (void)encodeWithCoder:(NSCoder *)coder {
+    dispatch_sync(self.requestHeaderModificationQueue, ^{
+        [coder encodeObject:self.mutableHTTPRequestHeaders forKey:NSStringFromSelector(@selector(mutableHTTPRequestHeaders))];
+    });
+    [coder encodeObject:@(self.queryStringSerializationStyle) forKey:NSStringFromSelector(@selector(queryStringSerializationStyle))];
+}
+
+#pragma mark - NSCopying
+
+- (instancetype)copyWithZone:(NSZone *)zone {
+    AFHTTPRequestSerializer *serializer = [[[self class] allocWithZone:zone] init];
+    dispatch_sync(self.requestHeaderModificationQueue, ^{
+        serializer.mutableHTTPRequestHeaders = [self.mutableHTTPRequestHeaders mutableCopyWithZone:zone];
+    });
+    serializer.queryStringSerializationStyle = self.queryStringSerializationStyle;
+    serializer.queryStringSerialization = self.queryStringSerialization;
+
+    return serializer;
+}
+
+@end
+
+#pragma mark -
+
+static NSString * AFCreateMultipartFormBoundary() {
+    return [NSString stringWithFormat:@"Boundary+%08X%08X", arc4random(), arc4random()];
+}
+
+static NSString * const kAFMultipartFormCRLF = @"\r\n";
+
+static inline NSString * AFMultipartFormInitialBoundary(NSString *boundary) {
+    return [NSString stringWithFormat:@"--%@%@", boundary, kAFMultipartFormCRLF];
+}
+
+static inline NSString * AFMultipartFormEncapsulationBoundary(NSString *boundary) {
+    return [NSString stringWithFormat:@"%@--%@%@", kAFMultipartFormCRLF, boundary, kAFMultipartFormCRLF];
+}
+
+static inline NSString * AFMultipartFormFinalBoundary(NSString *boundary) {
+    return [NSString stringWithFormat:@"%@--%@--%@", kAFMultipartFormCRLF, boundary, kAFMultipartFormCRLF];
+}
+
+static inline NSString * AFContentTypeForPathExtension(NSString *extension) {
+    NSString *UTI = (__bridge_transfer NSString *)UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, (__bridge CFStringRef)extension, NULL);
+    NSString *contentType = (__bridge_transfer NSString *)UTTypeCopyPreferredTagWithClass((__bridge CFStringRef)UTI, kUTTagClassMIMEType);
+    if (!contentType) {
+        return @"application/octet-stream";
+    } else {
+        return contentType;
+    }
+}
+
+NSUInteger const kAFUploadStream3GSuggestedPacketSize = 1024 * 16;
+NSTimeInterval const kAFUploadStream3GSuggestedDelay = 0.2;
+
+@interface AFHTTPBodyPart : NSObject
+@property (nonatomic, assign) NSStringEncoding stringEncoding;
+@property (nonatomic, strong) NSDictionary *headers;
+@property (nonatomic, copy) NSString *boundary;
+@property (nonatomic, strong) id body;
+@property (nonatomic, assign) unsigned long long bodyContentLength;
+@property (nonatomic, strong) NSInputStream *inputStream;
+
+@property (nonatomic, assign) BOOL hasInitialBoundary;
+@property (nonatomic, assign) BOOL hasFinalBoundary;
+
+@property (readonly, nonatomic, assign, getter = hasBytesAvailable) BOOL bytesAvailable;
+@property (readonly, nonatomic, assign) unsigned long long contentLength;
+
+- (NSInteger)read:(uint8_t *)buffer
+        maxLength:(NSUInteger)length;
+@end
+
+@interface AFMultipartBodyStream : NSInputStream <NSStreamDelegate>
+@property (nonatomic, assign) NSUInteger numberOfBytesInPacket;
+@property (nonatomic, assign) NSTimeInterval delay;
+@property (nonatomic, strong) NSInputStream *inputStream;
+@property (readonly, nonatomic, assign) unsigned long long contentLength;
+@property (readonly, nonatomic, assign, getter = isEmpty) BOOL empty;
+
+- (instancetype)initWithStringEncoding:(NSStringEncoding)encoding;
+- (void)setInitialAndFinalBoundaries;
+- (void)appendHTTPBodyPart:(AFHTTPBodyPart *)bodyPart;
+@end
+
+#pragma mark -
+
+@interface AFStreamingMultipartFormData ()
+@property (readwrite, nonatomic, copy) NSMutableURLRequest *request;
+@property (readwrite, nonatomic, assign) NSStringEncoding stringEncoding;
+@property (readwrite, nonatomic, copy) NSString *boundary;
+@property (readwrite, nonatomic, strong) AFMultipartBodyStream *bodyStream;
+@end
+
+@implementation AFStreamingMultipartFormData
+
+- (instancetype)initWithURLRequest:(NSMutableURLRequest *)urlRequest
+                    stringEncoding:(NSStringEncoding)encoding
+{
+    self = [super init];
+    if (!self) {
+        return nil;
+    }
+
+    self.request = urlRequest;
+    self.stringEncoding = encoding;
+    self.boundary = AFCreateMultipartFormBoundary();
+    self.bodyStream = [[AFMultipartBodyStream alloc] initWithStringEncoding:encoding];
+
+    return self;
+}
+
+- (void)setRequest:(NSMutableURLRequest *)request
+{
+    _request = [request mutableCopy];
+}
+
+- (BOOL)appendPartWithFileURL:(NSURL *)fileURL
+                         name:(NSString *)name
+                        error:(NSError * __autoreleasing *)error
+{
+    NSParameterAssert(fileURL);
+    NSParameterAssert(name);
+
+    NSString *fileName = [fileURL lastPathComponent];
+    NSString *mimeType = AFContentTypeForPathExtension([fileURL pathExtension]);
+
+    return [self appendPartWithFileURL:fileURL name:name fileName:fileName mimeType:mimeType error:error];
+}
+
+- (BOOL)appendPartWithFileURL:(NSURL *)fileURL
+                         name:(NSString *)name
+                     fileName:(NSString *)fileName
+                     mimeType:(NSString *)mimeType
+                        error:(NSError * __autoreleasing *)error
+{
+    NSParameterAssert(fileURL);
+    NSParameterAssert(name);
+    NSParameterAssert(fileName);
+    NSParameterAssert(mimeType);
+
+    if (![fileURL isFileURL]) {
+        NSDictionary *userInfo = @{NSLocalizedFailureReasonErrorKey: NSLocalizedStringFromTable(@"Expected URL to be a file URL", @"AFNetworking", nil)};
+        if (error) {
+            *error = [[NSError alloc] initWithDomain:AFURLRequestSerializationErrorDomain code:NSURLErrorBadURL userInfo:userInfo];
+        }
+
+        return NO;
+    } else if ([fileURL checkResourceIsReachableAndReturnError:error] == NO) {
+        NSDictionary *userInfo = @{NSLocalizedFailureReasonErrorKey: NSLocalizedStringFromTable(@"File URL not reachable.", @"AFNetworking", nil)};
+        if (error) {
+            *error = [[NSError alloc] initWithDomain:AFURLRequestSerializationErrorDomain code:NSURLErrorBadURL userInfo:userInfo];
+        }
+
+        return NO;
+    }
+
+    NSDictionary *fileAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:[fileURL path] error:error];
+    if (!fileAttributes) {
+        return NO;
+    }
+
+    NSMutableDictionary *mutableHeaders = [NSMutableDictionary dictionary];
+    [mutableHeaders setValue:[NSString stringWithFormat:@"form-data; name=\"%@\"; filename=\"%@\"", name, fileName] forKey:@"Content-Disposition"];
+    [mutableHeaders setValue:mimeType forKey:@"Content-Type"];
+
+    AFHTTPBodyPart *bodyPart = [[AFHTTPBodyPart alloc] init];
+    bodyPart.stringEncoding = self.stringEncoding;
+    bodyPart.headers = mutableHeaders;
+    bodyPart.boundary = self.boundary;
+    bodyPart.body = fileURL;
+    bodyPart.bodyContentLength = [fileAttributes[NSFileSize] unsignedLongLongValue];
+    [self.bodyStream appendHTTPBodyPart:bodyPart];
+
+    return YES;
+}
+
+- (void)appendPartWithInputStream:(NSInputStream *)inputStream
+                             name:(NSString *)name
+                         fileName:(NSString *)fileName
+                           length:(int64_t)length
+                         mimeType:(NSString *)mimeType
+{
+    NSParameterAssert(name);
+    NSParameterAssert(fileName);
+    NSParameterAssert(mimeType);
+
+    NSMutableDictionary *mutableHeaders = [NSMutableDictionary dictionary];
+    [mutableHeaders setValue:[NSString stringWithFormat:@"form-data; name=\"%@\"; filename=\"%@\"", name, fileName] forKey:@"Content-Disposition"];
+    [mutableHeaders setValue:mimeType forKey:@"Content-Type"];
+
+    AFHTTPBodyPart *bodyPart = [[AFHTTPBodyPart alloc] init];
+    bodyPart.stringEncoding = self.stringEncoding;
+    bodyPart.headers = mutableHeaders;
+    bodyPart.boundary = self.boundary;
+    bodyPart.body = inputStream;
+
+    bodyPart.bodyContentLength = (unsigned long long)length;
+
+    [self.bodyStream appendHTTPBodyPart:bodyPart];
+}
+
+- (void)appendPartWithFileData:(NSData *)data
+                          name:(NSString *)name
+                      fileName:(NSString *)fileName
+                      mimeType:(NSString *)mimeType
+{
+    NSParameterAssert(name);
+    NSParameterAssert(fileName);
+    NSParameterAssert(mimeType);
+
+    NSMutableDictionary *mutableHeaders = [NSMutableDictionary dictionary];
+    [mutableHeaders setValue:[NSString stringWithFormat:@"form-data; name=\"%@\"; filename=\"%@\"", name, fileName] forKey:@"Content-Disposition"];
+    [mutableHeaders setValue:mimeType forKey:@"Content-Type"];
+
+    [self appendPartWithHeaders:mutableHeaders body:data];
+}
+
+- (void)appendPartWithFormData:(NSData *)data
+                          name:(NSString *)name
+{
+    NSParameterAssert(name);
+
+    NSMutableDictionary *mutableHeaders = [NSMutableDictionary dictionary];
+    [mutableHeaders setValue:[NSString stringWithFormat:@"form-data; name=\"%@\"", name] forKey:@"Content-Disposition"];
+
+    [self appendPartWithHeaders:mutableHeaders body:data];
+}
+
+- (void)appendPartWithHeaders:(NSDictionary *)headers
+                         body:(NSData *)body
+{
+    NSParameterAssert(body);
+
+    AFHTTPBodyPart *bodyPart = [[AFHTTPBodyPart alloc] init];
+    bodyPart.stringEncoding = self.stringEncoding;
+    bodyPart.headers = headers;
+    bodyPart.boundary = self.boundary;
+    bodyPart.bodyContentLength = [body length];
+    bodyPart.body = body;
+
+    [self.bodyStream appendHTTPBodyPart:bodyPart];
+}
+
+- (void)throttleBandwidthWithPacketSize:(NSUInteger)numberOfBytes
+                                  delay:(NSTimeInterval)delay
+{
+    self.bodyStream.numberOfBytesInPacket = numberOfBytes;
+    self.bodyStream.delay = delay;
+}
+
+- (NSMutableURLRequest *)requestByFinalizingMultipartFormData {
+    if ([self.bodyStream isEmpty]) {
+        return self.request;
+    }
+
+    // Reset the initial and final boundaries to ensure correct Content-Length
+    [self.bodyStream setInitialAndFinalBoundaries];
+    [self.request setHTTPBodyStream:self.bodyStream];
+
+    [self.request setValue:[NSString stringWithFormat:@"multipart/form-data; boundary=%@", self.boundary] forHTTPHeaderField:@"Content-Type"];
+    [self.request setValue:[NSString stringWithFormat:@"%llu", [self.bodyStream contentLength]] forHTTPHeaderField:@"Content-Length"];
+
+    return self.request;
+}
+
+@end
+
+#pragma mark -
+
+@interface NSStream ()
+@property (readwrite) NSStreamStatus streamStatus;
+@property (readwrite, copy) NSError *streamError;
+@end
+
+@interface AFMultipartBodyStream () <NSCopying>
+@property (readwrite, nonatomic, assign) NSStringEncoding stringEncoding;
+@property (readwrite, nonatomic, strong) NSMutableArray *HTTPBodyParts;
+@property (readwrite, nonatomic, strong) NSEnumerator *HTTPBodyPartEnumerator;
+@property (readwrite, nonatomic, strong) AFHTTPBodyPart *currentHTTPBodyPart;
+@property (readwrite, nonatomic, strong) NSOutputStream *outputStream;
+@property (readwrite, nonatomic, strong) NSMutableData *buffer;
+@end
+
+@implementation AFMultipartBodyStream
+#if (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000) || (defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 1100)
+@synthesize delegate;
+#endif
+@synthesize streamStatus;
+@synthesize streamError;
+
+- (instancetype)initWithStringEncoding:(NSStringEncoding)encoding {
+    self = [super init];
+    if (!self) {
+        return nil;
+    }
+
+    self.stringEncoding = encoding;
+    self.HTTPBodyParts = [NSMutableArray array];
+    self.numberOfBytesInPacket = NSIntegerMax;
+
+    return self;
+}
+
+- (void)setInitialAndFinalBoundaries {
+    if ([self.HTTPBodyParts count] > 0) {
+        for (AFHTTPBodyPart *bodyPart in self.HTTPBodyParts) {
+            bodyPart.hasInitialBoundary = NO;
+            bodyPart.hasFinalBoundary = NO;
+        }
+
+        [[self.HTTPBodyParts firstObject] setHasInitialBoundary:YES];
+        [[self.HTTPBodyParts lastObject] setHasFinalBoundary:YES];
+    }
+}
+
+- (void)appendHTTPBodyPart:(AFHTTPBodyPart *)bodyPart {
+    [self.HTTPBodyParts addObject:bodyPart];
+}
+
+- (BOOL)isEmpty {
+    return [self.HTTPBodyParts count] == 0;
+}
+
+#pragma mark - NSInputStream
+
+- (NSInteger)read:(uint8_t *)buffer
+        maxLength:(NSUInteger)length
+{
+    if ([self streamStatus] == NSStreamStatusClosed) {
+        return 0;
+    }
+
+    NSInteger totalNumberOfBytesRead = 0;
+
+    while ((NSUInteger)totalNumberOfBytesRead < MIN(length, self.numberOfBytesInPacket)) {
+        if (!self.currentHTTPBodyPart || ![self.currentHTTPBodyPart hasBytesAvailable]) {
+            if (!(self.currentHTTPBodyPart = [self.HTTPBodyPartEnumerator nextObject])) {
+                break;
+            }
+        } else {
+            NSUInteger maxLength = MIN(length, self.numberOfBytesInPacket) - (NSUInteger)totalNumberOfBytesRead;
+            NSInteger numberOfBytesRead = [self.currentHTTPBodyPart read:&buffer[totalNumberOfBytesRead] maxLength:maxLength];
+            if (numberOfBytesRead == -1) {
+                self.streamError = self.currentHTTPBodyPart.inputStream.streamError;
+                break;
+            } else {
+                totalNumberOfBytesRead += numberOfBytesRead;
+
+                if (self.delay > 0.0f) {
+                    [NSThread sleepForTimeInterval:self.delay];
+                }
+            }
+        }
+    }
+
+    return totalNumberOfBytesRead;
+}
+
+- (BOOL)getBuffer:(__unused uint8_t **)buffer
+           length:(__unused NSUInteger *)len
+{
+    return NO;
+}
+
+- (BOOL)hasBytesAvailable {
+    return [self streamStatus] == NSStreamStatusOpen;
+}
+
+#pragma mark - NSStream
+
+- (void)open {
+    if (self.streamStatus == NSStreamStatusOpen) {
+        return;
+    }
+
+    self.streamStatus = NSStreamStatusOpen;
+
+    [self setInitialAndFinalBoundaries];
+    self.HTTPBodyPartEnumerator = [self.HTTPBodyParts objectEnumerator];
+}
+
+- (void)close {
+    self.streamStatus = NSStreamStatusClosed;
+}
+
+- (id)propertyForKey:(__unused NSString *)key {
+    return nil;
+}
+
+- (BOOL)setProperty:(__unused id)property
+             forKey:(__unused NSString *)key
+{
+    return NO;
+}
+
+- (void)scheduleInRunLoop:(__unused NSRunLoop *)aRunLoop
+                  forMode:(__unused NSString *)mode
+{}
+
+- (void)removeFromRunLoop:(__unused NSRunLoop *)aRunLoop
+                  forMode:(__unused NSString *)mode
+{}
+
+- (unsigned long long)contentLength {
+    unsigned long long length = 0;
+    for (AFHTTPBodyPart *bodyPart in self.HTTPBodyParts) {
+        length += [bodyPart contentLength];
+    }
+
+    return length;
+}
+
+#pragma mark - Undocumented CFReadStream Bridged Methods
+
+- (void)_scheduleInCFRunLoop:(__unused CFRunLoopRef)aRunLoop
+                     forMode:(__unused CFStringRef)aMode
+{}
+
+- (void)_unscheduleFromCFRunLoop:(__unused CFRunLoopRef)aRunLoop
+                         forMode:(__unused CFStringRef)aMode
+{}
+
+- (BOOL)_setCFClientFlags:(__unused CFOptionFlags)inFlags
+                 callback:(__unused CFReadStreamClientCallBack)inCallback
+                  context:(__unused CFStreamClientContext *)inContext {
+    return NO;
+}
+
+#pragma mark - NSCopying
+
+- (instancetype)copyWithZone:(NSZone *)zone {
+    AFMultipartBodyStream *bodyStreamCopy = [[[self class] allocWithZone:zone] initWithStringEncoding:self.stringEncoding];
+
+    for (AFHTTPBodyPart *bodyPart in self.HTTPBodyParts) {
+        [bodyStreamCopy appendHTTPBodyPart:[bodyPart copy]];
+    }
+
+    [bodyStreamCopy setInitialAndFinalBoundaries];
+
+    return bodyStreamCopy;
+}
+
+@end
+
+#pragma mark -
+
+typedef enum {
+    AFEncapsulationBoundaryPhase = 1,
+    AFHeaderPhase                = 2,
+    AFBodyPhase                  = 3,
+    AFFinalBoundaryPhase         = 4,
+} AFHTTPBodyPartReadPhase;
+
+@interface AFHTTPBodyPart () <NSCopying> {
+    AFHTTPBodyPartReadPhase _phase;
+    NSInputStream *_inputStream;
+    unsigned long long _phaseReadOffset;
+}
+
+- (BOOL)transitionToNextPhase;
+- (NSInteger)readData:(NSData *)data
+           intoBuffer:(uint8_t *)buffer
+            maxLength:(NSUInteger)length;
+@end
+
+@implementation AFHTTPBodyPart
+
+- (instancetype)init {
+    self = [super init];
+    if (!self) {
+        return nil;
+    }
+
+    [self transitionToNextPhase];
+
+    return self;
+}
+
+- (void)dealloc {
+    if (_inputStream) {
+        [_inputStream close];
+        _inputStream = nil;
+    }
+}
+
+- (NSInputStream *)inputStream {
+    if (!_inputStream) {
+        if ([self.body isKindOfClass:[NSData class]]) {
+            _inputStream = [NSInputStream inputStreamWithData:self.body];
+        } else if ([self.body isKindOfClass:[NSURL class]]) {
+            _inputStream = [NSInputStream inputStreamWithURL:self.body];
+        } else if ([self.body isKindOfClass:[NSInputStream class]]) {
+            _inputStream = self.body;
+        } else {
+            _inputStream = [NSInputStream inputStreamWithData:[NSData data]];
+        }
+    }
+
+    return _inputStream;
+}
+
+- (NSString *)stringForHeaders {
+    NSMutableString *headerString = [NSMutableString string];
+    for (NSString *field in [self.headers allKeys]) {
+        [headerString appendString:[NSString stringWithFormat:@"%@: %@%@", field, [self.headers valueForKey:field], kAFMultipartFormCRLF]];
+    }
+    [headerString appendString:kAFMultipartFormCRLF];
+
+    return [NSString stringWithString:headerString];
+}
+
+- (unsigned long long)contentLength {
+    unsigned long long length = 0;
+
+    NSData *encapsulationBoundaryData = [([self hasInitialBoundary] ? AFMultipartFormInitialBoundary(self.boundary) : AFMultipartFormEncapsulationBoundary(self.boundary)) dataUsingEncoding:self.stringEncoding];
+    length += [encapsulationBoundaryData length];
+
+    NSData *headersData = [[self stringForHeaders] dataUsingEncoding:self.stringEncoding];
+    length += [headersData length];
+
+    length += _bodyContentLength;
+
+    NSData *closingBoundaryData = ([self hasFinalBoundary] ? [AFMultipartFormFinalBoundary(self.boundary) dataUsingEncoding:self.stringEncoding] : [NSData data]);
+    length += [closingBoundaryData length];
+
+    return length;
+}
+
+- (BOOL)hasBytesAvailable {
+    // Allows `read:maxLength:` to be called again if `AFMultipartFormFinalBoundary` doesn't fit into the available buffer
+    if (_phase == AFFinalBoundaryPhase) {
+        return YES;
+    }
+
+    switch (self.inputStream.streamStatus) {
+        case NSStreamStatusNotOpen:
+        case NSStreamStatusOpening:
+        case NSStreamStatusOpen:
+        case NSStreamStatusReading:
+        case NSStreamStatusWriting:
+            return YES;
+        case NSStreamStatusAtEnd:
+        case NSStreamStatusClosed:
+        case NSStreamStatusError:
+        default:
+            return NO;
+    }
+}
+
+- (NSInteger)read:(uint8_t *)buffer
+        maxLength:(NSUInteger)length
+{
+    NSInteger totalNumberOfBytesRead = 0;
+
+    if (_phase == AFEncapsulationBoundaryPhase) {
+        NSData *encapsulationBoundaryData = [([self hasInitialBoundary] ? AFMultipartFormInitialBoundary(self.boundary) : AFMultipartFormEncapsulationBoundary(self.boundary)) dataUsingEncoding:self.stringEncoding];
+        totalNumberOfBytesRead += [self readData:encapsulationBoundaryData intoBuffer:&buffer[totalNumberOfBytesRead] maxLength:(length - (NSUInteger)totalNumberOfBytesRead)];
+    }
+
+    if (_phase == AFHeaderPhase) {
+        NSData *headersData = [[self stringForHeaders] dataUsingEncoding:self.stringEncoding];
+        totalNumberOfBytesRead += [self readData:headersData intoBuffer:&buffer[totalNumberOfBytesRead] maxLength:(length - (NSUInteger)totalNumberOfBytesRead)];
+    }
+
+    if (_phase == AFBodyPhase) {
+        NSInteger numberOfBytesRead = 0;
+
+        numberOfBytesRead = [self.inputStream read:&buffer[totalNumberOfBytesRead] maxLength:(length - (NSUInteger)totalNumberOfBytesRead)];
+        if (numberOfBytesRead == -1) {
+            return -1;
+        } else {
+            totalNumberOfBytesRead += numberOfBytesRead;
+
+            if ([self.inputStream streamStatus] >= NSStreamStatusAtEnd) {
+                [self transitionToNextPhase];
+            }
+        }
+    }
+
+    if (_phase == AFFinalBoundaryPhase) {
+        NSData *closingBoundaryData = ([self hasFinalBoundary] ? [AFMultipartFormFinalBoundary(self.boundary) dataUsingEncoding:self.stringEncoding] : [NSData data]);
+        totalNumberOfBytesRead += [self readData:closingBoundaryData intoBuffer:&buffer[totalNumberOfBytesRead] maxLength:(length - (NSUInteger)totalNumberOfBytesRead)];
+    }
+
+    return totalNumberOfBytesRead;
+}
+
+- (NSInteger)readData:(NSData *)data
+           intoBuffer:(uint8_t *)buffer
+            maxLength:(NSUInteger)length
+{
+    NSRange range = NSMakeRange((NSUInteger)_phaseReadOffset, MIN([data length] - ((NSUInteger)_phaseReadOffset), length));
+    [data getBytes:buffer range:range];
+
+    _phaseReadOffset += range.length;
+
+    if (((NSUInteger)_phaseReadOffset) >= [data length]) {
+        [self transitionToNextPhase];
+    }
+
+    return (NSInteger)range.length;
+}
+
+- (BOOL)transitionToNextPhase {
+    if (![[NSThread currentThread] isMainThread]) {
+        dispatch_sync(dispatch_get_main_queue(), ^{
+            [self transitionToNextPhase];
+        });
+        return YES;
+    }
+
+    switch (_phase) {
+        case AFEncapsulationBoundaryPhase:
+            _phase = AFHeaderPhase;
+            break;
+        case AFHeaderPhase:
+            [self.inputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSRunLoopCommonModes];
+            [self.inputStream open];
+            _phase = AFBodyPhase;
+            break;
+        case AFBodyPhase:
+            [self.inputStream close];
+            _phase = AFFinalBoundaryPhase;
+            break;
+        case AFFinalBoundaryPhase:
+        default:
+            _phase = AFEncapsulationBoundaryPhase;
+            break;
+    }
+    _phaseReadOffset = 0;
+
+    return YES;
+}
+
+#pragma mark - NSCopying
+
+- (instancetype)copyWithZone:(NSZone *)zone {
+    AFHTTPBodyPart *bodyPart = [[[self class] allocWithZone:zone] init];
+
+    bodyPart.stringEncoding = self.stringEncoding;
+    bodyPart.headers = self.headers;
+    bodyPart.bodyContentLength = self.bodyContentLength;
+    bodyPart.body = self.body;
+    bodyPart.boundary = self.boundary;
+
+    return bodyPart;
+}
+
+@end
+
+#pragma mark -
+
+@implementation AFJSONRequestSerializer
+
++ (instancetype)serializer {
+    return [self serializerWithWritingOptions:(NSJSONWritingOptions)0];
+}
+
++ (instancetype)serializerWithWritingOptions:(NSJSONWritingOptions)writingOptions
+{
+    AFJSONRequestSerializer *serializer = [[self alloc] init];
+    serializer.writingOptions = writingOptions;
+
+    return serializer;
+}
+
+#pragma mark - AFURLRequestSerialization
+
+- (NSURLRequest *)requestBySerializingRequest:(NSURLRequest *)request
+                               withParameters:(id)parameters
+                                        error:(NSError *__autoreleasing *)error
+{
+    NSParameterAssert(request);
+
+    if ([self.HTTPMethodsEncodingParametersInURI containsObject:[[request HTTPMethod] uppercaseString]]) {
+        return [super requestBySerializingRequest:request withParameters:parameters error:error];
+    }
+
+    NSMutableURLRequest *mutableRequest = [request mutableCopy];
+
+    [self.HTTPRequestHeaders enumerateKeysAndObjectsUsingBlock:^(id field, id value, BOOL * __unused stop) {
+        if (![request valueForHTTPHeaderField:field]) {
+            [mutableRequest setValue:value forHTTPHeaderField:field];
+        }
+    }];
+
+    if (parameters) {
+        if (![mutableRequest valueForHTTPHeaderField:@"Content-Type"]) {
+            [mutableRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
+        }
+
+        if (![NSJSONSerialization isValidJSONObject:parameters]) {
+            if (error) {
+                NSDictionary *userInfo = @{NSLocalizedFailureReasonErrorKey: NSLocalizedStringFromTable(@"The `parameters` argument is not valid JSON.", @"AFNetworking", nil)};
+                *error = [[NSError alloc] initWithDomain:AFURLRequestSerializationErrorDomain code:NSURLErrorCannotDecodeContentData userInfo:userInfo];
+            }
+            return nil;
+        }
+
+        NSData *jsonData = [NSJSONSerialization dataWithJSONObject:parameters options:self.writingOptions error:error];
+        
+        if (!jsonData) {
+            return nil;
+        }
+        
+        [mutableRequest setHTTPBody:jsonData];
+    }
+
+    return mutableRequest;
+}
+
+#pragma mark - NSSecureCoding
+
+- (instancetype)initWithCoder:(NSCoder *)decoder {
+    self = [super initWithCoder:decoder];
+    if (!self) {
+        return nil;
+    }
+
+    self.writingOptions = [[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(writingOptions))] unsignedIntegerValue];
+
+    return self;
+}
+
+- (void)encodeWithCoder:(NSCoder *)coder {
+    [super encodeWithCoder:coder];
+
+    [coder encodeObject:@(self.writingOptions) forKey:NSStringFromSelector(@selector(writingOptions))];
+}
+
+#pragma mark - NSCopying
+
+- (instancetype)copyWithZone:(NSZone *)zone {
+    AFJSONRequestSerializer *serializer = [super copyWithZone:zone];
+    serializer.writingOptions = self.writingOptions;
+
+    return serializer;
+}
+
+@end
+
+#pragma mark -
+
+@implementation AFPropertyListRequestSerializer
+
++ (instancetype)serializer {
+    return [self serializerWithFormat:NSPropertyListXMLFormat_v1_0 writeOptions:0];
+}
+
++ (instancetype)serializerWithFormat:(NSPropertyListFormat)format
+                        writeOptions:(NSPropertyListWriteOptions)writeOptions
+{
+    AFPropertyListRequestSerializer *serializer = [[self alloc] init];
+    serializer.format = format;
+    serializer.writeOptions = writeOptions;
+
+    return serializer;
+}
+
+#pragma mark - AFURLRequestSerializer
+
+- (NSURLRequest *)requestBySerializingRequest:(NSURLRequest *)request
+                               withParameters:(id)parameters
+                                        error:(NSError *__autoreleasing *)error
+{
+    NSParameterAssert(request);
+
+    if ([self.HTTPMethodsEncodingParametersInURI containsObject:[[request HTTPMethod] uppercaseString]]) {
+        return [super requestBySerializingRequest:request withParameters:parameters error:error];
+    }
+
+    NSMutableURLRequest *mutableRequest = [request mutableCopy];
+
+    [self.HTTPRequestHeaders enumerateKeysAndObjectsUsingBlock:^(id field, id value, BOOL * __unused stop) {
+        if (![request valueForHTTPHeaderField:field]) {
+            [mutableRequest setValue:value forHTTPHeaderField:field];
+        }
+    }];
+
+    if (parameters) {
+        if (![mutableRequest valueForHTTPHeaderField:@"Content-Type"]) {
+            [mutableRequest setValue:@"application/x-plist" forHTTPHeaderField:@"Content-Type"];
+        }
+
+        NSData *plistData = [NSPropertyListSerialization dataWithPropertyList:parameters format:self.format options:self.writeOptions error:error];
+        
+        if (!plistData) {
+            return nil;
+        }
+        
+        [mutableRequest setHTTPBody:plistData];
+    }
+
+    return mutableRequest;
+}
+
+#pragma mark - NSSecureCoding
+
+- (instancetype)initWithCoder:(NSCoder *)decoder {
+    self = [super initWithCoder:decoder];
+    if (!self) {
+        return nil;
+    }
+
+    self.format = (NSPropertyListFormat)[[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(format))] unsignedIntegerValue];
+    self.writeOptions = [[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(writeOptions))] unsignedIntegerValue];
+
+    return self;
+}
+
+- (void)encodeWithCoder:(NSCoder *)coder {
+    [super encodeWithCoder:coder];
+
+    [coder encodeObject:@(self.format) forKey:NSStringFromSelector(@selector(format))];
+    [coder encodeObject:@(self.writeOptions) forKey:NSStringFromSelector(@selector(writeOptions))];
+}
+
+#pragma mark - NSCopying
+
+- (instancetype)copyWithZone:(NSZone *)zone {
+    AFPropertyListRequestSerializer *serializer = [super copyWithZone:zone];
+    serializer.format = self.format;
+    serializer.writeOptions = self.writeOptions;
+
+    return serializer;
+}
+
+@end

+ 313 - 0
Pods/AFNetworking/AFNetworking/AFURLResponseSerialization.h

@@ -0,0 +1,313 @@
+// AFURLResponseSerialization.h
+// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import <Foundation/Foundation.h>
+#import <CoreGraphics/CoreGraphics.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+/**
+ Recursively removes `NSNull` values from a JSON object.
+*/
+FOUNDATION_EXPORT id AFJSONObjectByRemovingKeysWithNullValues(id JSONObject, NSJSONReadingOptions readingOptions);
+
+/**
+ The `AFURLResponseSerialization` protocol is adopted by an object that decodes data into a more useful object representation, according to details in the server response. Response serializers may additionally perform validation on the incoming response and data.
+
+ For example, a JSON response serializer may check for an acceptable status code (`2XX` range) and content type (`application/json`), decoding a valid JSON response into an object.
+ */
+@protocol AFURLResponseSerialization <NSObject, NSSecureCoding, NSCopying>
+
+/**
+ The response object decoded from the data associated with a specified response.
+
+ @param response The response to be processed.
+ @param data The response data to be decoded.
+ @param error The error that occurred while attempting to decode the response data.
+
+ @return The object decoded from the specified response data.
+ */
+- (nullable id)responseObjectForResponse:(nullable NSURLResponse *)response
+                           data:(nullable NSData *)data
+                          error:(NSError * _Nullable __autoreleasing *)error NS_SWIFT_NOTHROW;
+
+@end
+
+#pragma mark -
+
+/**
+ `AFHTTPResponseSerializer` conforms to the `AFURLRequestSerialization` & `AFURLResponseSerialization` protocols, offering a concrete base implementation of query string / URL form-encoded parameter serialization and default request headers, as well as response status code and content type validation.
+
+ Any request or response serializer dealing with HTTP is encouraged to subclass `AFHTTPResponseSerializer` in order to ensure consistent default behavior.
+ */
+@interface AFHTTPResponseSerializer : NSObject <AFURLResponseSerialization>
+
+- (instancetype)init;
+
+/**
+ Creates and returns a serializer with default configuration.
+ */
++ (instancetype)serializer;
+
+///-----------------------------------------
+/// @name Configuring Response Serialization
+///-----------------------------------------
+
+/**
+ The acceptable HTTP status codes for responses. When non-`nil`, responses with status codes not contained by the set will result in an error during validation.
+
+ See http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
+ */
+@property (nonatomic, copy, nullable) NSIndexSet *acceptableStatusCodes;
+
+/**
+ The acceptable MIME types for responses. When non-`nil`, responses with a `Content-Type` with MIME types that do not intersect with the set will result in an error during validation.
+ */
+@property (nonatomic, copy, nullable) NSSet <NSString *> *acceptableContentTypes;
+
+/**
+ Validates the specified response and data.
+
+ In its base implementation, this method checks for an acceptable status code and content type. Subclasses may wish to add other domain-specific checks.
+
+ @param response The response to be validated.
+ @param data The data associated with the response.
+ @param error The error that occurred while attempting to validate the response.
+
+ @return `YES` if the response is valid, otherwise `NO`.
+ */
+- (BOOL)validateResponse:(nullable NSHTTPURLResponse *)response
+                    data:(nullable NSData *)data
+                   error:(NSError * _Nullable __autoreleasing *)error;
+
+@end
+
+#pragma mark -
+
+
+/**
+ `AFJSONResponseSerializer` is a subclass of `AFHTTPResponseSerializer` that validates and decodes JSON responses.
+
+ By default, `AFJSONResponseSerializer` accepts the following MIME types, which includes the official standard, `application/json`, as well as other commonly-used types:
+
+ - `application/json`
+ - `text/json`
+ - `text/javascript`
+
+ In RFC 7159 - Section 8.1, it states that JSON text is required to be encoded in UTF-8, UTF-16, or UTF-32, and the default encoding is UTF-8. NSJSONSerialization provides support for all the encodings listed in the specification, and recommends UTF-8 for efficiency. Using an unsupported encoding will result in serialization error. See the `NSJSONSerialization` documentation for more details.
+ */
+@interface AFJSONResponseSerializer : AFHTTPResponseSerializer
+
+- (instancetype)init;
+
+/**
+ Options for reading the response JSON data and creating the Foundation objects. For possible values, see the `NSJSONSerialization` documentation section "NSJSONReadingOptions". `0` by default.
+ */
+@property (nonatomic, assign) NSJSONReadingOptions readingOptions;
+
+/**
+ Whether to remove keys with `NSNull` values from response JSON. Defaults to `NO`.
+ */
+@property (nonatomic, assign) BOOL removesKeysWithNullValues;
+
+/**
+ Creates and returns a JSON serializer with specified reading and writing options.
+
+ @param readingOptions The specified JSON reading options.
+ */
++ (instancetype)serializerWithReadingOptions:(NSJSONReadingOptions)readingOptions;
+
+@end
+
+#pragma mark -
+
+/**
+ `AFXMLParserResponseSerializer` is a subclass of `AFHTTPResponseSerializer` that validates and decodes XML responses as an `NSXMLParser` objects.
+
+ By default, `AFXMLParserResponseSerializer` accepts the following MIME types, which includes the official standard, `application/xml`, as well as other commonly-used types:
+
+ - `application/xml`
+ - `text/xml`
+ */
+@interface AFXMLParserResponseSerializer : AFHTTPResponseSerializer
+
+@end
+
+#pragma mark -
+
+#ifdef __MAC_OS_X_VERSION_MIN_REQUIRED
+
+/**
+ `AFXMLDocumentResponseSerializer` is a subclass of `AFHTTPResponseSerializer` that validates and decodes XML responses as an `NSXMLDocument` objects.
+
+ By default, `AFXMLDocumentResponseSerializer` accepts the following MIME types, which includes the official standard, `application/xml`, as well as other commonly-used types:
+
+ - `application/xml`
+ - `text/xml`
+ */
+@interface AFXMLDocumentResponseSerializer : AFHTTPResponseSerializer
+
+- (instancetype)init;
+
+/**
+ Input and output options specifically intended for `NSXMLDocument` objects. For possible values, see the `NSXMLDocument` documentation section "Input and Output Options". `0` by default.
+ */
+@property (nonatomic, assign) NSUInteger options;
+
+/**
+ Creates and returns an XML document serializer with the specified options.
+
+ @param mask The XML document options.
+ */
++ (instancetype)serializerWithXMLDocumentOptions:(NSUInteger)mask;
+
+@end
+
+#endif
+
+#pragma mark -
+
+/**
+ `AFPropertyListResponseSerializer` is a subclass of `AFHTTPResponseSerializer` that validates and decodes XML responses as an `NSXMLDocument` objects.
+
+ By default, `AFPropertyListResponseSerializer` accepts the following MIME types:
+
+ - `application/x-plist`
+ */
+@interface AFPropertyListResponseSerializer : AFHTTPResponseSerializer
+
+- (instancetype)init;
+
+/**
+ The property list format. Possible values are described in "NSPropertyListFormat".
+ */
+@property (nonatomic, assign) NSPropertyListFormat format;
+
+/**
+ The property list reading options. Possible values are described in "NSPropertyListMutabilityOptions."
+ */
+@property (nonatomic, assign) NSPropertyListReadOptions readOptions;
+
+/**
+ Creates and returns a property list serializer with a specified format, read options, and write options.
+
+ @param format The property list format.
+ @param readOptions The property list reading options.
+ */
++ (instancetype)serializerWithFormat:(NSPropertyListFormat)format
+                         readOptions:(NSPropertyListReadOptions)readOptions;
+
+@end
+
+#pragma mark -
+
+/**
+ `AFImageResponseSerializer` is a subclass of `AFHTTPResponseSerializer` that validates and decodes image responses.
+
+ By default, `AFImageResponseSerializer` accepts the following MIME types, which correspond to the image formats supported by UIImage or NSImage:
+
+ - `image/tiff`
+ - `image/jpeg`
+ - `image/gif`
+ - `image/png`
+ - `image/ico`
+ - `image/x-icon`
+ - `image/bmp`
+ - `image/x-bmp`
+ - `image/x-xbitmap`
+ - `image/x-win-bitmap`
+ */
+@interface AFImageResponseSerializer : AFHTTPResponseSerializer
+
+#if TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_WATCH
+/**
+ The scale factor used when interpreting the image data to construct `responseImage`. Specifying a scale factor of 1.0 results in an image whose size matches the pixel-based dimensions of the image. Applying a different scale factor changes the size of the image as reported by the size property. This is set to the value of scale of the main screen by default, which automatically scales images for retina displays, for instance.
+ */
+@property (nonatomic, assign) CGFloat imageScale;
+
+/**
+ Whether to automatically inflate response image data for compressed formats (such as PNG or JPEG). Enabling this can significantly improve drawing performance on iOS when used with `setCompletionBlockWithSuccess:failure:`, as it allows a bitmap representation to be constructed in the background rather than on the main thread. `YES` by default.
+ */
+@property (nonatomic, assign) BOOL automaticallyInflatesResponseImage;
+#endif
+
+@end
+
+#pragma mark -
+
+/**
+ `AFCompoundSerializer` is a subclass of `AFHTTPResponseSerializer` that delegates the response serialization to the first `AFHTTPResponseSerializer` object that returns an object for `responseObjectForResponse:data:error:`, falling back on the default behavior of `AFHTTPResponseSerializer`. This is useful for supporting multiple potential types and structures of server responses with a single serializer.
+ */
+@interface AFCompoundResponseSerializer : AFHTTPResponseSerializer
+
+/**
+ The component response serializers.
+ */
+@property (readonly, nonatomic, copy) NSArray <id<AFURLResponseSerialization>> *responseSerializers;
+
+/**
+ Creates and returns a compound serializer comprised of the specified response serializers.
+
+ @warning Each response serializer specified must be a subclass of `AFHTTPResponseSerializer`, and response to `-validateResponse:data:error:`.
+ */
++ (instancetype)compoundSerializerWithResponseSerializers:(NSArray <id<AFURLResponseSerialization>> *)responseSerializers;
+
+@end
+
+///----------------
+/// @name Constants
+///----------------
+
+/**
+ ## Error Domains
+
+ The following error domain is predefined.
+
+ - `NSString * const AFURLResponseSerializationErrorDomain`
+
+ ### Constants
+
+ `AFURLResponseSerializationErrorDomain`
+ AFURLResponseSerializer errors. Error codes for `AFURLResponseSerializationErrorDomain` correspond to codes in `NSURLErrorDomain`.
+ */
+FOUNDATION_EXPORT NSString * const AFURLResponseSerializationErrorDomain;
+
+/**
+ ## User info dictionary keys
+
+ These keys may exist in the user info dictionary, in addition to those defined for NSError.
+
+ - `NSString * const AFNetworkingOperationFailingURLResponseErrorKey`
+ - `NSString * const AFNetworkingOperationFailingURLResponseDataErrorKey`
+
+ ### Constants
+
+ `AFNetworkingOperationFailingURLResponseErrorKey`
+ The corresponding value is an `NSURLResponse` containing the response of the operation associated with an error. This key is only present in the `AFURLResponseSerializationErrorDomain`.
+
+ `AFNetworkingOperationFailingURLResponseDataErrorKey`
+ The corresponding value is an `NSData` containing the original data of the operation associated with an error. This key is only present in the `AFURLResponseSerializationErrorDomain`.
+ */
+FOUNDATION_EXPORT NSString * const AFNetworkingOperationFailingURLResponseErrorKey;
+
+FOUNDATION_EXPORT NSString * const AFNetworkingOperationFailingURLResponseDataErrorKey;
+
+NS_ASSUME_NONNULL_END

+ 836 - 0
Pods/AFNetworking/AFNetworking/AFURLResponseSerialization.m

@@ -0,0 +1,836 @@
+// AFURLResponseSerialization.m
+// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import "AFURLResponseSerialization.h"
+
+#import <TargetConditionals.h>
+
+#if TARGET_OS_IOS
+#import <UIKit/UIKit.h>
+#elif TARGET_OS_WATCH
+#import <WatchKit/WatchKit.h>
+#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
+#import <Cocoa/Cocoa.h>
+#endif
+
+NSString * const AFURLResponseSerializationErrorDomain = @"com.alamofire.error.serialization.response";
+NSString * const AFNetworkingOperationFailingURLResponseErrorKey = @"com.alamofire.serialization.response.error.response";
+NSString * const AFNetworkingOperationFailingURLResponseDataErrorKey = @"com.alamofire.serialization.response.error.data";
+
+static NSError * AFErrorWithUnderlyingError(NSError *error, NSError *underlyingError) {
+    if (!error) {
+        return underlyingError;
+    }
+
+    if (!underlyingError || error.userInfo[NSUnderlyingErrorKey]) {
+        return error;
+    }
+
+    NSMutableDictionary *mutableUserInfo = [error.userInfo mutableCopy];
+    mutableUserInfo[NSUnderlyingErrorKey] = underlyingError;
+
+    return [[NSError alloc] initWithDomain:error.domain code:error.code userInfo:mutableUserInfo];
+}
+
+static BOOL AFErrorOrUnderlyingErrorHasCodeInDomain(NSError *error, NSInteger code, NSString *domain) {
+    if ([error.domain isEqualToString:domain] && error.code == code) {
+        return YES;
+    } else if (error.userInfo[NSUnderlyingErrorKey]) {
+        return AFErrorOrUnderlyingErrorHasCodeInDomain(error.userInfo[NSUnderlyingErrorKey], code, domain);
+    }
+
+    return NO;
+}
+
+id AFJSONObjectByRemovingKeysWithNullValues(id JSONObject, NSJSONReadingOptions readingOptions) {
+    if ([JSONObject isKindOfClass:[NSArray class]]) {
+        NSMutableArray *mutableArray = [NSMutableArray arrayWithCapacity:[(NSArray *)JSONObject count]];
+        for (id value in (NSArray *)JSONObject) {
+            if (![value isEqual:[NSNull null]]) {
+                [mutableArray addObject:AFJSONObjectByRemovingKeysWithNullValues(value, readingOptions)];
+            }
+        }
+
+        return (readingOptions & NSJSONReadingMutableContainers) ? mutableArray : [NSArray arrayWithArray:mutableArray];
+    } else if ([JSONObject isKindOfClass:[NSDictionary class]]) {
+        NSMutableDictionary *mutableDictionary = [NSMutableDictionary dictionaryWithDictionary:JSONObject];
+        for (id <NSCopying> key in [(NSDictionary *)JSONObject allKeys]) {
+            id value = (NSDictionary *)JSONObject[key];
+            if (!value || [value isEqual:[NSNull null]]) {
+                [mutableDictionary removeObjectForKey:key];
+            } else if ([value isKindOfClass:[NSArray class]] || [value isKindOfClass:[NSDictionary class]]) {
+                mutableDictionary[key] = AFJSONObjectByRemovingKeysWithNullValues(value, readingOptions);
+            }
+        }
+
+        return (readingOptions & NSJSONReadingMutableContainers) ? mutableDictionary : [NSDictionary dictionaryWithDictionary:mutableDictionary];
+    }
+
+    return JSONObject;
+}
+
+@implementation AFHTTPResponseSerializer
+
++ (instancetype)serializer {
+    return [[self alloc] init];
+}
+
+- (instancetype)init {
+    self = [super init];
+    if (!self) {
+        return nil;
+    }
+
+    self.acceptableStatusCodes = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(200, 100)];
+    self.acceptableContentTypes = nil;
+
+    return self;
+}
+
+#pragma mark -
+
+- (BOOL)validateResponse:(NSHTTPURLResponse *)response
+                    data:(NSData *)data
+                   error:(NSError * __autoreleasing *)error
+{
+    BOOL responseIsValid = YES;
+    NSError *validationError = nil;
+
+    if ([response isKindOfClass:[NSHTTPURLResponse class]]) {
+        if (self.acceptableContentTypes && ![self.acceptableContentTypes containsObject:[response MIMEType]] &&
+            !([response MIMEType] == nil && [data length] == 0)) {
+
+            if ([data length] > 0 && [response URL]) {
+                NSMutableDictionary *mutableUserInfo = [@{
+                                                          NSLocalizedDescriptionKey: [NSString stringWithFormat:NSLocalizedStringFromTable(@"Request failed: unacceptable content-type: %@", @"AFNetworking", nil), [response MIMEType]],
+                                                          NSURLErrorFailingURLErrorKey:[response URL],
+                                                          AFNetworkingOperationFailingURLResponseErrorKey: response,
+                                                        } mutableCopy];
+                if (data) {
+                    mutableUserInfo[AFNetworkingOperationFailingURLResponseDataErrorKey] = data;
+                }
+
+                validationError = AFErrorWithUnderlyingError([NSError errorWithDomain:AFURLResponseSerializationErrorDomain code:NSURLErrorCannotDecodeContentData userInfo:mutableUserInfo], validationError);
+            }
+
+            responseIsValid = NO;
+        }
+
+        if (self.acceptableStatusCodes && ![self.acceptableStatusCodes containsIndex:(NSUInteger)response.statusCode] && [response URL]) {
+            NSMutableDictionary *mutableUserInfo = [@{
+                                               NSLocalizedDescriptionKey: [NSString stringWithFormat:NSLocalizedStringFromTable(@"Request failed: %@ (%ld)", @"AFNetworking", nil), [NSHTTPURLResponse localizedStringForStatusCode:response.statusCode], (long)response.statusCode],
+                                               NSURLErrorFailingURLErrorKey:[response URL],
+                                               AFNetworkingOperationFailingURLResponseErrorKey: response,
+                                       } mutableCopy];
+
+            if (data) {
+                mutableUserInfo[AFNetworkingOperationFailingURLResponseDataErrorKey] = data;
+            }
+
+            validationError = AFErrorWithUnderlyingError([NSError errorWithDomain:AFURLResponseSerializationErrorDomain code:NSURLErrorBadServerResponse userInfo:mutableUserInfo], validationError);
+
+            responseIsValid = NO;
+        }
+    }
+
+    if (error && !responseIsValid) {
+        *error = validationError;
+    }
+
+    return responseIsValid;
+}
+
+#pragma mark - AFURLResponseSerialization
+
+- (id)responseObjectForResponse:(NSURLResponse *)response
+                           data:(NSData *)data
+                          error:(NSError *__autoreleasing *)error
+{
+    [self validateResponse:(NSHTTPURLResponse *)response data:data error:error];
+
+    return data;
+}
+
+#pragma mark - NSSecureCoding
+
++ (BOOL)supportsSecureCoding {
+    return YES;
+}
+
+- (instancetype)initWithCoder:(NSCoder *)decoder {
+    self = [self init];
+    if (!self) {
+        return nil;
+    }
+
+    self.acceptableStatusCodes = [decoder decodeObjectOfClass:[NSIndexSet class] forKey:NSStringFromSelector(@selector(acceptableStatusCodes))];
+    self.acceptableContentTypes = [decoder decodeObjectOfClass:[NSSet class] forKey:NSStringFromSelector(@selector(acceptableContentTypes))];
+
+    return self;
+}
+
+- (void)encodeWithCoder:(NSCoder *)coder {
+    [coder encodeObject:self.acceptableStatusCodes forKey:NSStringFromSelector(@selector(acceptableStatusCodes))];
+    [coder encodeObject:self.acceptableContentTypes forKey:NSStringFromSelector(@selector(acceptableContentTypes))];
+}
+
+#pragma mark - NSCopying
+
+- (instancetype)copyWithZone:(NSZone *)zone {
+    AFHTTPResponseSerializer *serializer = [[[self class] allocWithZone:zone] init];
+    serializer.acceptableStatusCodes = [self.acceptableStatusCodes copyWithZone:zone];
+    serializer.acceptableContentTypes = [self.acceptableContentTypes copyWithZone:zone];
+
+    return serializer;
+}
+
+@end
+
+#pragma mark -
+
+@implementation AFJSONResponseSerializer
+
++ (instancetype)serializer {
+    return [self serializerWithReadingOptions:(NSJSONReadingOptions)0];
+}
+
++ (instancetype)serializerWithReadingOptions:(NSJSONReadingOptions)readingOptions {
+    AFJSONResponseSerializer *serializer = [[self alloc] init];
+    serializer.readingOptions = readingOptions;
+
+    return serializer;
+}
+
+- (instancetype)init {
+    self = [super init];
+    if (!self) {
+        return nil;
+    }
+
+    self.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/json", @"text/javascript", nil];
+
+    return self;
+}
+
+#pragma mark - AFURLResponseSerialization
+
+- (id)responseObjectForResponse:(NSURLResponse *)response
+                           data:(NSData *)data
+                          error:(NSError *__autoreleasing *)error
+{
+    if (![self validateResponse:(NSHTTPURLResponse *)response data:data error:error]) {
+        if (!error || AFErrorOrUnderlyingErrorHasCodeInDomain(*error, NSURLErrorCannotDecodeContentData, AFURLResponseSerializationErrorDomain)) {
+            return nil;
+        }
+    }
+
+    // Workaround for behavior of Rails to return a single space for `head :ok` (a workaround for a bug in Safari), which is not interpreted as valid input by NSJSONSerialization.
+    // See https://github.com/rails/rails/issues/1742
+    BOOL isSpace = [data isEqualToData:[NSData dataWithBytes:" " length:1]];
+    
+    if (data.length == 0 || isSpace) {
+        return nil;
+    }
+    
+    NSError *serializationError = nil;
+    
+    id responseObject = [NSJSONSerialization JSONObjectWithData:data options:self.readingOptions error:&serializationError];
+
+    if (!responseObject)
+    {
+        if (error) {
+            *error = AFErrorWithUnderlyingError(serializationError, *error);
+        }
+        return nil;
+    }
+    
+    if (self.removesKeysWithNullValues) {
+        return AFJSONObjectByRemovingKeysWithNullValues(responseObject, self.readingOptions);
+    }
+
+    return responseObject;
+}
+
+#pragma mark - NSSecureCoding
+
++ (BOOL)supportsSecureCoding {
+    return YES;
+}
+
+- (instancetype)initWithCoder:(NSCoder *)decoder {
+    self = [super initWithCoder:decoder];
+    if (!self) {
+        return nil;
+    }
+
+    self.readingOptions = [[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(readingOptions))] unsignedIntegerValue];
+    self.removesKeysWithNullValues = [[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(removesKeysWithNullValues))] boolValue];
+
+    return self;
+}
+
+- (void)encodeWithCoder:(NSCoder *)coder {
+    [super encodeWithCoder:coder];
+
+    [coder encodeObject:@(self.readingOptions) forKey:NSStringFromSelector(@selector(readingOptions))];
+    [coder encodeObject:@(self.removesKeysWithNullValues) forKey:NSStringFromSelector(@selector(removesKeysWithNullValues))];
+}
+
+#pragma mark - NSCopying
+
+- (instancetype)copyWithZone:(NSZone *)zone {
+    AFJSONResponseSerializer *serializer = [super copyWithZone:zone];
+    serializer.readingOptions = self.readingOptions;
+    serializer.removesKeysWithNullValues = self.removesKeysWithNullValues;
+
+    return serializer;
+}
+
+@end
+
+#pragma mark -
+
+@implementation AFXMLParserResponseSerializer
+
++ (instancetype)serializer {
+    AFXMLParserResponseSerializer *serializer = [[self alloc] init];
+
+    return serializer;
+}
+
+- (instancetype)init {
+    self = [super init];
+    if (!self) {
+        return nil;
+    }
+
+    self.acceptableContentTypes = [[NSSet alloc] initWithObjects:@"application/xml", @"text/xml", nil];
+
+    return self;
+}
+
+#pragma mark - AFURLResponseSerialization
+
+- (id)responseObjectForResponse:(NSHTTPURLResponse *)response
+                           data:(NSData *)data
+                          error:(NSError *__autoreleasing *)error
+{
+    if (![self validateResponse:(NSHTTPURLResponse *)response data:data error:error]) {
+        if (!error || AFErrorOrUnderlyingErrorHasCodeInDomain(*error, NSURLErrorCannotDecodeContentData, AFURLResponseSerializationErrorDomain)) {
+            return nil;
+        }
+    }
+
+    return [[NSXMLParser alloc] initWithData:data];
+}
+
+@end
+
+#pragma mark -
+
+#ifdef __MAC_OS_X_VERSION_MIN_REQUIRED
+
+@implementation AFXMLDocumentResponseSerializer
+
++ (instancetype)serializer {
+    return [self serializerWithXMLDocumentOptions:0];
+}
+
++ (instancetype)serializerWithXMLDocumentOptions:(NSUInteger)mask {
+    AFXMLDocumentResponseSerializer *serializer = [[self alloc] init];
+    serializer.options = mask;
+
+    return serializer;
+}
+
+- (instancetype)init {
+    self = [super init];
+    if (!self) {
+        return nil;
+    }
+
+    self.acceptableContentTypes = [[NSSet alloc] initWithObjects:@"application/xml", @"text/xml", nil];
+
+    return self;
+}
+
+#pragma mark - AFURLResponseSerialization
+
+- (id)responseObjectForResponse:(NSURLResponse *)response
+                           data:(NSData *)data
+                          error:(NSError *__autoreleasing *)error
+{
+    if (![self validateResponse:(NSHTTPURLResponse *)response data:data error:error]) {
+        if (!error || AFErrorOrUnderlyingErrorHasCodeInDomain(*error, NSURLErrorCannotDecodeContentData, AFURLResponseSerializationErrorDomain)) {
+            return nil;
+        }
+    }
+
+    NSError *serializationError = nil;
+    NSXMLDocument *document = [[NSXMLDocument alloc] initWithData:data options:self.options error:&serializationError];
+
+    if (!document)
+    {
+        if (error) {
+            *error = AFErrorWithUnderlyingError(serializationError, *error);
+        }
+        return nil;
+    }
+    
+    return document;
+}
+
+#pragma mark - NSSecureCoding
+
+- (instancetype)initWithCoder:(NSCoder *)decoder {
+    self = [super initWithCoder:decoder];
+    if (!self) {
+        return nil;
+    }
+
+    self.options = [[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(options))] unsignedIntegerValue];
+
+    return self;
+}
+
+- (void)encodeWithCoder:(NSCoder *)coder {
+    [super encodeWithCoder:coder];
+
+    [coder encodeObject:@(self.options) forKey:NSStringFromSelector(@selector(options))];
+}
+
+#pragma mark - NSCopying
+
+- (instancetype)copyWithZone:(NSZone *)zone {
+    AFXMLDocumentResponseSerializer *serializer = [super copyWithZone:zone];
+    serializer.options = self.options;
+
+    return serializer;
+}
+
+@end
+
+#endif
+
+#pragma mark -
+
+@implementation AFPropertyListResponseSerializer
+
++ (instancetype)serializer {
+    return [self serializerWithFormat:NSPropertyListXMLFormat_v1_0 readOptions:0];
+}
+
++ (instancetype)serializerWithFormat:(NSPropertyListFormat)format
+                         readOptions:(NSPropertyListReadOptions)readOptions
+{
+    AFPropertyListResponseSerializer *serializer = [[self alloc] init];
+    serializer.format = format;
+    serializer.readOptions = readOptions;
+
+    return serializer;
+}
+
+- (instancetype)init {
+    self = [super init];
+    if (!self) {
+        return nil;
+    }
+
+    self.acceptableContentTypes = [[NSSet alloc] initWithObjects:@"application/x-plist", nil];
+
+    return self;
+}
+
+#pragma mark - AFURLResponseSerialization
+
+- (id)responseObjectForResponse:(NSURLResponse *)response
+                           data:(NSData *)data
+                          error:(NSError *__autoreleasing *)error
+{
+    if (![self validateResponse:(NSHTTPURLResponse *)response data:data error:error]) {
+        if (!error || AFErrorOrUnderlyingErrorHasCodeInDomain(*error, NSURLErrorCannotDecodeContentData, AFURLResponseSerializationErrorDomain)) {
+            return nil;
+        }
+    }
+
+    if (!data) {
+        return nil;
+    }
+    
+    NSError *serializationError = nil;
+    
+    id responseObject = [NSPropertyListSerialization propertyListWithData:data options:self.readOptions format:NULL error:&serializationError];
+    
+    if (!responseObject)
+    {
+        if (error) {
+            *error = AFErrorWithUnderlyingError(serializationError, *error);
+        }
+        return nil;
+    }
+
+    return responseObject;
+}
+
+#pragma mark - NSSecureCoding
+
++ (BOOL)supportsSecureCoding {
+    return YES;
+}
+
+- (instancetype)initWithCoder:(NSCoder *)decoder {
+    self = [super initWithCoder:decoder];
+    if (!self) {
+        return nil;
+    }
+
+    self.format = (NSPropertyListFormat)[[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(format))] unsignedIntegerValue];
+    self.readOptions = [[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(readOptions))] unsignedIntegerValue];
+
+    return self;
+}
+
+- (void)encodeWithCoder:(NSCoder *)coder {
+    [super encodeWithCoder:coder];
+
+    [coder encodeObject:@(self.format) forKey:NSStringFromSelector(@selector(format))];
+    [coder encodeObject:@(self.readOptions) forKey:NSStringFromSelector(@selector(readOptions))];
+}
+
+#pragma mark - NSCopying
+
+- (instancetype)copyWithZone:(NSZone *)zone {
+    AFPropertyListResponseSerializer *serializer = [super copyWithZone:zone];
+    serializer.format = self.format;
+    serializer.readOptions = self.readOptions;
+
+    return serializer;
+}
+
+@end
+
+#pragma mark -
+
+#if TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_WATCH
+#import <CoreGraphics/CoreGraphics.h>
+#import <UIKit/UIKit.h>
+
+@interface UIImage (AFNetworkingSafeImageLoading)
++ (UIImage *)af_safeImageWithData:(NSData *)data;
+@end
+
+static NSLock* imageLock = nil;
+
+@implementation UIImage (AFNetworkingSafeImageLoading)
+
++ (UIImage *)af_safeImageWithData:(NSData *)data {
+    UIImage* image = nil;
+    static dispatch_once_t onceToken;
+    dispatch_once(&onceToken, ^{
+        imageLock = [[NSLock alloc] init];
+    });
+    
+    [imageLock lock];
+    image = [UIImage imageWithData:data];
+    [imageLock unlock];
+    return image;
+}
+
+@end
+
+static UIImage * AFImageWithDataAtScale(NSData *data, CGFloat scale) {
+    UIImage *image = [UIImage af_safeImageWithData:data];
+    if (image.images) {
+        return image;
+    }
+    
+    return [[UIImage alloc] initWithCGImage:[image CGImage] scale:scale orientation:image.imageOrientation];
+}
+
+static UIImage * AFInflatedImageFromResponseWithDataAtScale(NSHTTPURLResponse *response, NSData *data, CGFloat scale) {
+    if (!data || [data length] == 0) {
+        return nil;
+    }
+
+    CGImageRef imageRef = NULL;
+    CGDataProviderRef dataProvider = CGDataProviderCreateWithCFData((__bridge CFDataRef)data);
+
+    if ([response.MIMEType isEqualToString:@"image/png"]) {
+        imageRef = CGImageCreateWithPNGDataProvider(dataProvider,  NULL, true, kCGRenderingIntentDefault);
+    } else if ([response.MIMEType isEqualToString:@"image/jpeg"]) {
+        imageRef = CGImageCreateWithJPEGDataProvider(dataProvider, NULL, true, kCGRenderingIntentDefault);
+
+        if (imageRef) {
+            CGColorSpaceRef imageColorSpace = CGImageGetColorSpace(imageRef);
+            CGColorSpaceModel imageColorSpaceModel = CGColorSpaceGetModel(imageColorSpace);
+
+            // CGImageCreateWithJPEGDataProvider does not properly handle CMKY, so fall back to AFImageWithDataAtScale
+            if (imageColorSpaceModel == kCGColorSpaceModelCMYK) {
+                CGImageRelease(imageRef);
+                imageRef = NULL;
+            }
+        }
+    }
+
+    CGDataProviderRelease(dataProvider);
+
+    UIImage *image = AFImageWithDataAtScale(data, scale);
+    if (!imageRef) {
+        if (image.images || !image) {
+            return image;
+        }
+
+        imageRef = CGImageCreateCopy([image CGImage]);
+        if (!imageRef) {
+            return nil;
+        }
+    }
+
+    size_t width = CGImageGetWidth(imageRef);
+    size_t height = CGImageGetHeight(imageRef);
+    size_t bitsPerComponent = CGImageGetBitsPerComponent(imageRef);
+
+    if (width * height > 1024 * 1024 || bitsPerComponent > 8) {
+        CGImageRelease(imageRef);
+
+        return image;
+    }
+
+    // CGImageGetBytesPerRow() calculates incorrectly in iOS 5.0, so defer to CGBitmapContextCreate
+    size_t bytesPerRow = 0;
+    CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
+    CGColorSpaceModel colorSpaceModel = CGColorSpaceGetModel(colorSpace);
+    CGBitmapInfo bitmapInfo = CGImageGetBitmapInfo(imageRef);
+
+    if (colorSpaceModel == kCGColorSpaceModelRGB) {
+        uint32_t alpha = (bitmapInfo & kCGBitmapAlphaInfoMask);
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wassign-enum"
+        if (alpha == kCGImageAlphaNone) {
+            bitmapInfo &= ~kCGBitmapAlphaInfoMask;
+            bitmapInfo |= kCGImageAlphaNoneSkipFirst;
+        } else if (!(alpha == kCGImageAlphaNoneSkipFirst || alpha == kCGImageAlphaNoneSkipLast)) {
+            bitmapInfo &= ~kCGBitmapAlphaInfoMask;
+            bitmapInfo |= kCGImageAlphaPremultipliedFirst;
+        }
+#pragma clang diagnostic pop
+    }
+
+    CGContextRef context = CGBitmapContextCreate(NULL, width, height, bitsPerComponent, bytesPerRow, colorSpace, bitmapInfo);
+
+    CGColorSpaceRelease(colorSpace);
+
+    if (!context) {
+        CGImageRelease(imageRef);
+
+        return image;
+    }
+
+    CGContextDrawImage(context, CGRectMake(0.0f, 0.0f, width, height), imageRef);
+    CGImageRef inflatedImageRef = CGBitmapContextCreateImage(context);
+
+    CGContextRelease(context);
+
+    UIImage *inflatedImage = [[UIImage alloc] initWithCGImage:inflatedImageRef scale:scale orientation:image.imageOrientation];
+
+    CGImageRelease(inflatedImageRef);
+    CGImageRelease(imageRef);
+
+    return inflatedImage;
+}
+#endif
+
+
+@implementation AFImageResponseSerializer
+
+- (instancetype)init {
+    self = [super init];
+    if (!self) {
+        return nil;
+    }
+
+    self.acceptableContentTypes = [[NSSet alloc] initWithObjects:@"image/tiff", @"image/jpeg", @"image/gif", @"image/png", @"image/ico", @"image/x-icon", @"image/bmp", @"image/x-bmp", @"image/x-xbitmap", @"image/x-win-bitmap", nil];
+
+#if TARGET_OS_IOS || TARGET_OS_TV
+    self.imageScale = [[UIScreen mainScreen] scale];
+    self.automaticallyInflatesResponseImage = YES;
+#elif TARGET_OS_WATCH
+    self.imageScale = [[WKInterfaceDevice currentDevice] screenScale];
+    self.automaticallyInflatesResponseImage = YES;
+#endif
+
+    return self;
+}
+
+#pragma mark - AFURLResponseSerializer
+
+- (id)responseObjectForResponse:(NSURLResponse *)response
+                           data:(NSData *)data
+                          error:(NSError *__autoreleasing *)error
+{
+    if (![self validateResponse:(NSHTTPURLResponse *)response data:data error:error]) {
+        if (!error || AFErrorOrUnderlyingErrorHasCodeInDomain(*error, NSURLErrorCannotDecodeContentData, AFURLResponseSerializationErrorDomain)) {
+            return nil;
+        }
+    }
+
+#if TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_WATCH
+    if (self.automaticallyInflatesResponseImage) {
+        return AFInflatedImageFromResponseWithDataAtScale((NSHTTPURLResponse *)response, data, self.imageScale);
+    } else {
+        return AFImageWithDataAtScale(data, self.imageScale);
+    }
+#else
+    // Ensure that the image is set to it's correct pixel width and height
+    NSBitmapImageRep *bitimage = [[NSBitmapImageRep alloc] initWithData:data];
+    NSImage *image = [[NSImage alloc] initWithSize:NSMakeSize([bitimage pixelsWide], [bitimage pixelsHigh])];
+    [image addRepresentation:bitimage];
+
+    return image;
+#endif
+
+    return nil;
+}
+
+#pragma mark - NSSecureCoding
+
++ (BOOL)supportsSecureCoding {
+    return YES;
+}
+
+- (instancetype)initWithCoder:(NSCoder *)decoder {
+    self = [super initWithCoder:decoder];
+    if (!self) {
+        return nil;
+    }
+
+#if TARGET_OS_IOS  || TARGET_OS_TV || TARGET_OS_WATCH
+    NSNumber *imageScale = [decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(imageScale))];
+#if CGFLOAT_IS_DOUBLE
+    self.imageScale = [imageScale doubleValue];
+#else
+    self.imageScale = [imageScale floatValue];
+#endif
+
+    self.automaticallyInflatesResponseImage = [decoder decodeBoolForKey:NSStringFromSelector(@selector(automaticallyInflatesResponseImage))];
+#endif
+
+    return self;
+}
+
+- (void)encodeWithCoder:(NSCoder *)coder {
+    [super encodeWithCoder:coder];
+
+#if TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_WATCH
+    [coder encodeObject:@(self.imageScale) forKey:NSStringFromSelector(@selector(imageScale))];
+    [coder encodeBool:self.automaticallyInflatesResponseImage forKey:NSStringFromSelector(@selector(automaticallyInflatesResponseImage))];
+#endif
+}
+
+#pragma mark - NSCopying
+
+- (instancetype)copyWithZone:(NSZone *)zone {
+    AFImageResponseSerializer *serializer = [super copyWithZone:zone];
+
+#if TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_WATCH
+    serializer.imageScale = self.imageScale;
+    serializer.automaticallyInflatesResponseImage = self.automaticallyInflatesResponseImage;
+#endif
+
+    return serializer;
+}
+
+@end
+
+#pragma mark -
+
+@interface AFCompoundResponseSerializer ()
+@property (readwrite, nonatomic, copy) NSArray *responseSerializers;
+@end
+
+@implementation AFCompoundResponseSerializer
+
++ (instancetype)compoundSerializerWithResponseSerializers:(NSArray *)responseSerializers {
+    AFCompoundResponseSerializer *serializer = [[self alloc] init];
+    serializer.responseSerializers = responseSerializers;
+
+    return serializer;
+}
+
+#pragma mark - AFURLResponseSerialization
+
+- (id)responseObjectForResponse:(NSURLResponse *)response
+                           data:(NSData *)data
+                          error:(NSError *__autoreleasing *)error
+{
+    for (id <AFURLResponseSerialization> serializer in self.responseSerializers) {
+        if (![serializer isKindOfClass:[AFHTTPResponseSerializer class]]) {
+            continue;
+        }
+
+        NSError *serializerError = nil;
+        id responseObject = [serializer responseObjectForResponse:response data:data error:&serializerError];
+        if (responseObject) {
+            if (error) {
+                *error = AFErrorWithUnderlyingError(serializerError, *error);
+            }
+
+            return responseObject;
+        }
+    }
+
+    return [super responseObjectForResponse:response data:data error:error];
+}
+
+#pragma mark - NSSecureCoding
+
++ (BOOL)supportsSecureCoding {
+    return YES;
+}
+
+- (instancetype)initWithCoder:(NSCoder *)decoder {
+    self = [super initWithCoder:decoder];
+    if (!self) {
+        return nil;
+    }
+
+    NSSet *classes = [NSSet setWithArray:@[[NSArray class], [AFHTTPResponseSerializer <AFURLResponseSerialization> class]]];
+    self.responseSerializers = [decoder decodeObjectOfClasses:classes forKey:NSStringFromSelector(@selector(responseSerializers))];
+
+    return self;
+}
+
+- (void)encodeWithCoder:(NSCoder *)coder {
+    [super encodeWithCoder:coder];
+
+    [coder encodeObject:self.responseSerializers forKey:NSStringFromSelector(@selector(responseSerializers))];
+}
+
+#pragma mark - NSCopying
+
+- (instancetype)copyWithZone:(NSZone *)zone {
+    AFCompoundResponseSerializer *serializer = [super copyWithZone:zone];
+    serializer.responseSerializers = self.responseSerializers;
+
+    return serializer;
+}
+
+@end

+ 516 - 0
Pods/AFNetworking/AFNetworking/AFURLSessionManager.h

@@ -0,0 +1,516 @@
+// AFURLSessionManager.h
+// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+
+#import <Foundation/Foundation.h>
+
+#import "AFURLResponseSerialization.h"
+#import "AFURLRequestSerialization.h"
+#import "AFSecurityPolicy.h"
+#import "AFCompatibilityMacros.h"
+#if !TARGET_OS_WATCH
+#import "AFNetworkReachabilityManager.h"
+#endif
+
+/**
+ `AFURLSessionManager` creates and manages an `NSURLSession` object based on a specified `NSURLSessionConfiguration` object, which conforms to `<NSURLSessionTaskDelegate>`, `<NSURLSessionDataDelegate>`, `<NSURLSessionDownloadDelegate>`, and `<NSURLSessionDelegate>`.
+
+ ## Subclassing Notes
+
+ This is the base class for `AFHTTPSessionManager`, which adds functionality specific to making HTTP requests. If you are looking to extend `AFURLSessionManager` specifically for HTTP, consider subclassing `AFHTTPSessionManager` instead.
+
+ ## NSURLSession & NSURLSessionTask Delegate Methods
+
+ `AFURLSessionManager` implements the following delegate methods:
+
+ ### `NSURLSessionDelegate`
+
+ - `URLSession:didBecomeInvalidWithError:`
+ - `URLSession:didReceiveChallenge:completionHandler:`
+ - `URLSessionDidFinishEventsForBackgroundURLSession:`
+
+ ### `NSURLSessionTaskDelegate`
+
+ - `URLSession:willPerformHTTPRedirection:newRequest:completionHandler:`
+ - `URLSession:task:didReceiveChallenge:completionHandler:`
+ - `URLSession:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:`
+ - `URLSession:task:needNewBodyStream:`
+ - `URLSession:task:didCompleteWithError:`
+
+ ### `NSURLSessionDataDelegate`
+
+ - `URLSession:dataTask:didReceiveResponse:completionHandler:`
+ - `URLSession:dataTask:didBecomeDownloadTask:`
+ - `URLSession:dataTask:didReceiveData:`
+ - `URLSession:dataTask:willCacheResponse:completionHandler:`
+
+ ### `NSURLSessionDownloadDelegate`
+
+ - `URLSession:downloadTask:didFinishDownloadingToURL:`
+ - `URLSession:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:`
+ - `URLSession:downloadTask:didResumeAtOffset:expectedTotalBytes:`
+
+ If any of these methods are overridden in a subclass, they _must_ call the `super` implementation first.
+
+ ## Network Reachability Monitoring
+
+ Network reachability status and change monitoring is available through the `reachabilityManager` property. Applications may choose to monitor network reachability conditions in order to prevent or suspend any outbound requests. See `AFNetworkReachabilityManager` for more details.
+
+ ## NSCoding Caveats
+
+ - Encoded managers do not include any block properties. Be sure to set delegate callback blocks when using `-initWithCoder:` or `NSKeyedUnarchiver`.
+
+ ## NSCopying Caveats
+
+ - `-copy` and `-copyWithZone:` return a new manager with a new `NSURLSession` created from the configuration of the original.
+ - Operation copies do not include any delegate callback blocks, as they often strongly captures a reference to `self`, which would otherwise have the unintuitive side-effect of pointing to the _original_ session manager when copied.
+
+ @warning Managers for background sessions must be owned for the duration of their use. This can be accomplished by creating an application-wide or shared singleton instance.
+ */
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface AFURLSessionManager : NSObject <NSURLSessionDelegate, NSURLSessionTaskDelegate, NSURLSessionDataDelegate, NSURLSessionDownloadDelegate, NSSecureCoding, NSCopying>
+
+/**
+ The managed session.
+ */
+@property (readonly, nonatomic, strong) NSURLSession *session;
+
+/**
+ The operation queue on which delegate callbacks are run.
+ */
+@property (readonly, nonatomic, strong) NSOperationQueue *operationQueue;
+
+/**
+ Responses sent from the server in data tasks created with `dataTaskWithRequest:success:failure:` and run using the `GET` / `POST` / et al. convenience methods are automatically validated and serialized by the response serializer. By default, this property is set to an instance of `AFJSONResponseSerializer`.
+
+ @warning `responseSerializer` must not be `nil`.
+ */
+@property (nonatomic, strong) id <AFURLResponseSerialization> responseSerializer;
+
+///-------------------------------
+/// @name Managing Security Policy
+///-------------------------------
+
+/**
+ The security policy used by created session to evaluate server trust for secure connections. `AFURLSessionManager` uses the `defaultPolicy` unless otherwise specified.
+ */
+@property (nonatomic, strong) AFSecurityPolicy *securityPolicy;
+
+#if !TARGET_OS_WATCH
+///--------------------------------------
+/// @name Monitoring Network Reachability
+///--------------------------------------
+
+/**
+ The network reachability manager. `AFURLSessionManager` uses the `sharedManager` by default.
+ */
+@property (readwrite, nonatomic, strong) AFNetworkReachabilityManager *reachabilityManager;
+#endif
+
+///----------------------------
+/// @name Getting Session Tasks
+///----------------------------
+
+/**
+ The data, upload, and download tasks currently run by the managed session.
+ */
+@property (readonly, nonatomic, strong) NSArray <NSURLSessionTask *> *tasks;
+
+/**
+ The data tasks currently run by the managed session.
+ */
+@property (readonly, nonatomic, strong) NSArray <NSURLSessionDataTask *> *dataTasks;
+
+/**
+ The upload tasks currently run by the managed session.
+ */
+@property (readonly, nonatomic, strong) NSArray <NSURLSessionUploadTask *> *uploadTasks;
+
+/**
+ The download tasks currently run by the managed session.
+ */
+@property (readonly, nonatomic, strong) NSArray <NSURLSessionDownloadTask *> *downloadTasks;
+
+///-------------------------------
+/// @name Managing Callback Queues
+///-------------------------------
+
+/**
+ The dispatch queue for `completionBlock`. If `NULL` (default), the main queue is used.
+ */
+@property (nonatomic, strong, nullable) dispatch_queue_t completionQueue;
+
+/**
+ The dispatch group for `completionBlock`. If `NULL` (default), a private dispatch group is used.
+ */
+@property (nonatomic, strong, nullable) dispatch_group_t completionGroup;
+
+///---------------------
+/// @name Initialization
+///---------------------
+
+/**
+ Creates and returns a manager for a session created with the specified configuration. This is the designated initializer.
+
+ @param configuration The configuration used to create the managed session.
+
+ @return A manager for a newly-created session.
+ */
+- (instancetype)initWithSessionConfiguration:(nullable NSURLSessionConfiguration *)configuration NS_DESIGNATED_INITIALIZER;
+
+/**
+ Invalidates the managed session, optionally canceling pending tasks and optionally resets given session.
+ 
+ @param cancelPendingTasks  Whether or not to cancel pending tasks.
+ @param resetSession        Whether or not to reset the session of the manager.
+ */
+- (void)invalidateSessionCancelingTasks:(BOOL)cancelPendingTasks resetSession:(BOOL)resetSession;
+
+///-------------------------
+/// @name Running Data Tasks
+///-------------------------
+
+/**
+ Creates an `NSURLSessionDataTask` with the specified request.
+
+ @param request The HTTP request for the request.
+ @param uploadProgressBlock A block object to be executed when the upload progress is updated. Note this block is called on the session queue, not the main queue.
+ @param downloadProgressBlock A block object to be executed when the download progress is updated. Note this block is called on the session queue, not the main queue.
+ @param completionHandler A block object to be executed when the task finishes. This block has no return value and takes three arguments: the server response, the response object created by that serializer, and the error that occurred, if any.
+ */
+- (NSURLSessionDataTask *)dataTaskWithRequest:(NSURLRequest *)request
+                               uploadProgress:(nullable void (^)(NSProgress *uploadProgress))uploadProgressBlock
+                             downloadProgress:(nullable void (^)(NSProgress *downloadProgress))downloadProgressBlock
+                            completionHandler:(nullable void (^)(NSURLResponse *response, id _Nullable responseObject,  NSError * _Nullable error))completionHandler;
+
+///---------------------------
+/// @name Running Upload Tasks
+///---------------------------
+
+/**
+ Creates an `NSURLSessionUploadTask` with the specified request for a local file.
+
+ @param request The HTTP request for the request.
+ @param fileURL A URL to the local file to be uploaded.
+ @param uploadProgressBlock A block object to be executed when the upload progress is updated. Note this block is called on the session queue, not the main queue.
+ @param completionHandler A block object to be executed when the task finishes. This block has no return value and takes three arguments: the server response, the response object created by that serializer, and the error that occurred, if any.
+
+ @see `attemptsToRecreateUploadTasksForBackgroundSessions`
+ */
+- (NSURLSessionUploadTask *)uploadTaskWithRequest:(NSURLRequest *)request
+                                         fromFile:(NSURL *)fileURL
+                                         progress:(nullable void (^)(NSProgress *uploadProgress))uploadProgressBlock
+                                completionHandler:(nullable void (^)(NSURLResponse *response, id _Nullable responseObject, NSError  * _Nullable error))completionHandler;
+
+/**
+ Creates an `NSURLSessionUploadTask` with the specified request for an HTTP body.
+
+ @param request The HTTP request for the request.
+ @param bodyData A data object containing the HTTP body to be uploaded.
+ @param uploadProgressBlock A block object to be executed when the upload progress is updated. Note this block is called on the session queue, not the main queue.
+ @param completionHandler A block object to be executed when the task finishes. This block has no return value and takes three arguments: the server response, the response object created by that serializer, and the error that occurred, if any.
+ */
+- (NSURLSessionUploadTask *)uploadTaskWithRequest:(NSURLRequest *)request
+                                         fromData:(nullable NSData *)bodyData
+                                         progress:(nullable void (^)(NSProgress *uploadProgress))uploadProgressBlock
+                                completionHandler:(nullable void (^)(NSURLResponse *response, id _Nullable responseObject, NSError * _Nullable error))completionHandler;
+
+/**
+ Creates an `NSURLSessionUploadTask` with the specified streaming request.
+
+ @param request The HTTP request for the request.
+ @param uploadProgressBlock A block object to be executed when the upload progress is updated. Note this block is called on the session queue, not the main queue.
+ @param completionHandler A block object to be executed when the task finishes. This block has no return value and takes three arguments: the server response, the response object created by that serializer, and the error that occurred, if any.
+ */
+- (NSURLSessionUploadTask *)uploadTaskWithStreamedRequest:(NSURLRequest *)request
+                                                 progress:(nullable void (^)(NSProgress *uploadProgress))uploadProgressBlock
+                                        completionHandler:(nullable void (^)(NSURLResponse *response, id _Nullable responseObject, NSError * _Nullable error))completionHandler;
+
+///-----------------------------
+/// @name Running Download Tasks
+///-----------------------------
+
+/**
+ Creates an `NSURLSessionDownloadTask` with the specified request.
+
+ @param request The HTTP request for the request.
+ @param downloadProgressBlock A block object to be executed when the download progress is updated. Note this block is called on the session queue, not the main queue.
+ @param destination A block object to be executed in order to determine the destination of the downloaded file. This block takes two arguments, the target path & the server response, and returns the desired file URL of the resulting download. The temporary file used during the download will be automatically deleted after being moved to the returned URL.
+ @param completionHandler A block to be executed when a task finishes. This block has no return value and takes three arguments: the server response, the path of the downloaded file, and the error describing the network or parsing error that occurred, if any.
+
+ @warning If using a background `NSURLSessionConfiguration` on iOS, these blocks will be lost when the app is terminated. Background sessions may prefer to use `-setDownloadTaskDidFinishDownloadingBlock:` to specify the URL for saving the downloaded file, rather than the destination block of this method.
+ */
+- (NSURLSessionDownloadTask *)downloadTaskWithRequest:(NSURLRequest *)request
+                                             progress:(nullable void (^)(NSProgress *downloadProgress))downloadProgressBlock
+                                          destination:(nullable NSURL * (^)(NSURL *targetPath, NSURLResponse *response))destination
+                                    completionHandler:(nullable void (^)(NSURLResponse *response, NSURL * _Nullable filePath, NSError * _Nullable error))completionHandler;
+
+/**
+ Creates an `NSURLSessionDownloadTask` with the specified resume data.
+
+ @param resumeData The data used to resume downloading.
+ @param downloadProgressBlock A block object to be executed when the download progress is updated. Note this block is called on the session queue, not the main queue.
+ @param destination A block object to be executed in order to determine the destination of the downloaded file. This block takes two arguments, the target path & the server response, and returns the desired file URL of the resulting download. The temporary file used during the download will be automatically deleted after being moved to the returned URL.
+ @param completionHandler A block to be executed when a task finishes. This block has no return value and takes three arguments: the server response, the path of the downloaded file, and the error describing the network or parsing error that occurred, if any.
+ */
+- (NSURLSessionDownloadTask *)downloadTaskWithResumeData:(NSData *)resumeData
+                                                progress:(nullable void (^)(NSProgress *downloadProgress))downloadProgressBlock
+                                             destination:(nullable NSURL * (^)(NSURL *targetPath, NSURLResponse *response))destination
+                                       completionHandler:(nullable void (^)(NSURLResponse *response, NSURL * _Nullable filePath, NSError * _Nullable error))completionHandler;
+
+///---------------------------------
+/// @name Getting Progress for Tasks
+///---------------------------------
+
+/**
+ Returns the upload progress of the specified task.
+
+ @param task The session task. Must not be `nil`.
+
+ @return An `NSProgress` object reporting the upload progress of a task, or `nil` if the progress is unavailable.
+ */
+- (nullable NSProgress *)uploadProgressForTask:(NSURLSessionTask *)task;
+
+/**
+ Returns the download progress of the specified task.
+
+ @param task The session task. Must not be `nil`.
+
+ @return An `NSProgress` object reporting the download progress of a task, or `nil` if the progress is unavailable.
+ */
+- (nullable NSProgress *)downloadProgressForTask:(NSURLSessionTask *)task;
+
+///-----------------------------------------
+/// @name Setting Session Delegate Callbacks
+///-----------------------------------------
+
+/**
+ Sets a block to be executed when the managed session becomes invalid, as handled by the `NSURLSessionDelegate` method `URLSession:didBecomeInvalidWithError:`.
+
+ @param block A block object to be executed when the managed session becomes invalid. The block has no return value, and takes two arguments: the session, and the error related to the cause of invalidation.
+ */
+- (void)setSessionDidBecomeInvalidBlock:(nullable void (^)(NSURLSession *session, NSError *error))block;
+
+/**
+ Sets a block to be executed when a connection level authentication challenge has occurred, as handled by the `NSURLSessionDelegate` method `URLSession:didReceiveChallenge:completionHandler:`.
+
+ @param block A block object to be executed when a connection level authentication challenge has occurred. The block returns the disposition of the authentication challenge, and takes three arguments: the session, the authentication challenge, and a pointer to the credential that should be used to resolve the challenge.
+
+ @warning Implementing a session authentication challenge handler yourself totally bypasses AFNetworking's security policy defined in `AFSecurityPolicy`. Make sure you fully understand the implications before implementing a custom session authentication challenge handler. If you do not want to bypass AFNetworking's security policy, use `setTaskDidReceiveAuthenticationChallengeBlock:` instead.
+
+ @see -securityPolicy
+ @see -setTaskDidReceiveAuthenticationChallengeBlock:
+ */
+- (void)setSessionDidReceiveAuthenticationChallengeBlock:(nullable NSURLSessionAuthChallengeDisposition (^)(NSURLSession *session, NSURLAuthenticationChallenge *challenge, NSURLCredential * _Nullable __autoreleasing * _Nullable credential))block;
+
+///--------------------------------------
+/// @name Setting Task Delegate Callbacks
+///--------------------------------------
+
+/**
+ Sets a block to be executed when a task requires a new request body stream to send to the remote server, as handled by the `NSURLSessionTaskDelegate` method `URLSession:task:needNewBodyStream:`.
+
+ @param block A block object to be executed when a task requires a new request body stream.
+ */
+- (void)setTaskNeedNewBodyStreamBlock:(nullable NSInputStream * (^)(NSURLSession *session, NSURLSessionTask *task))block;
+
+/**
+ Sets a block to be executed when an HTTP request is attempting to perform a redirection to a different URL, as handled by the `NSURLSessionTaskDelegate` method `URLSession:willPerformHTTPRedirection:newRequest:completionHandler:`.
+
+ @param block A block object to be executed when an HTTP request is attempting to perform a redirection to a different URL. The block returns the request to be made for the redirection, and takes four arguments: the session, the task, the redirection response, and the request corresponding to the redirection response.
+ */
+- (void)setTaskWillPerformHTTPRedirectionBlock:(nullable NSURLRequest * _Nullable (^)(NSURLSession *session, NSURLSessionTask *task, NSURLResponse *response, NSURLRequest *request))block;
+
+/**
+ Sets a block to be executed when a session task has received a request specific authentication challenge, as handled by the `NSURLSessionTaskDelegate` method `URLSession:task:didReceiveChallenge:completionHandler:`.
+ 
+ @param authenticationChallengeHandler A block object to be executed when a session task has received a request specific authentication challenge.
+ 
+ When implementing an authentication challenge handler, you should check the authentication method first (`challenge.protectionSpace.authenticationMethod `) to decide if you want to handle the authentication challenge yourself or if you want AFNetworking to handle it. If you want AFNetworking to handle the authentication challenge, just return `@(NSURLSessionAuthChallengePerformDefaultHandling)`. For example, you certainly want AFNetworking to handle certificate validation (i.e. authentication method == `NSURLAuthenticationMethodServerTrust`) as defined by the security policy. If you want to handle the challenge yourself, you have four options:
+ 
+ 1. Return `nil` from the authentication challenge handler. You **MUST** call the completion handler with a disposition and credentials yourself. Use this if you need to present a user interface to let the user enter their credentials.
+ 2. Return an `NSError` object from the authentication challenge handler. You **MUST NOT** call the completion handler when returning an `NSError `. The returned error will be reported in the completion handler of the task. Use this if you need to abort an authentication challenge with a specific error.
+ 3. Return an `NSURLCredential` object from the authentication challenge handler. You **MUST NOT** call the completion handler when returning an `NSURLCredential`. The returned credentials will be used to fulfil the challenge. Use this when you can get credentials without presenting a user interface.
+ 4. Return an `NSNumber` object wrapping an `NSURLSessionAuthChallengeDisposition`. Supported values are `@(NSURLSessionAuthChallengePerformDefaultHandling)`, `@(NSURLSessionAuthChallengeCancelAuthenticationChallenge)` and `@(NSURLSessionAuthChallengeRejectProtectionSpace)`. You **MUST NOT** call the completion handler when returning an `NSNumber`.
+ 
+ If you return anything else from the authentication challenge handler, an exception will be thrown.
+ 
+ For more information about how URL sessions handle the different types of authentication challenges, see [NSURLSession](https://developer.apple.com/reference/foundation/nsurlsession?language=objc) and [URL Session Programming Guide](https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/URLLoadingSystem/URLLoadingSystem.html).
+ 
+ @see -securityPolicy
+ */
+- (void)setAuthenticationChallengeHandler:(id (^)(NSURLSession *session, NSURLSessionTask *task, NSURLAuthenticationChallenge *challenge, void (^completionHandler)(NSURLSessionAuthChallengeDisposition , NSURLCredential * _Nullable)))authenticationChallengeHandler;
+
+/**
+ Sets a block to be executed periodically to track upload progress, as handled by the `NSURLSessionTaskDelegate` method `URLSession:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:`.
+
+ @param block A block object to be called when an undetermined number of bytes have been uploaded to the server. This block has no return value and takes five arguments: the session, the task, the number of bytes written since the last time the upload progress block was called, the total bytes written, and the total bytes expected to be written during the request, as initially determined by the length of the HTTP body. This block may be called multiple times, and will execute on the main thread.
+ */
+- (void)setTaskDidSendBodyDataBlock:(nullable void (^)(NSURLSession *session, NSURLSessionTask *task, int64_t bytesSent, int64_t totalBytesSent, int64_t totalBytesExpectedToSend))block;
+
+/**
+ Sets a block to be executed as the last message related to a specific task, as handled by the `NSURLSessionTaskDelegate` method `URLSession:task:didCompleteWithError:`.
+
+ @param block A block object to be executed when a session task is completed. The block has no return value, and takes three arguments: the session, the task, and any error that occurred in the process of executing the task.
+ */
+- (void)setTaskDidCompleteBlock:(nullable void (^)(NSURLSession *session, NSURLSessionTask *task, NSError * _Nullable error))block;
+
+/**
+ Sets a block to be executed when metrics are finalized related to a specific task, as handled by the `NSURLSessionTaskDelegate` method `URLSession:task:didFinishCollectingMetrics:`.
+
+ @param block A block object to be executed when a session task is completed. The block has no return value, and takes three arguments: the session, the task, and any metrics that were collected in the process of executing the task.
+ */
+#if AF_CAN_INCLUDE_SESSION_TASK_METRICS
+- (void)setTaskDidFinishCollectingMetricsBlock:(nullable void (^)(NSURLSession *session, NSURLSessionTask *task, NSURLSessionTaskMetrics * _Nullable metrics))block AF_API_AVAILABLE(ios(10), macosx(10.12), watchos(3), tvos(10));
+#endif
+///-------------------------------------------
+/// @name Setting Data Task Delegate Callbacks
+///-------------------------------------------
+
+/**
+ Sets a block to be executed when a data task has received a response, as handled by the `NSURLSessionDataDelegate` method `URLSession:dataTask:didReceiveResponse:completionHandler:`.
+
+ @param block A block object to be executed when a data task has received a response. The block returns the disposition of the session response, and takes three arguments: the session, the data task, and the received response.
+ */
+- (void)setDataTaskDidReceiveResponseBlock:(nullable NSURLSessionResponseDisposition (^)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSURLResponse *response))block;
+
+/**
+ Sets a block to be executed when a data task has become a download task, as handled by the `NSURLSessionDataDelegate` method `URLSession:dataTask:didBecomeDownloadTask:`.
+
+ @param block A block object to be executed when a data task has become a download task. The block has no return value, and takes three arguments: the session, the data task, and the download task it has become.
+ */
+- (void)setDataTaskDidBecomeDownloadTaskBlock:(nullable void (^)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSURLSessionDownloadTask *downloadTask))block;
+
+/**
+ Sets a block to be executed when a data task receives data, as handled by the `NSURLSessionDataDelegate` method `URLSession:dataTask:didReceiveData:`.
+
+ @param block A block object to be called when an undetermined number of bytes have been downloaded from the server. This block has no return value and takes three arguments: the session, the data task, and the data received. This block may be called multiple times, and will execute on the session manager operation queue.
+ */
+- (void)setDataTaskDidReceiveDataBlock:(nullable void (^)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSData *data))block;
+
+/**
+ Sets a block to be executed to determine the caching behavior of a data task, as handled by the `NSURLSessionDataDelegate` method `URLSession:dataTask:willCacheResponse:completionHandler:`.
+
+ @param block A block object to be executed to determine the caching behavior of a data task. The block returns the response to cache, and takes three arguments: the session, the data task, and the proposed cached URL response.
+ */
+- (void)setDataTaskWillCacheResponseBlock:(nullable NSCachedURLResponse * (^)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSCachedURLResponse *proposedResponse))block;
+
+/**
+ Sets a block to be executed once all messages enqueued for a session have been delivered, as handled by the `NSURLSessionDataDelegate` method `URLSessionDidFinishEventsForBackgroundURLSession:`.
+
+ @param block A block object to be executed once all messages enqueued for a session have been delivered. The block has no return value and takes a single argument: the session.
+ */
+- (void)setDidFinishEventsForBackgroundURLSessionBlock:(nullable void (^)(NSURLSession *session))block AF_API_UNAVAILABLE(macos);
+
+///-----------------------------------------------
+/// @name Setting Download Task Delegate Callbacks
+///-----------------------------------------------
+
+/**
+ Sets a block to be executed when a download task has completed a download, as handled by the `NSURLSessionDownloadDelegate` method `URLSession:downloadTask:didFinishDownloadingToURL:`.
+
+ @param block A block object to be executed when a download task has completed. The block returns the URL the download should be moved to, and takes three arguments: the session, the download task, and the temporary location of the downloaded file. If the file manager encounters an error while attempting to move the temporary file to the destination, an `AFURLSessionDownloadTaskDidFailToMoveFileNotification` will be posted, with the download task as its object, and the user info of the error.
+ */
+- (void)setDownloadTaskDidFinishDownloadingBlock:(nullable NSURL * _Nullable  (^)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, NSURL *location))block;
+
+/**
+ Sets a block to be executed periodically to track download progress, as handled by the `NSURLSessionDownloadDelegate` method `URLSession:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:`.
+
+ @param block A block object to be called when an undetermined number of bytes have been downloaded from the server. This block has no return value and takes five arguments: the session, the download task, the number of bytes read since the last time the download progress block was called, the total bytes read, and the total bytes expected to be read during the request, as initially determined by the expected content size of the `NSHTTPURLResponse` object. This block may be called multiple times, and will execute on the session manager operation queue.
+ */
+- (void)setDownloadTaskDidWriteDataBlock:(nullable void (^)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, int64_t bytesWritten, int64_t totalBytesWritten, int64_t totalBytesExpectedToWrite))block;
+
+/**
+ Sets a block to be executed when a download task has been resumed, as handled by the `NSURLSessionDownloadDelegate` method `URLSession:downloadTask:didResumeAtOffset:expectedTotalBytes:`.
+
+ @param block A block object to be executed when a download task has been resumed. The block has no return value and takes four arguments: the session, the download task, the file offset of the resumed download, and the total number of bytes expected to be downloaded.
+ */
+- (void)setDownloadTaskDidResumeBlock:(nullable void (^)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, int64_t fileOffset, int64_t expectedTotalBytes))block;
+
+@end
+
+///--------------------
+/// @name Notifications
+///--------------------
+
+/**
+ Posted when a task resumes.
+ */
+FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidResumeNotification;
+
+/**
+ Posted when a task finishes executing. Includes a userInfo dictionary with additional information about the task.
+ */
+FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidCompleteNotification;
+
+/**
+ Posted when a task suspends its execution.
+ */
+FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidSuspendNotification;
+
+/**
+ Posted when a session is invalidated.
+ */
+FOUNDATION_EXPORT NSString * const AFURLSessionDidInvalidateNotification;
+
+/**
+ Posted when a session download task finished moving the temporary download file to a specified destination successfully.
+ */
+FOUNDATION_EXPORT NSString * const AFURLSessionDownloadTaskDidMoveFileSuccessfullyNotification;
+
+/**
+ Posted when a session download task encountered an error when moving the temporary download file to a specified destination.
+ */
+FOUNDATION_EXPORT NSString * const AFURLSessionDownloadTaskDidFailToMoveFileNotification;
+
+/**
+ The raw response data of the task. Included in the userInfo dictionary of the `AFNetworkingTaskDidCompleteNotification` if response data exists for the task.
+ */
+FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidCompleteResponseDataKey;
+
+/**
+ The serialized response object of the task. Included in the userInfo dictionary of the `AFNetworkingTaskDidCompleteNotification` if the response was serialized.
+ */
+FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidCompleteSerializedResponseKey;
+
+/**
+ The response serializer used to serialize the response. Included in the userInfo dictionary of the `AFNetworkingTaskDidCompleteNotification` if the task has an associated response serializer.
+ */
+FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidCompleteResponseSerializerKey;
+
+/**
+ The file path associated with the download task. Included in the userInfo dictionary of the `AFNetworkingTaskDidCompleteNotification` if an the response data has been stored directly to disk.
+ */
+FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidCompleteAssetPathKey;
+
+/**
+ Any error associated with the task, or the serialization of the response. Included in the userInfo dictionary of the `AFNetworkingTaskDidCompleteNotification` if an error exists.
+ */
+FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidCompleteErrorKey;
+
+/**
+ The session task metrics taken from the download task. Included in the userInfo dictionary of the `AFNetworkingTaskDidCompleteSessionTaskMetrics`
+ */
+FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidCompleteSessionTaskMetrics;
+
+NS_ASSUME_NONNULL_END

+ 1274 - 0
Pods/AFNetworking/AFNetworking/AFURLSessionManager.m

@@ -0,0 +1,1274 @@
+// AFURLSessionManager.m
+// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import "AFURLSessionManager.h"
+#import <objc/runtime.h>
+
+static dispatch_queue_t url_session_manager_processing_queue() {
+    static dispatch_queue_t af_url_session_manager_processing_queue;
+    static dispatch_once_t onceToken;
+    dispatch_once(&onceToken, ^{
+        af_url_session_manager_processing_queue = dispatch_queue_create("com.alamofire.networking.session.manager.processing", DISPATCH_QUEUE_CONCURRENT);
+    });
+
+    return af_url_session_manager_processing_queue;
+}
+
+static dispatch_group_t url_session_manager_completion_group() {
+    static dispatch_group_t af_url_session_manager_completion_group;
+    static dispatch_once_t onceToken;
+    dispatch_once(&onceToken, ^{
+        af_url_session_manager_completion_group = dispatch_group_create();
+    });
+
+    return af_url_session_manager_completion_group;
+}
+
+NSString * const AFNetworkingTaskDidResumeNotification = @"com.alamofire.networking.task.resume";
+NSString * const AFNetworkingTaskDidCompleteNotification = @"com.alamofire.networking.task.complete";
+NSString * const AFNetworkingTaskDidSuspendNotification = @"com.alamofire.networking.task.suspend";
+NSString * const AFURLSessionDidInvalidateNotification = @"com.alamofire.networking.session.invalidate";
+NSString * const AFURLSessionDownloadTaskDidMoveFileSuccessfullyNotification = @"com.alamofire.networking.session.download.file-manager-succeed";
+NSString * const AFURLSessionDownloadTaskDidFailToMoveFileNotification = @"com.alamofire.networking.session.download.file-manager-error";
+
+NSString * const AFNetworkingTaskDidCompleteSerializedResponseKey = @"com.alamofire.networking.task.complete.serializedresponse";
+NSString * const AFNetworkingTaskDidCompleteResponseSerializerKey = @"com.alamofire.networking.task.complete.responseserializer";
+NSString * const AFNetworkingTaskDidCompleteResponseDataKey = @"com.alamofire.networking.complete.finish.responsedata";
+NSString * const AFNetworkingTaskDidCompleteErrorKey = @"com.alamofire.networking.task.complete.error";
+NSString * const AFNetworkingTaskDidCompleteAssetPathKey = @"com.alamofire.networking.task.complete.assetpath";
+NSString * const AFNetworkingTaskDidCompleteSessionTaskMetrics = @"com.alamofire.networking.complete.sessiontaskmetrics";
+
+static NSString * const AFURLSessionManagerLockName = @"com.alamofire.networking.session.manager.lock";
+
+typedef void (^AFURLSessionDidBecomeInvalidBlock)(NSURLSession *session, NSError *error);
+typedef NSURLSessionAuthChallengeDisposition (^AFURLSessionDidReceiveAuthenticationChallengeBlock)(NSURLSession *session, NSURLAuthenticationChallenge *challenge, NSURLCredential * __autoreleasing *credential);
+
+typedef NSURLRequest * (^AFURLSessionTaskWillPerformHTTPRedirectionBlock)(NSURLSession *session, NSURLSessionTask *task, NSURLResponse *response, NSURLRequest *request);
+typedef NSURLSessionAuthChallengeDisposition (^AFURLSessionTaskDidReceiveAuthenticationChallengeBlock)(NSURLSession *session, NSURLSessionTask *task, NSURLAuthenticationChallenge *challenge, NSURLCredential * __autoreleasing *credential);
+typedef id (^AFURLSessionTaskAuthenticationChallengeBlock)(NSURLSession *session, NSURLSessionTask *task, NSURLAuthenticationChallenge *challenge, void (^completionHandler)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential));
+typedef void (^AFURLSessionDidFinishEventsForBackgroundURLSessionBlock)(NSURLSession *session);
+
+typedef NSInputStream * (^AFURLSessionTaskNeedNewBodyStreamBlock)(NSURLSession *session, NSURLSessionTask *task);
+typedef void (^AFURLSessionTaskDidSendBodyDataBlock)(NSURLSession *session, NSURLSessionTask *task, int64_t bytesSent, int64_t totalBytesSent, int64_t totalBytesExpectedToSend);
+typedef void (^AFURLSessionTaskDidCompleteBlock)(NSURLSession *session, NSURLSessionTask *task, NSError *error);
+#if AF_CAN_INCLUDE_SESSION_TASK_METRICS
+typedef void (^AFURLSessionTaskDidFinishCollectingMetricsBlock)(NSURLSession *session, NSURLSessionTask *task, NSURLSessionTaskMetrics * metrics) AF_API_AVAILABLE(ios(10), macosx(10.12), watchos(3), tvos(10));
+#endif
+
+typedef NSURLSessionResponseDisposition (^AFURLSessionDataTaskDidReceiveResponseBlock)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSURLResponse *response);
+typedef void (^AFURLSessionDataTaskDidBecomeDownloadTaskBlock)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSURLSessionDownloadTask *downloadTask);
+typedef void (^AFURLSessionDataTaskDidReceiveDataBlock)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSData *data);
+typedef NSCachedURLResponse * (^AFURLSessionDataTaskWillCacheResponseBlock)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSCachedURLResponse *proposedResponse);
+
+typedef NSURL * (^AFURLSessionDownloadTaskDidFinishDownloadingBlock)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, NSURL *location);
+typedef void (^AFURLSessionDownloadTaskDidWriteDataBlock)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, int64_t bytesWritten, int64_t totalBytesWritten, int64_t totalBytesExpectedToWrite);
+typedef void (^AFURLSessionDownloadTaskDidResumeBlock)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, int64_t fileOffset, int64_t expectedTotalBytes);
+typedef void (^AFURLSessionTaskProgressBlock)(NSProgress *);
+
+typedef void (^AFURLSessionTaskCompletionHandler)(NSURLResponse *response, id responseObject, NSError *error);
+
+#pragma mark -
+
+@interface AFURLSessionManagerTaskDelegate : NSObject <NSURLSessionTaskDelegate, NSURLSessionDataDelegate, NSURLSessionDownloadDelegate>
+- (instancetype)initWithTask:(NSURLSessionTask *)task;
+@property (nonatomic, weak) AFURLSessionManager *manager;
+@property (nonatomic, strong) NSMutableData *mutableData;
+@property (nonatomic, strong) NSProgress *uploadProgress;
+@property (nonatomic, strong) NSProgress *downloadProgress;
+@property (nonatomic, copy) NSURL *downloadFileURL;
+#if AF_CAN_INCLUDE_SESSION_TASK_METRICS
+@property (nonatomic, strong) NSURLSessionTaskMetrics *sessionTaskMetrics AF_API_AVAILABLE(ios(10), macosx(10.12), watchos(3), tvos(10));
+#endif
+@property (nonatomic, copy) AFURLSessionDownloadTaskDidFinishDownloadingBlock downloadTaskDidFinishDownloading;
+@property (nonatomic, copy) AFURLSessionTaskProgressBlock uploadProgressBlock;
+@property (nonatomic, copy) AFURLSessionTaskProgressBlock downloadProgressBlock;
+@property (nonatomic, copy) AFURLSessionTaskCompletionHandler completionHandler;
+@end
+
+@implementation AFURLSessionManagerTaskDelegate
+
+- (instancetype)initWithTask:(NSURLSessionTask *)task {
+    self = [super init];
+    if (!self) {
+        return nil;
+    }
+    
+    _mutableData = [NSMutableData data];
+    _uploadProgress = [[NSProgress alloc] initWithParent:nil userInfo:nil];
+    _downloadProgress = [[NSProgress alloc] initWithParent:nil userInfo:nil];
+    
+    __weak __typeof__(task) weakTask = task;
+    for (NSProgress *progress in @[ _uploadProgress, _downloadProgress ])
+    {
+        progress.totalUnitCount = NSURLSessionTransferSizeUnknown;
+        progress.cancellable = YES;
+        progress.cancellationHandler = ^{
+            [weakTask cancel];
+        };
+        progress.pausable = YES;
+        progress.pausingHandler = ^{
+            [weakTask suspend];
+        };
+#if AF_CAN_USE_AT_AVAILABLE
+        if (@available(macOS 10.11, *))
+#else
+        if ([progress respondsToSelector:@selector(setResumingHandler:)])
+#endif
+        {
+            progress.resumingHandler = ^{
+                [weakTask resume];
+            };
+        }
+        
+        [progress addObserver:self
+                   forKeyPath:NSStringFromSelector(@selector(fractionCompleted))
+                      options:NSKeyValueObservingOptionNew
+                      context:NULL];
+    }
+    return self;
+}
+
+- (void)dealloc {
+    [self.downloadProgress removeObserver:self forKeyPath:NSStringFromSelector(@selector(fractionCompleted))];
+    [self.uploadProgress removeObserver:self forKeyPath:NSStringFromSelector(@selector(fractionCompleted))];
+}
+
+#pragma mark - NSProgress Tracking
+
+- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSString *,id> *)change context:(void *)context {
+   if ([object isEqual:self.downloadProgress]) {
+        if (self.downloadProgressBlock) {
+            self.downloadProgressBlock(object);
+        }
+    }
+    else if ([object isEqual:self.uploadProgress]) {
+        if (self.uploadProgressBlock) {
+            self.uploadProgressBlock(object);
+        }
+    }
+}
+
+static const void * const AuthenticationChallengeErrorKey = &AuthenticationChallengeErrorKey;
+
+#pragma mark - NSURLSessionTaskDelegate
+
+- (void)URLSession:(__unused NSURLSession *)session
+              task:(NSURLSessionTask *)task
+didCompleteWithError:(NSError *)error
+{
+    error = objc_getAssociatedObject(task, AuthenticationChallengeErrorKey) ?: error;
+    __strong AFURLSessionManager *manager = self.manager;
+
+    __block id responseObject = nil;
+
+    NSMutableDictionary *userInfo = [NSMutableDictionary dictionary];
+    userInfo[AFNetworkingTaskDidCompleteResponseSerializerKey] = manager.responseSerializer;
+
+    //Performance Improvement from #2672
+    NSData *data = nil;
+    if (self.mutableData) {
+        data = [self.mutableData copy];
+        //We no longer need the reference, so nil it out to gain back some memory.
+        self.mutableData = nil;
+    }
+
+#if AF_CAN_USE_AT_AVAILABLE && AF_CAN_INCLUDE_SESSION_TASK_METRICS
+    if (@available(iOS 10, macOS 10.12, watchOS 3, tvOS 10, *)) {
+        if (self.sessionTaskMetrics) {
+            userInfo[AFNetworkingTaskDidCompleteSessionTaskMetrics] = self.sessionTaskMetrics;
+        }
+    }
+#endif
+
+    if (self.downloadFileURL) {
+        userInfo[AFNetworkingTaskDidCompleteAssetPathKey] = self.downloadFileURL;
+    } else if (data) {
+        userInfo[AFNetworkingTaskDidCompleteResponseDataKey] = data;
+    }
+
+    if (error) {
+        userInfo[AFNetworkingTaskDidCompleteErrorKey] = error;
+
+        dispatch_group_async(manager.completionGroup ?: url_session_manager_completion_group(), manager.completionQueue ?: dispatch_get_main_queue(), ^{
+            if (self.completionHandler) {
+                self.completionHandler(task.response, responseObject, error);
+            }
+
+            dispatch_async(dispatch_get_main_queue(), ^{
+                [[NSNotificationCenter defaultCenter] postNotificationName:AFNetworkingTaskDidCompleteNotification object:task userInfo:userInfo];
+            });
+        });
+    } else {
+        dispatch_async(url_session_manager_processing_queue(), ^{
+            NSError *serializationError = nil;
+            responseObject = [manager.responseSerializer responseObjectForResponse:task.response data:data error:&serializationError];
+
+            if (self.downloadFileURL) {
+                responseObject = self.downloadFileURL;
+            }
+
+            if (responseObject) {
+                userInfo[AFNetworkingTaskDidCompleteSerializedResponseKey] = responseObject;
+            }
+
+            if (serializationError) {
+                userInfo[AFNetworkingTaskDidCompleteErrorKey] = serializationError;
+            }
+
+            dispatch_group_async(manager.completionGroup ?: url_session_manager_completion_group(), manager.completionQueue ?: dispatch_get_main_queue(), ^{
+                if (self.completionHandler) {
+                    self.completionHandler(task.response, responseObject, serializationError);
+                }
+
+                dispatch_async(dispatch_get_main_queue(), ^{
+                    [[NSNotificationCenter defaultCenter] postNotificationName:AFNetworkingTaskDidCompleteNotification object:task userInfo:userInfo];
+                });
+            });
+        });
+    }
+}
+
+#if AF_CAN_INCLUDE_SESSION_TASK_METRICS
+- (void)URLSession:(NSURLSession *)session
+              task:(NSURLSessionTask *)task
+didFinishCollectingMetrics:(NSURLSessionTaskMetrics *)metrics AF_API_AVAILABLE(ios(10), macosx(10.12), watchos(3), tvos(10)) {
+    self.sessionTaskMetrics = metrics;
+}
+#endif
+
+#pragma mark - NSURLSessionDataDelegate
+
+- (void)URLSession:(__unused NSURLSession *)session
+          dataTask:(__unused NSURLSessionDataTask *)dataTask
+    didReceiveData:(NSData *)data
+{
+    self.downloadProgress.totalUnitCount = dataTask.countOfBytesExpectedToReceive;
+    self.downloadProgress.completedUnitCount = dataTask.countOfBytesReceived;
+
+    [self.mutableData appendData:data];
+}
+
+- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task
+   didSendBodyData:(int64_t)bytesSent
+    totalBytesSent:(int64_t)totalBytesSent
+totalBytesExpectedToSend:(int64_t)totalBytesExpectedToSend{
+    
+    self.uploadProgress.totalUnitCount = task.countOfBytesExpectedToSend;
+    self.uploadProgress.completedUnitCount = task.countOfBytesSent;
+}
+
+#pragma mark - NSURLSessionDownloadDelegate
+
+- (void)URLSession:(NSURLSession *)session downloadTask:(NSURLSessionDownloadTask *)downloadTask
+      didWriteData:(int64_t)bytesWritten
+ totalBytesWritten:(int64_t)totalBytesWritten
+totalBytesExpectedToWrite:(int64_t)totalBytesExpectedToWrite{
+    
+    self.downloadProgress.totalUnitCount = totalBytesExpectedToWrite;
+    self.downloadProgress.completedUnitCount = totalBytesWritten;
+}
+
+- (void)URLSession:(NSURLSession *)session downloadTask:(NSURLSessionDownloadTask *)downloadTask
+ didResumeAtOffset:(int64_t)fileOffset
+expectedTotalBytes:(int64_t)expectedTotalBytes{
+    
+    self.downloadProgress.totalUnitCount = expectedTotalBytes;
+    self.downloadProgress.completedUnitCount = fileOffset;
+}
+
+- (void)URLSession:(NSURLSession *)session
+      downloadTask:(NSURLSessionDownloadTask *)downloadTask
+didFinishDownloadingToURL:(NSURL *)location
+{
+    self.downloadFileURL = nil;
+
+    if (self.downloadTaskDidFinishDownloading) {
+        self.downloadFileURL = self.downloadTaskDidFinishDownloading(session, downloadTask, location);
+        if (self.downloadFileURL) {
+            NSError *fileManagerError = nil;
+
+            if (![[NSFileManager defaultManager] moveItemAtURL:location toURL:self.downloadFileURL error:&fileManagerError]) {
+                [[NSNotificationCenter defaultCenter] postNotificationName:AFURLSessionDownloadTaskDidFailToMoveFileNotification object:downloadTask userInfo:fileManagerError.userInfo];
+            } else {
+                [[NSNotificationCenter defaultCenter] postNotificationName:AFURLSessionDownloadTaskDidMoveFileSuccessfullyNotification object:downloadTask userInfo:nil];
+            }
+        }
+    }
+}
+
+@end
+
+#pragma mark -
+
+/**
+ *  A workaround for issues related to key-value observing the `state` of an `NSURLSessionTask`.
+ *
+ *  See:
+ *  - https://github.com/AFNetworking/AFNetworking/issues/1477
+ *  - https://github.com/AFNetworking/AFNetworking/issues/2638
+ *  - https://github.com/AFNetworking/AFNetworking/pull/2702
+ */
+
+static inline void af_swizzleSelector(Class theClass, SEL originalSelector, SEL swizzledSelector) {
+    Method originalMethod = class_getInstanceMethod(theClass, originalSelector);
+    Method swizzledMethod = class_getInstanceMethod(theClass, swizzledSelector);
+    method_exchangeImplementations(originalMethod, swizzledMethod);
+}
+
+static inline BOOL af_addMethod(Class theClass, SEL selector, Method method) {
+    return class_addMethod(theClass, selector,  method_getImplementation(method),  method_getTypeEncoding(method));
+}
+
+static NSString * const AFNSURLSessionTaskDidResumeNotification  = @"com.alamofire.networking.nsurlsessiontask.resume";
+static NSString * const AFNSURLSessionTaskDidSuspendNotification = @"com.alamofire.networking.nsurlsessiontask.suspend";
+
+@interface _AFURLSessionTaskSwizzling : NSObject
+
+@end
+
+@implementation _AFURLSessionTaskSwizzling
+
++ (void)load {
+    /**
+     WARNING: Trouble Ahead
+     https://github.com/AFNetworking/AFNetworking/pull/2702
+     */
+
+    if (NSClassFromString(@"NSURLSessionTask")) {
+        /**
+         iOS 7 and iOS 8 differ in NSURLSessionTask implementation, which makes the next bit of code a bit tricky.
+         Many Unit Tests have been built to validate as much of this behavior has possible.
+         Here is what we know:
+            - NSURLSessionTasks are implemented with class clusters, meaning the class you request from the API isn't actually the type of class you will get back.
+            - Simply referencing `[NSURLSessionTask class]` will not work. You need to ask an `NSURLSession` to actually create an object, and grab the class from there.
+            - On iOS 7, `localDataTask` is a `__NSCFLocalDataTask`, which inherits from `__NSCFLocalSessionTask`, which inherits from `__NSCFURLSessionTask`.
+            - On iOS 8, `localDataTask` is a `__NSCFLocalDataTask`, which inherits from `__NSCFLocalSessionTask`, which inherits from `NSURLSessionTask`.
+            - On iOS 7, `__NSCFLocalSessionTask` and `__NSCFURLSessionTask` are the only two classes that have their own implementations of `resume` and `suspend`, and `__NSCFLocalSessionTask` DOES NOT CALL SUPER. This means both classes need to be swizzled.
+            - On iOS 8, `NSURLSessionTask` is the only class that implements `resume` and `suspend`. This means this is the only class that needs to be swizzled.
+            - Because `NSURLSessionTask` is not involved in the class hierarchy for every version of iOS, its easier to add the swizzled methods to a dummy class and manage them there.
+        
+         Some Assumptions:
+            - No implementations of `resume` or `suspend` call super. If this were to change in a future version of iOS, we'd need to handle it.
+            - No background task classes override `resume` or `suspend`
+         
+         The current solution:
+            1) Grab an instance of `__NSCFLocalDataTask` by asking an instance of `NSURLSession` for a data task.
+            2) Grab a pointer to the original implementation of `af_resume`
+            3) Check to see if the current class has an implementation of resume. If so, continue to step 4.
+            4) Grab the super class of the current class.
+            5) Grab a pointer for the current class to the current implementation of `resume`.
+            6) Grab a pointer for the super class to the current implementation of `resume`.
+            7) If the current class implementation of `resume` is not equal to the super class implementation of `resume` AND the current implementation of `resume` is not equal to the original implementation of `af_resume`, THEN swizzle the methods
+            8) Set the current class to the super class, and repeat steps 3-8
+         */
+        NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration ephemeralSessionConfiguration];
+        NSURLSession *session = [NSURLSession sessionWithConfiguration:configuration];
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wnonnull"
+        NSURLSessionDataTask *localDataTask = [session dataTaskWithURL:nil];
+#pragma clang diagnostic pop
+        IMP originalAFResumeIMP = method_getImplementation(class_getInstanceMethod([self class], @selector(af_resume)));
+        Class currentClass = [localDataTask class];
+        
+        while (class_getInstanceMethod(currentClass, @selector(resume))) {
+            Class superClass = [currentClass superclass];
+            IMP classResumeIMP = method_getImplementation(class_getInstanceMethod(currentClass, @selector(resume)));
+            IMP superclassResumeIMP = method_getImplementation(class_getInstanceMethod(superClass, @selector(resume)));
+            if (classResumeIMP != superclassResumeIMP &&
+                originalAFResumeIMP != classResumeIMP) {
+                [self swizzleResumeAndSuspendMethodForClass:currentClass];
+            }
+            currentClass = [currentClass superclass];
+        }
+        
+        [localDataTask cancel];
+        [session finishTasksAndInvalidate];
+    }
+}
+
++ (void)swizzleResumeAndSuspendMethodForClass:(Class)theClass {
+    Method afResumeMethod = class_getInstanceMethod(self, @selector(af_resume));
+    Method afSuspendMethod = class_getInstanceMethod(self, @selector(af_suspend));
+
+    if (af_addMethod(theClass, @selector(af_resume), afResumeMethod)) {
+        af_swizzleSelector(theClass, @selector(resume), @selector(af_resume));
+    }
+
+    if (af_addMethod(theClass, @selector(af_suspend), afSuspendMethod)) {
+        af_swizzleSelector(theClass, @selector(suspend), @selector(af_suspend));
+    }
+}
+
+- (NSURLSessionTaskState)state {
+    NSAssert(NO, @"State method should never be called in the actual dummy class");
+    return NSURLSessionTaskStateCanceling;
+}
+
+- (void)af_resume {
+    NSAssert([self respondsToSelector:@selector(state)], @"Does not respond to state");
+    NSURLSessionTaskState state = [self state];
+    [self af_resume];
+    
+    if (state != NSURLSessionTaskStateRunning) {
+        [[NSNotificationCenter defaultCenter] postNotificationName:AFNSURLSessionTaskDidResumeNotification object:self];
+    }
+}
+
+- (void)af_suspend {
+    NSAssert([self respondsToSelector:@selector(state)], @"Does not respond to state");
+    NSURLSessionTaskState state = [self state];
+    [self af_suspend];
+    
+    if (state != NSURLSessionTaskStateSuspended) {
+        [[NSNotificationCenter defaultCenter] postNotificationName:AFNSURLSessionTaskDidSuspendNotification object:self];
+    }
+}
+@end
+
+#pragma mark -
+
+@interface AFURLSessionManager ()
+@property (readwrite, nonatomic, strong) NSURLSessionConfiguration *sessionConfiguration;
+@property (readwrite, nonatomic, strong) NSOperationQueue *operationQueue;
+@property (readwrite, nonatomic, strong) NSURLSession *session;
+@property (readwrite, nonatomic, strong) NSMutableDictionary *mutableTaskDelegatesKeyedByTaskIdentifier;
+@property (readonly, nonatomic, copy) NSString *taskDescriptionForSessionTasks;
+@property (readwrite, nonatomic, strong) NSLock *lock;
+@property (readwrite, nonatomic, copy) AFURLSessionDidBecomeInvalidBlock sessionDidBecomeInvalid;
+@property (readwrite, nonatomic, copy) AFURLSessionDidReceiveAuthenticationChallengeBlock sessionDidReceiveAuthenticationChallenge;
+@property (readwrite, nonatomic, copy) AFURLSessionDidFinishEventsForBackgroundURLSessionBlock didFinishEventsForBackgroundURLSession AF_API_UNAVAILABLE(macos);
+@property (readwrite, nonatomic, copy) AFURLSessionTaskWillPerformHTTPRedirectionBlock taskWillPerformHTTPRedirection;
+@property (readwrite, nonatomic, copy) AFURLSessionTaskAuthenticationChallengeBlock authenticationChallengeHandler;
+@property (readwrite, nonatomic, copy) AFURLSessionTaskNeedNewBodyStreamBlock taskNeedNewBodyStream;
+@property (readwrite, nonatomic, copy) AFURLSessionTaskDidSendBodyDataBlock taskDidSendBodyData;
+@property (readwrite, nonatomic, copy) AFURLSessionTaskDidCompleteBlock taskDidComplete;
+#if AF_CAN_INCLUDE_SESSION_TASK_METRICS
+@property (readwrite, nonatomic, copy) AFURLSessionTaskDidFinishCollectingMetricsBlock taskDidFinishCollectingMetrics AF_API_AVAILABLE(ios(10), macosx(10.12), watchos(3), tvos(10));
+#endif
+@property (readwrite, nonatomic, copy) AFURLSessionDataTaskDidReceiveResponseBlock dataTaskDidReceiveResponse;
+@property (readwrite, nonatomic, copy) AFURLSessionDataTaskDidBecomeDownloadTaskBlock dataTaskDidBecomeDownloadTask;
+@property (readwrite, nonatomic, copy) AFURLSessionDataTaskDidReceiveDataBlock dataTaskDidReceiveData;
+@property (readwrite, nonatomic, copy) AFURLSessionDataTaskWillCacheResponseBlock dataTaskWillCacheResponse;
+@property (readwrite, nonatomic, copy) AFURLSessionDownloadTaskDidFinishDownloadingBlock downloadTaskDidFinishDownloading;
+@property (readwrite, nonatomic, copy) AFURLSessionDownloadTaskDidWriteDataBlock downloadTaskDidWriteData;
+@property (readwrite, nonatomic, copy) AFURLSessionDownloadTaskDidResumeBlock downloadTaskDidResume;
+@end
+
+@implementation AFURLSessionManager
+
+- (instancetype)init {
+    return [self initWithSessionConfiguration:nil];
+}
+
+- (instancetype)initWithSessionConfiguration:(NSURLSessionConfiguration *)configuration {
+    self = [super init];
+    if (!self) {
+        return nil;
+    }
+
+    if (!configuration) {
+        configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
+    }
+
+    self.sessionConfiguration = configuration;
+
+    self.operationQueue = [[NSOperationQueue alloc] init];
+    self.operationQueue.maxConcurrentOperationCount = 1;
+
+    self.responseSerializer = [AFJSONResponseSerializer serializer];
+
+    self.securityPolicy = [AFSecurityPolicy defaultPolicy];
+
+#if !TARGET_OS_WATCH
+    self.reachabilityManager = [AFNetworkReachabilityManager sharedManager];
+#endif
+
+    self.mutableTaskDelegatesKeyedByTaskIdentifier = [[NSMutableDictionary alloc] init];
+
+    self.lock = [[NSLock alloc] init];
+    self.lock.name = AFURLSessionManagerLockName;
+
+    [self.session getTasksWithCompletionHandler:^(NSArray *dataTasks, NSArray *uploadTasks, NSArray *downloadTasks) {
+        for (NSURLSessionDataTask *task in dataTasks) {
+            [self addDelegateForDataTask:task uploadProgress:nil downloadProgress:nil completionHandler:nil];
+        }
+
+        for (NSURLSessionUploadTask *uploadTask in uploadTasks) {
+            [self addDelegateForUploadTask:uploadTask progress:nil completionHandler:nil];
+        }
+
+        for (NSURLSessionDownloadTask *downloadTask in downloadTasks) {
+            [self addDelegateForDownloadTask:downloadTask progress:nil destination:nil completionHandler:nil];
+        }
+    }];
+
+    return self;
+}
+
+- (void)dealloc {
+    [[NSNotificationCenter defaultCenter] removeObserver:self];
+}
+
+#pragma mark -
+
+- (NSURLSession *)session {
+    
+    @synchronized (self) {
+        if (!_session) {
+            _session = [NSURLSession sessionWithConfiguration:self.sessionConfiguration delegate:self delegateQueue:self.operationQueue];
+        }
+    }
+    return _session;
+}
+
+#pragma mark -
+
+
+- (NSString *)taskDescriptionForSessionTasks {
+    return [NSString stringWithFormat:@"%p", self];
+}
+
+- (void)taskDidResume:(NSNotification *)notification {
+    NSURLSessionTask *task = notification.object;
+    if ([task respondsToSelector:@selector(taskDescription)]) {
+        if ([task.taskDescription isEqualToString:self.taskDescriptionForSessionTasks]) {
+            dispatch_async(dispatch_get_main_queue(), ^{
+                [[NSNotificationCenter defaultCenter] postNotificationName:AFNetworkingTaskDidResumeNotification object:task];
+            });
+        }
+    }
+}
+
+- (void)taskDidSuspend:(NSNotification *)notification {
+    NSURLSessionTask *task = notification.object;
+    if ([task respondsToSelector:@selector(taskDescription)]) {
+        if ([task.taskDescription isEqualToString:self.taskDescriptionForSessionTasks]) {
+            dispatch_async(dispatch_get_main_queue(), ^{
+                [[NSNotificationCenter defaultCenter] postNotificationName:AFNetworkingTaskDidSuspendNotification object:task];
+            });
+        }
+    }
+}
+
+#pragma mark -
+
+- (AFURLSessionManagerTaskDelegate *)delegateForTask:(NSURLSessionTask *)task {
+    NSParameterAssert(task);
+
+    AFURLSessionManagerTaskDelegate *delegate = nil;
+    [self.lock lock];
+    delegate = self.mutableTaskDelegatesKeyedByTaskIdentifier[@(task.taskIdentifier)];
+    [self.lock unlock];
+
+    return delegate;
+}
+
+- (void)setDelegate:(AFURLSessionManagerTaskDelegate *)delegate
+            forTask:(NSURLSessionTask *)task
+{
+    NSParameterAssert(task);
+    NSParameterAssert(delegate);
+
+    [self.lock lock];
+    self.mutableTaskDelegatesKeyedByTaskIdentifier[@(task.taskIdentifier)] = delegate;
+    [self addNotificationObserverForTask:task];
+    [self.lock unlock];
+}
+
+- (void)addDelegateForDataTask:(NSURLSessionDataTask *)dataTask
+                uploadProgress:(nullable void (^)(NSProgress *uploadProgress)) uploadProgressBlock
+              downloadProgress:(nullable void (^)(NSProgress *downloadProgress)) downloadProgressBlock
+             completionHandler:(void (^)(NSURLResponse *response, id responseObject, NSError *error))completionHandler
+{
+    AFURLSessionManagerTaskDelegate *delegate = [[AFURLSessionManagerTaskDelegate alloc] initWithTask:dataTask];
+    delegate.manager = self;
+    delegate.completionHandler = completionHandler;
+
+    dataTask.taskDescription = self.taskDescriptionForSessionTasks;
+    [self setDelegate:delegate forTask:dataTask];
+
+    delegate.uploadProgressBlock = uploadProgressBlock;
+    delegate.downloadProgressBlock = downloadProgressBlock;
+}
+
+- (void)addDelegateForUploadTask:(NSURLSessionUploadTask *)uploadTask
+                        progress:(void (^)(NSProgress *uploadProgress)) uploadProgressBlock
+               completionHandler:(void (^)(NSURLResponse *response, id responseObject, NSError *error))completionHandler
+{
+    AFURLSessionManagerTaskDelegate *delegate = [[AFURLSessionManagerTaskDelegate alloc] initWithTask:uploadTask];
+    delegate.manager = self;
+    delegate.completionHandler = completionHandler;
+
+    uploadTask.taskDescription = self.taskDescriptionForSessionTasks;
+
+    [self setDelegate:delegate forTask:uploadTask];
+
+    delegate.uploadProgressBlock = uploadProgressBlock;
+}
+
+- (void)addDelegateForDownloadTask:(NSURLSessionDownloadTask *)downloadTask
+                          progress:(void (^)(NSProgress *downloadProgress)) downloadProgressBlock
+                       destination:(NSURL * (^)(NSURL *targetPath, NSURLResponse *response))destination
+                 completionHandler:(void (^)(NSURLResponse *response, NSURL *filePath, NSError *error))completionHandler
+{
+    AFURLSessionManagerTaskDelegate *delegate = [[AFURLSessionManagerTaskDelegate alloc] initWithTask:downloadTask];
+    delegate.manager = self;
+    delegate.completionHandler = completionHandler;
+
+    if (destination) {
+        delegate.downloadTaskDidFinishDownloading = ^NSURL * (NSURLSession * __unused session, NSURLSessionDownloadTask *task, NSURL *location) {
+            return destination(location, task.response);
+        };
+    }
+
+    downloadTask.taskDescription = self.taskDescriptionForSessionTasks;
+
+    [self setDelegate:delegate forTask:downloadTask];
+
+    delegate.downloadProgressBlock = downloadProgressBlock;
+}
+
+- (void)removeDelegateForTask:(NSURLSessionTask *)task {
+    NSParameterAssert(task);
+
+    [self.lock lock];
+    [self removeNotificationObserverForTask:task];
+    [self.mutableTaskDelegatesKeyedByTaskIdentifier removeObjectForKey:@(task.taskIdentifier)];
+    [self.lock unlock];
+}
+
+#pragma mark -
+
+- (NSArray *)tasksForKeyPath:(NSString *)keyPath {
+    __block NSArray *tasks = nil;
+    dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
+    [self.session getTasksWithCompletionHandler:^(NSArray *dataTasks, NSArray *uploadTasks, NSArray *downloadTasks) {
+        if ([keyPath isEqualToString:NSStringFromSelector(@selector(dataTasks))]) {
+            tasks = dataTasks;
+        } else if ([keyPath isEqualToString:NSStringFromSelector(@selector(uploadTasks))]) {
+            tasks = uploadTasks;
+        } else if ([keyPath isEqualToString:NSStringFromSelector(@selector(downloadTasks))]) {
+            tasks = downloadTasks;
+        } else if ([keyPath isEqualToString:NSStringFromSelector(@selector(tasks))]) {
+            tasks = [@[dataTasks, uploadTasks, downloadTasks] valueForKeyPath:@"@unionOfArrays.self"];
+        }
+
+        dispatch_semaphore_signal(semaphore);
+    }];
+
+    dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);
+
+    return tasks;
+}
+
+- (NSArray *)tasks {
+    return [self tasksForKeyPath:NSStringFromSelector(_cmd)];
+}
+
+- (NSArray *)dataTasks {
+    return [self tasksForKeyPath:NSStringFromSelector(_cmd)];
+}
+
+- (NSArray *)uploadTasks {
+    return [self tasksForKeyPath:NSStringFromSelector(_cmd)];
+}
+
+- (NSArray *)downloadTasks {
+    return [self tasksForKeyPath:NSStringFromSelector(_cmd)];
+}
+
+#pragma mark -
+
+- (void)invalidateSessionCancelingTasks:(BOOL)cancelPendingTasks resetSession:(BOOL)resetSession {
+    if (cancelPendingTasks) {
+        [self.session invalidateAndCancel];
+    } else {
+        [self.session finishTasksAndInvalidate];
+    }
+    if (resetSession) {
+        self.session = nil;
+    }
+}
+
+#pragma mark -
+
+- (void)setResponseSerializer:(id <AFURLResponseSerialization>)responseSerializer {
+    NSParameterAssert(responseSerializer);
+
+    _responseSerializer = responseSerializer;
+}
+
+#pragma mark -
+- (void)addNotificationObserverForTask:(NSURLSessionTask *)task {
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(taskDidResume:) name:AFNSURLSessionTaskDidResumeNotification object:task];
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(taskDidSuspend:) name:AFNSURLSessionTaskDidSuspendNotification object:task];
+}
+
+- (void)removeNotificationObserverForTask:(NSURLSessionTask *)task {
+    [[NSNotificationCenter defaultCenter] removeObserver:self name:AFNSURLSessionTaskDidSuspendNotification object:task];
+    [[NSNotificationCenter defaultCenter] removeObserver:self name:AFNSURLSessionTaskDidResumeNotification object:task];
+}
+
+#pragma mark -
+
+- (NSURLSessionDataTask *)dataTaskWithRequest:(NSURLRequest *)request
+                               uploadProgress:(nullable void (^)(NSProgress *uploadProgress)) uploadProgressBlock
+                             downloadProgress:(nullable void (^)(NSProgress *downloadProgress)) downloadProgressBlock
+                            completionHandler:(nullable void (^)(NSURLResponse *response, id _Nullable responseObject,  NSError * _Nullable error))completionHandler {
+
+    NSURLSessionDataTask *dataTask = [self.session dataTaskWithRequest:request];
+
+    [self addDelegateForDataTask:dataTask uploadProgress:uploadProgressBlock downloadProgress:downloadProgressBlock completionHandler:completionHandler];
+
+    return dataTask;
+}
+
+#pragma mark -
+
+- (NSURLSessionUploadTask *)uploadTaskWithRequest:(NSURLRequest *)request
+                                         fromFile:(NSURL *)fileURL
+                                         progress:(void (^)(NSProgress *uploadProgress)) uploadProgressBlock
+                                completionHandler:(void (^)(NSURLResponse *response, id responseObject, NSError *error))completionHandler
+{
+    NSURLSessionUploadTask *uploadTask = [self.session uploadTaskWithRequest:request fromFile:fileURL];
+    
+    if (uploadTask) {
+        [self addDelegateForUploadTask:uploadTask
+                              progress:uploadProgressBlock
+                     completionHandler:completionHandler];
+    }
+
+    return uploadTask;
+}
+
+- (NSURLSessionUploadTask *)uploadTaskWithRequest:(NSURLRequest *)request
+                                         fromData:(NSData *)bodyData
+                                         progress:(void (^)(NSProgress *uploadProgress)) uploadProgressBlock
+                                completionHandler:(void (^)(NSURLResponse *response, id responseObject, NSError *error))completionHandler
+{
+    NSURLSessionUploadTask *uploadTask = [self.session uploadTaskWithRequest:request fromData:bodyData];
+    
+    [self addDelegateForUploadTask:uploadTask progress:uploadProgressBlock completionHandler:completionHandler];
+
+    return uploadTask;
+}
+
+- (NSURLSessionUploadTask *)uploadTaskWithStreamedRequest:(NSURLRequest *)request
+                                                 progress:(void (^)(NSProgress *uploadProgress)) uploadProgressBlock
+                                        completionHandler:(void (^)(NSURLResponse *response, id responseObject, NSError *error))completionHandler
+{
+    NSURLSessionUploadTask *uploadTask = [self.session uploadTaskWithStreamedRequest:request];
+
+    [self addDelegateForUploadTask:uploadTask progress:uploadProgressBlock completionHandler:completionHandler];
+
+    return uploadTask;
+}
+
+#pragma mark -
+
+- (NSURLSessionDownloadTask *)downloadTaskWithRequest:(NSURLRequest *)request
+                                             progress:(void (^)(NSProgress *downloadProgress)) downloadProgressBlock
+                                          destination:(NSURL * (^)(NSURL *targetPath, NSURLResponse *response))destination
+                                    completionHandler:(void (^)(NSURLResponse *response, NSURL *filePath, NSError *error))completionHandler
+{
+    NSURLSessionDownloadTask *downloadTask = [self.session downloadTaskWithRequest:request];
+    
+    [self addDelegateForDownloadTask:downloadTask progress:downloadProgressBlock destination:destination completionHandler:completionHandler];
+
+    return downloadTask;
+}
+
+- (NSURLSessionDownloadTask *)downloadTaskWithResumeData:(NSData *)resumeData
+                                                progress:(void (^)(NSProgress *downloadProgress)) downloadProgressBlock
+                                             destination:(NSURL * (^)(NSURL *targetPath, NSURLResponse *response))destination
+                                       completionHandler:(void (^)(NSURLResponse *response, NSURL *filePath, NSError *error))completionHandler
+{
+    NSURLSessionDownloadTask *downloadTask = [self.session downloadTaskWithResumeData:resumeData];
+
+    [self addDelegateForDownloadTask:downloadTask progress:downloadProgressBlock destination:destination completionHandler:completionHandler];
+
+    return downloadTask;
+}
+
+#pragma mark -
+- (NSProgress *)uploadProgressForTask:(NSURLSessionTask *)task {
+    return [[self delegateForTask:task] uploadProgress];
+}
+
+- (NSProgress *)downloadProgressForTask:(NSURLSessionTask *)task {
+    return [[self delegateForTask:task] downloadProgress];
+}
+
+#pragma mark -
+
+- (void)setSessionDidBecomeInvalidBlock:(void (^)(NSURLSession *session, NSError *error))block {
+    self.sessionDidBecomeInvalid = block;
+}
+
+- (void)setSessionDidReceiveAuthenticationChallengeBlock:(NSURLSessionAuthChallengeDisposition (^)(NSURLSession *session, NSURLAuthenticationChallenge *challenge, NSURLCredential * __autoreleasing *credential))block {
+    self.sessionDidReceiveAuthenticationChallenge = block;
+}
+
+#if !TARGET_OS_OSX
+- (void)setDidFinishEventsForBackgroundURLSessionBlock:(void (^)(NSURLSession *session))block {
+    self.didFinishEventsForBackgroundURLSession = block;
+}
+#endif
+
+#pragma mark -
+
+- (void)setTaskNeedNewBodyStreamBlock:(NSInputStream * (^)(NSURLSession *session, NSURLSessionTask *task))block {
+    self.taskNeedNewBodyStream = block;
+}
+
+- (void)setTaskWillPerformHTTPRedirectionBlock:(NSURLRequest * (^)(NSURLSession *session, NSURLSessionTask *task, NSURLResponse *response, NSURLRequest *request))block {
+    self.taskWillPerformHTTPRedirection = block;
+}
+
+- (void)setTaskDidSendBodyDataBlock:(void (^)(NSURLSession *session, NSURLSessionTask *task, int64_t bytesSent, int64_t totalBytesSent, int64_t totalBytesExpectedToSend))block {
+    self.taskDidSendBodyData = block;
+}
+
+- (void)setTaskDidCompleteBlock:(void (^)(NSURLSession *session, NSURLSessionTask *task, NSError *error))block {
+    self.taskDidComplete = block;
+}
+
+#if AF_CAN_INCLUDE_SESSION_TASK_METRICS
+- (void)setTaskDidFinishCollectingMetricsBlock:(void (^)(NSURLSession * _Nonnull, NSURLSessionTask * _Nonnull, NSURLSessionTaskMetrics * _Nullable))block AF_API_AVAILABLE(ios(10), macosx(10.12), watchos(3), tvos(10)) {
+    self.taskDidFinishCollectingMetrics = block;
+}
+#endif
+
+#pragma mark -
+
+- (void)setDataTaskDidReceiveResponseBlock:(NSURLSessionResponseDisposition (^)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSURLResponse *response))block {
+    self.dataTaskDidReceiveResponse = block;
+}
+
+- (void)setDataTaskDidBecomeDownloadTaskBlock:(void (^)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSURLSessionDownloadTask *downloadTask))block {
+    self.dataTaskDidBecomeDownloadTask = block;
+}
+
+- (void)setDataTaskDidReceiveDataBlock:(void (^)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSData *data))block {
+    self.dataTaskDidReceiveData = block;
+}
+
+- (void)setDataTaskWillCacheResponseBlock:(NSCachedURLResponse * (^)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSCachedURLResponse *proposedResponse))block {
+    self.dataTaskWillCacheResponse = block;
+}
+
+#pragma mark -
+
+- (void)setDownloadTaskDidFinishDownloadingBlock:(NSURL * (^)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, NSURL *location))block {
+    self.downloadTaskDidFinishDownloading = block;
+}
+
+- (void)setDownloadTaskDidWriteDataBlock:(void (^)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, int64_t bytesWritten, int64_t totalBytesWritten, int64_t totalBytesExpectedToWrite))block {
+    self.downloadTaskDidWriteData = block;
+}
+
+- (void)setDownloadTaskDidResumeBlock:(void (^)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, int64_t fileOffset, int64_t expectedTotalBytes))block {
+    self.downloadTaskDidResume = block;
+}
+
+#pragma mark - NSObject
+
+- (NSString *)description {
+    return [NSString stringWithFormat:@"<%@: %p, session: %@, operationQueue: %@>", NSStringFromClass([self class]), self, self.session, self.operationQueue];
+}
+
+- (BOOL)respondsToSelector:(SEL)selector {
+    if (selector == @selector(URLSession:didReceiveChallenge:completionHandler:)) {
+        return self.sessionDidReceiveAuthenticationChallenge != nil;
+    } else if (selector == @selector(URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:)) {
+        return self.taskWillPerformHTTPRedirection != nil;
+    } else if (selector == @selector(URLSession:dataTask:didReceiveResponse:completionHandler:)) {
+        return self.dataTaskDidReceiveResponse != nil;
+    } else if (selector == @selector(URLSession:dataTask:willCacheResponse:completionHandler:)) {
+        return self.dataTaskWillCacheResponse != nil;
+    }
+#if !TARGET_OS_OSX
+    else if (selector == @selector(URLSessionDidFinishEventsForBackgroundURLSession:)) {
+        return self.didFinishEventsForBackgroundURLSession != nil;
+    }
+#endif
+
+    return [[self class] instancesRespondToSelector:selector];
+}
+
+#pragma mark - NSURLSessionDelegate
+
+- (void)URLSession:(NSURLSession *)session
+didBecomeInvalidWithError:(NSError *)error
+{
+    if (self.sessionDidBecomeInvalid) {
+        self.sessionDidBecomeInvalid(session, error);
+    }
+
+    [[NSNotificationCenter defaultCenter] postNotificationName:AFURLSessionDidInvalidateNotification object:session];
+}
+
+- (void)URLSession:(NSURLSession *)session
+didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge
+ completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler
+{
+    NSAssert(self.sessionDidReceiveAuthenticationChallenge != nil, @"`respondsToSelector:` implementation forces `URLSession:didReceiveChallenge:completionHandler:` to be called only if `self.sessionDidReceiveAuthenticationChallenge` is not nil");
+
+    NSURLCredential *credential = nil;
+    NSURLSessionAuthChallengeDisposition disposition = self.sessionDidReceiveAuthenticationChallenge(session, challenge, &credential);
+
+    if (completionHandler) {
+        completionHandler(disposition, credential);
+    }
+}
+
+#pragma mark - NSURLSessionTaskDelegate
+
+- (void)URLSession:(NSURLSession *)session
+              task:(NSURLSessionTask *)task
+willPerformHTTPRedirection:(NSHTTPURLResponse *)response
+        newRequest:(NSURLRequest *)request
+ completionHandler:(void (^)(NSURLRequest *))completionHandler
+{
+    NSURLRequest *redirectRequest = request;
+
+    if (self.taskWillPerformHTTPRedirection) {
+        redirectRequest = self.taskWillPerformHTTPRedirection(session, task, response, request);
+    }
+
+    if (completionHandler) {
+        completionHandler(redirectRequest);
+    }
+}
+
+- (void)URLSession:(NSURLSession *)session
+              task:(NSURLSessionTask *)task
+didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge
+ completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler
+{
+    BOOL evaluateServerTrust = NO;
+    NSURLSessionAuthChallengeDisposition disposition = NSURLSessionAuthChallengePerformDefaultHandling;
+    NSURLCredential *credential = nil;
+
+    if (self.authenticationChallengeHandler) {
+        id result = self.authenticationChallengeHandler(session, task, challenge, completionHandler);
+        if (result == nil) {
+            return;
+        } else if ([result isKindOfClass:NSError.class]) {
+            objc_setAssociatedObject(task, AuthenticationChallengeErrorKey, result, OBJC_ASSOCIATION_RETAIN);
+            disposition = NSURLSessionAuthChallengeCancelAuthenticationChallenge;
+        } else if ([result isKindOfClass:NSURLCredential.class]) {
+            credential = result;
+            disposition = NSURLSessionAuthChallengeUseCredential;
+        } else if ([result isKindOfClass:NSNumber.class]) {
+            disposition = [result integerValue];
+            NSAssert(disposition == NSURLSessionAuthChallengePerformDefaultHandling || disposition == NSURLSessionAuthChallengeCancelAuthenticationChallenge || disposition == NSURLSessionAuthChallengeRejectProtectionSpace, @"");
+            evaluateServerTrust = disposition == NSURLSessionAuthChallengePerformDefaultHandling && [challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust];
+        } else {
+            @throw [NSException exceptionWithName:@"Invalid Return Value" reason:@"The return value from the authentication challenge handler must be nil, an NSError, an NSURLCredential or an NSNumber." userInfo:nil];
+        }
+    } else {
+        evaluateServerTrust = [challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust];
+    }
+
+    if (evaluateServerTrust) {
+        if ([self.securityPolicy evaluateServerTrust:challenge.protectionSpace.serverTrust forDomain:challenge.protectionSpace.host]) {
+            disposition = NSURLSessionAuthChallengeUseCredential;
+            credential = [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust];
+        } else {
+            objc_setAssociatedObject(task, AuthenticationChallengeErrorKey,
+                                     [self serverTrustErrorForServerTrust:challenge.protectionSpace.serverTrust url:task.currentRequest.URL],
+                                     OBJC_ASSOCIATION_RETAIN);
+            disposition = NSURLSessionAuthChallengeCancelAuthenticationChallenge;
+        }
+    }
+
+    if (completionHandler) {
+        completionHandler(disposition, credential);
+    }
+}
+
+- (nonnull NSError *)serverTrustErrorForServerTrust:(nullable SecTrustRef)serverTrust url:(nullable NSURL *)url
+{
+    NSBundle *CFNetworkBundle = [NSBundle bundleWithIdentifier:@"com.apple.CFNetwork"];
+    NSString *defaultValue = @"The certificate for this server is invalid. You might be connecting to a server that is pretending to be “%@” which could put your confidential information at risk.";
+    NSString *descriptionFormat = NSLocalizedStringWithDefaultValue(@"Err-1202.w", nil, CFNetworkBundle, defaultValue, @"") ?: defaultValue;
+    NSString *localizedDescription = [descriptionFormat componentsSeparatedByString:@"%@"].count <= 2 ? [NSString localizedStringWithFormat:descriptionFormat, url.host] : descriptionFormat;
+    NSMutableDictionary *userInfo = [@{
+        NSLocalizedDescriptionKey: localizedDescription
+    } mutableCopy];
+
+    if (serverTrust) {
+        userInfo[NSURLErrorFailingURLPeerTrustErrorKey] = (__bridge id)serverTrust;
+    }
+
+    if (url) {
+        userInfo[NSURLErrorFailingURLErrorKey] = url;
+
+        if (url.absoluteString) {
+            userInfo[NSURLErrorFailingURLStringErrorKey] = url.absoluteString;
+        }
+    }
+
+    return [NSError errorWithDomain:NSURLErrorDomain code:NSURLErrorServerCertificateUntrusted userInfo:userInfo];
+}
+
+- (void)URLSession:(NSURLSession *)session
+              task:(NSURLSessionTask *)task
+ needNewBodyStream:(void (^)(NSInputStream *bodyStream))completionHandler
+{
+    NSInputStream *inputStream = nil;
+
+    if (self.taskNeedNewBodyStream) {
+        inputStream = self.taskNeedNewBodyStream(session, task);
+    } else if (task.originalRequest.HTTPBodyStream && [task.originalRequest.HTTPBodyStream conformsToProtocol:@protocol(NSCopying)]) {
+        inputStream = [task.originalRequest.HTTPBodyStream copy];
+    }
+
+    if (completionHandler) {
+        completionHandler(inputStream);
+    }
+}
+
+- (void)URLSession:(NSURLSession *)session
+              task:(NSURLSessionTask *)task
+   didSendBodyData:(int64_t)bytesSent
+    totalBytesSent:(int64_t)totalBytesSent
+totalBytesExpectedToSend:(int64_t)totalBytesExpectedToSend
+{
+
+    int64_t totalUnitCount = totalBytesExpectedToSend;
+    if (totalUnitCount == NSURLSessionTransferSizeUnknown) {
+        NSString *contentLength = [task.originalRequest valueForHTTPHeaderField:@"Content-Length"];
+        if (contentLength) {
+            totalUnitCount = (int64_t) [contentLength longLongValue];
+        }
+    }
+    
+    AFURLSessionManagerTaskDelegate *delegate = [self delegateForTask:task];
+    
+    if (delegate) {
+        [delegate URLSession:session task:task didSendBodyData:bytesSent totalBytesSent:totalBytesSent totalBytesExpectedToSend:totalBytesExpectedToSend];
+    }
+
+    if (self.taskDidSendBodyData) {
+        self.taskDidSendBodyData(session, task, bytesSent, totalBytesSent, totalUnitCount);
+    }
+}
+
+- (void)URLSession:(NSURLSession *)session
+              task:(NSURLSessionTask *)task
+didCompleteWithError:(NSError *)error
+{
+    AFURLSessionManagerTaskDelegate *delegate = [self delegateForTask:task];
+
+    // delegate may be nil when completing a task in the background
+    if (delegate) {
+        [delegate URLSession:session task:task didCompleteWithError:error];
+
+        [self removeDelegateForTask:task];
+    }
+
+    if (self.taskDidComplete) {
+        self.taskDidComplete(session, task, error);
+    }
+}
+
+#if AF_CAN_INCLUDE_SESSION_TASK_METRICS
+- (void)URLSession:(NSURLSession *)session
+              task:(NSURLSessionTask *)task
+didFinishCollectingMetrics:(NSURLSessionTaskMetrics *)metrics AF_API_AVAILABLE(ios(10), macosx(10.12), watchos(3), tvos(10))
+{
+    AFURLSessionManagerTaskDelegate *delegate = [self delegateForTask:task];
+    // Metrics may fire after URLSession:task:didCompleteWithError: is called, delegate may be nil
+    if (delegate) {
+        [delegate URLSession:session task:task didFinishCollectingMetrics:metrics];
+    }
+
+    if (self.taskDidFinishCollectingMetrics) {
+        self.taskDidFinishCollectingMetrics(session, task, metrics);
+    }
+}
+#endif
+
+#pragma mark - NSURLSessionDataDelegate
+
+- (void)URLSession:(NSURLSession *)session
+          dataTask:(NSURLSessionDataTask *)dataTask
+didReceiveResponse:(NSURLResponse *)response
+ completionHandler:(void (^)(NSURLSessionResponseDisposition disposition))completionHandler
+{
+    NSURLSessionResponseDisposition disposition = NSURLSessionResponseAllow;
+
+    if (self.dataTaskDidReceiveResponse) {
+        disposition = self.dataTaskDidReceiveResponse(session, dataTask, response);
+    }
+
+    if (completionHandler) {
+        completionHandler(disposition);
+    }
+}
+
+- (void)URLSession:(NSURLSession *)session
+          dataTask:(NSURLSessionDataTask *)dataTask
+didBecomeDownloadTask:(NSURLSessionDownloadTask *)downloadTask
+{
+    AFURLSessionManagerTaskDelegate *delegate = [self delegateForTask:dataTask];
+    if (delegate) {
+        [self removeDelegateForTask:dataTask];
+        [self setDelegate:delegate forTask:downloadTask];
+    }
+
+    if (self.dataTaskDidBecomeDownloadTask) {
+        self.dataTaskDidBecomeDownloadTask(session, dataTask, downloadTask);
+    }
+}
+
+- (void)URLSession:(NSURLSession *)session
+          dataTask:(NSURLSessionDataTask *)dataTask
+    didReceiveData:(NSData *)data
+{
+
+    AFURLSessionManagerTaskDelegate *delegate = [self delegateForTask:dataTask];
+    [delegate URLSession:session dataTask:dataTask didReceiveData:data];
+
+    if (self.dataTaskDidReceiveData) {
+        self.dataTaskDidReceiveData(session, dataTask, data);
+    }
+}
+
+- (void)URLSession:(NSURLSession *)session
+          dataTask:(NSURLSessionDataTask *)dataTask
+ willCacheResponse:(NSCachedURLResponse *)proposedResponse
+ completionHandler:(void (^)(NSCachedURLResponse *cachedResponse))completionHandler
+{
+    NSCachedURLResponse *cachedResponse = proposedResponse;
+
+    if (self.dataTaskWillCacheResponse) {
+        cachedResponse = self.dataTaskWillCacheResponse(session, dataTask, proposedResponse);
+    }
+
+    if (completionHandler) {
+        completionHandler(cachedResponse);
+    }
+}
+
+#if !TARGET_OS_OSX
+- (void)URLSessionDidFinishEventsForBackgroundURLSession:(NSURLSession *)session {
+    if (self.didFinishEventsForBackgroundURLSession) {
+        dispatch_async(dispatch_get_main_queue(), ^{
+            self.didFinishEventsForBackgroundURLSession(session);
+        });
+    }
+}
+#endif
+
+#pragma mark - NSURLSessionDownloadDelegate
+
+- (void)URLSession:(NSURLSession *)session
+      downloadTask:(NSURLSessionDownloadTask *)downloadTask
+didFinishDownloadingToURL:(NSURL *)location
+{
+    AFURLSessionManagerTaskDelegate *delegate = [self delegateForTask:downloadTask];
+    if (self.downloadTaskDidFinishDownloading) {
+        NSURL *fileURL = self.downloadTaskDidFinishDownloading(session, downloadTask, location);
+        if (fileURL) {
+            delegate.downloadFileURL = fileURL;
+            NSError *error = nil;
+            
+            if (![[NSFileManager defaultManager] moveItemAtURL:location toURL:fileURL error:&error]) {
+                [[NSNotificationCenter defaultCenter] postNotificationName:AFURLSessionDownloadTaskDidFailToMoveFileNotification object:downloadTask userInfo:error.userInfo];
+            } else {
+                [[NSNotificationCenter defaultCenter] postNotificationName:AFURLSessionDownloadTaskDidMoveFileSuccessfullyNotification object:downloadTask userInfo:nil];
+            }
+
+            return;
+        }
+    }
+
+    if (delegate) {
+        [delegate URLSession:session downloadTask:downloadTask didFinishDownloadingToURL:location];
+    }
+}
+
+- (void)URLSession:(NSURLSession *)session
+      downloadTask:(NSURLSessionDownloadTask *)downloadTask
+      didWriteData:(int64_t)bytesWritten
+ totalBytesWritten:(int64_t)totalBytesWritten
+totalBytesExpectedToWrite:(int64_t)totalBytesExpectedToWrite
+{
+    
+    AFURLSessionManagerTaskDelegate *delegate = [self delegateForTask:downloadTask];
+    
+    if (delegate) {
+        [delegate URLSession:session downloadTask:downloadTask didWriteData:bytesWritten totalBytesWritten:totalBytesWritten totalBytesExpectedToWrite:totalBytesExpectedToWrite];
+    }
+
+    if (self.downloadTaskDidWriteData) {
+        self.downloadTaskDidWriteData(session, downloadTask, bytesWritten, totalBytesWritten, totalBytesExpectedToWrite);
+    }
+}
+
+- (void)URLSession:(NSURLSession *)session
+      downloadTask:(NSURLSessionDownloadTask *)downloadTask
+ didResumeAtOffset:(int64_t)fileOffset
+expectedTotalBytes:(int64_t)expectedTotalBytes
+{
+    
+    AFURLSessionManagerTaskDelegate *delegate = [self delegateForTask:downloadTask];
+    
+    if (delegate) {
+        [delegate URLSession:session downloadTask:downloadTask didResumeAtOffset:fileOffset expectedTotalBytes:expectedTotalBytes];
+    }
+
+    if (self.downloadTaskDidResume) {
+        self.downloadTaskDidResume(session, downloadTask, fileOffset, expectedTotalBytes);
+    }
+}
+
+#pragma mark - NSSecureCoding
+
++ (BOOL)supportsSecureCoding {
+    return YES;
+}
+
+- (instancetype)initWithCoder:(NSCoder *)decoder {
+    NSURLSessionConfiguration *configuration = [decoder decodeObjectOfClass:[NSURLSessionConfiguration class] forKey:@"sessionConfiguration"];
+
+    self = [self initWithSessionConfiguration:configuration];
+    if (!self) {
+        return nil;
+    }
+
+    return self;
+}
+
+- (void)encodeWithCoder:(NSCoder *)coder {
+    [coder encodeObject:self.session.configuration forKey:@"sessionConfiguration"];
+}
+
+#pragma mark - NSCopying
+
+- (instancetype)copyWithZone:(NSZone *)zone {
+    return [[[self class] allocWithZone:zone] initWithSessionConfiguration:self.session.configuration];
+}
+
+@end

+ 19 - 0
Pods/AFNetworking/LICENSE

@@ -0,0 +1,19 @@
+Copyright (c) 2011-2020 Alamofire Software Foundation (http://alamofire.org/)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.

+ 298 - 0
Pods/AFNetworking/README.md

@@ -0,0 +1,298 @@
+<p align="center" >
+  <img src="https://raw.github.com/AFNetworking/AFNetworking/assets/afnetworking-logo.png" alt="AFNetworking" title="AFNetworking">
+</p>
+
+[![Build Status](https://github.com/AFNetworking/AFNetworking/workflows/AFNetworking%20CI/badge.svg?branch=master)](https://github.com/AFNetworking/AFNetworking/actions)
+[![CocoaPods Compatible](https://img.shields.io/cocoapods/v/AFNetworking.svg)](https://img.shields.io/cocoapods/v/AFNetworking.svg)
+[![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
+[![Platform](https://img.shields.io/cocoapods/p/AFNetworking.svg?style=flat)](http://cocoadocs.org/docsets/AFNetworking)
+[![Twitter](https://img.shields.io/badge/twitter-@AFNetworking-blue.svg?style=flat)](http://twitter.com/AFNetworking)
+
+AFNetworking is a delightful networking library for iOS, macOS, watchOS, and tvOS. It's built on top of the [Foundation URL Loading System](https://developer.apple.com/documentation/foundation/url_loading_system), extending the powerful high-level networking abstractions built into Cocoa. It has a modular architecture with well-designed, feature-rich APIs that are a joy to use.
+
+Perhaps the most important feature of all, however, is the amazing community of developers who use and contribute to AFNetworking every day. AFNetworking powers some of the most popular and critically-acclaimed apps on the iPhone, iPad, and Mac.
+
+## How To Get Started
+
+- [Download AFNetworking](https://github.com/AFNetworking/AFNetworking/archive/master.zip) and try out the included Mac and iPhone example apps
+- Read the ["Getting Started" guide](https://github.com/AFNetworking/AFNetworking/wiki/Getting-Started-with-AFNetworking), [FAQ](https://github.com/AFNetworking/AFNetworking/wiki/AFNetworking-FAQ), or [other articles on the Wiki](https://github.com/AFNetworking/AFNetworking/wiki)
+
+## Communication
+
+- If you **need help**, use [Stack Overflow](http://stackoverflow.com/questions/tagged/afnetworking). (Tag 'afnetworking')
+- If you'd like to **ask a general question**, use [Stack Overflow](http://stackoverflow.com/questions/tagged/afnetworking).
+- If you **found a bug**, _and can provide steps to reliably reproduce it_, open an issue.
+- If you **have a feature request**, open an issue.
+- If you **want to contribute**, submit a pull request.
+
+## Installation
+AFNetworking supports multiple methods for installing the library in a project.
+
+## Installation with CocoaPods
+
+To integrate AFNetworking into your Xcode project using CocoaPods, specify it in your `Podfile`:
+
+```ruby
+pod 'AFNetworking', '~> 4.0'
+```
+
+### Installation with Swift Package Manager
+
+Once you have your Swift package set up, adding AFNetworking as a dependency is as easy as adding it to the `dependencies` value of your `Package.swift`.
+
+```swift
+dependencies: [
+    .package(url: "https://github.com/AFNetworking/AFNetworking.git", .upToNextMajor(from: "4.0.0"))
+]
+```
+
+> Note: AFNetworking's Swift package does not include it's UIKit extensions.
+
+### Installation with Carthage
+
+[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. To integrate AFNetworking, add the following to your `Cartfile`.
+
+```ogdl
+github "AFNetworking/AFNetworking" ~> 4.0
+```
+
+## Requirements
+
+| AFNetworking Version | Minimum iOS Target  | Minimum macOS Target  | Minimum watchOS Target  | Minimum tvOS Target  |                                   Notes                                   |
+|:--------------------:|:---------------------------:|:----------------------------:|:----------------------------:|:----------------------------:|:-------------------------------------------------------------------------:|
+| 4.x | iOS 9 | macOS 10.10 | watchOS 2.0 | tvOS 9.0 | Xcode 11+ is required. |
+| 3.x | iOS 7 | OS X 10.9 | watchOS 2.0 | tvOS 9.0 | Xcode 7+ is required. `NSURLConnectionOperation` support has been removed. |
+| 2.6 -> 2.6.3 | iOS 7 | OS X 10.9 | watchOS 2.0 | n/a | Xcode 7+ is required. |
+| 2.0 -> 2.5.4 | iOS 6 | OS X 10.8 | n/a | n/a | Xcode 5+ is required. `NSURLSession` subspec requires iOS 7 or OS X 10.9. |
+| 1.x | iOS 5 | Mac OS X 10.7 | n/a | n/a |
+| 0.10.x | iOS 4 | Mac OS X 10.6 | n/a | n/a |
+
+(macOS projects must support [64-bit with modern Cocoa runtime](https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/ObjCRuntimeGuide/Articles/ocrtVersionsPlatforms.html)).
+
+> Programming in Swift? Try [Alamofire](https://github.com/Alamofire/Alamofire) for a more conventional set of APIs.
+
+## Architecture
+
+### NSURLSession
+
+- `AFURLSessionManager`
+- `AFHTTPSessionManager`
+
+### Serialization
+
+* `<AFURLRequestSerialization>`
+  - `AFHTTPRequestSerializer`
+  - `AFJSONRequestSerializer`
+  - `AFPropertyListRequestSerializer`
+* `<AFURLResponseSerialization>`
+  - `AFHTTPResponseSerializer`
+  - `AFJSONResponseSerializer`
+  - `AFXMLParserResponseSerializer`
+  - `AFXMLDocumentResponseSerializer` _(macOS)_
+  - `AFPropertyListResponseSerializer`
+  - `AFImageResponseSerializer`
+  - `AFCompoundResponseSerializer`
+
+### Additional Functionality
+
+- `AFSecurityPolicy`
+- `AFNetworkReachabilityManager`
+
+## Usage
+
+### AFURLSessionManager
+
+`AFURLSessionManager` creates and manages an `NSURLSession` object based on a specified `NSURLSessionConfiguration` object, which conforms to `<NSURLSessionTaskDelegate>`, `<NSURLSessionDataDelegate>`, `<NSURLSessionDownloadDelegate>`, and `<NSURLSessionDelegate>`.
+
+#### Creating a Download Task
+
+```objective-c
+NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
+AFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfiguration:configuration];
+
+NSURL *URL = [NSURL URLWithString:@"http://example.com/download.zip"];
+NSURLRequest *request = [NSURLRequest requestWithURL:URL];
+
+NSURLSessionDownloadTask *downloadTask = [manager downloadTaskWithRequest:request progress:nil destination:^NSURL *(NSURL *targetPath, NSURLResponse *response) {
+    NSURL *documentsDirectoryURL = [[NSFileManager defaultManager] URLForDirectory:NSDocumentDirectory inDomain:NSUserDomainMask appropriateForURL:nil create:NO error:nil];
+    return [documentsDirectoryURL URLByAppendingPathComponent:[response suggestedFilename]];
+} completionHandler:^(NSURLResponse *response, NSURL *filePath, NSError *error) {
+    NSLog(@"File downloaded to: %@", filePath);
+}];
+[downloadTask resume];
+```
+
+#### Creating an Upload Task
+
+```objective-c
+NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
+AFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfiguration:configuration];
+
+NSURL *URL = [NSURL URLWithString:@"http://example.com/upload"];
+NSURLRequest *request = [NSURLRequest requestWithURL:URL];
+
+NSURL *filePath = [NSURL fileURLWithPath:@"file://path/to/image.png"];
+NSURLSessionUploadTask *uploadTask = [manager uploadTaskWithRequest:request fromFile:filePath progress:nil completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) {
+    if (error) {
+        NSLog(@"Error: %@", error);
+    } else {
+        NSLog(@"Success: %@ %@", response, responseObject);
+    }
+}];
+[uploadTask resume];
+```
+
+#### Creating an Upload Task for a Multi-Part Request, with Progress
+
+```objective-c
+NSMutableURLRequest *request = [[AFHTTPRequestSerializer serializer] multipartFormRequestWithMethod:@"POST" URLString:@"http://example.com/upload" parameters:nil constructingBodyWithBlock:^(id<AFMultipartFormData> formData) {
+        [formData appendPartWithFileURL:[NSURL fileURLWithPath:@"file://path/to/image.jpg"] name:@"file" fileName:@"filename.jpg" mimeType:@"image/jpeg" error:nil];
+    } error:nil];
+
+AFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]];
+
+NSURLSessionUploadTask *uploadTask;
+uploadTask = [manager
+              uploadTaskWithStreamedRequest:request
+              progress:^(NSProgress * _Nonnull uploadProgress) {
+                  // This is not called back on the main queue.
+                  // You are responsible for dispatching to the main queue for UI updates
+                  dispatch_async(dispatch_get_main_queue(), ^{
+                      //Update the progress view
+                      [progressView setProgress:uploadProgress.fractionCompleted];
+                  });
+              }
+              completionHandler:^(NSURLResponse * _Nonnull response, id  _Nullable responseObject, NSError * _Nullable error) {
+                  if (error) {
+                      NSLog(@"Error: %@", error);
+                  } else {
+                      NSLog(@"%@ %@", response, responseObject);
+                  }
+              }];
+
+[uploadTask resume];
+```
+
+#### Creating a Data Task
+
+```objective-c
+NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
+AFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfiguration:configuration];
+
+NSURL *URL = [NSURL URLWithString:@"http://httpbin.org/get"];
+NSURLRequest *request = [NSURLRequest requestWithURL:URL];
+
+NSURLSessionDataTask *dataTask = [manager dataTaskWithRequest:request completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) {
+    if (error) {
+        NSLog(@"Error: %@", error);
+    } else {
+        NSLog(@"%@ %@", response, responseObject);
+    }
+}];
+[dataTask resume];
+```
+
+---
+
+### Request Serialization
+
+Request serializers create requests from URL strings, encoding parameters as either a query string or HTTP body.
+
+```objective-c
+NSString *URLString = @"http://example.com";
+NSDictionary *parameters = @{@"foo": @"bar", @"baz": @[@1, @2, @3]};
+```
+
+#### Query String Parameter Encoding
+
+```objective-c
+[[AFHTTPRequestSerializer serializer] requestWithMethod:@"GET" URLString:URLString parameters:parameters error:nil];
+```
+
+    GET http://example.com?foo=bar&baz[]=1&baz[]=2&baz[]=3
+
+#### URL Form Parameter Encoding
+
+```objective-c
+[[AFHTTPRequestSerializer serializer] requestWithMethod:@"POST" URLString:URLString parameters:parameters error:nil];
+```
+
+    POST http://example.com/
+    Content-Type: application/x-www-form-urlencoded
+
+    foo=bar&baz[]=1&baz[]=2&baz[]=3
+
+#### JSON Parameter Encoding
+
+```objective-c
+[[AFJSONRequestSerializer serializer] requestWithMethod:@"POST" URLString:URLString parameters:parameters error:nil];
+```
+
+    POST http://example.com/
+    Content-Type: application/json
+
+    {"foo": "bar", "baz": [1,2,3]}
+
+---
+
+### Network Reachability Manager
+
+`AFNetworkReachabilityManager` monitors the reachability of domains, and addresses for both WWAN and WiFi network interfaces.
+
+* Do not use Reachability to determine if the original request should be sent.
+	* You should try to send it.
+* You can use Reachability to determine when a request should be automatically retried.
+	* Although it may still fail, a Reachability notification that the connectivity is available is a good time to retry something.
+* Network reachability is a useful tool for determining why a request might have failed.
+	* After a network request has failed, telling the user they're offline is better than giving them a more technical but accurate error, such as "request timed out."
+
+See also [WWDC 2012 session 706, "Networking Best Practices."](https://developer.apple.com/videos/play/wwdc2012-706/).
+
+#### Shared Network Reachability
+
+```objective-c
+[[AFNetworkReachabilityManager sharedManager] setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) {
+    NSLog(@"Reachability: %@", AFStringFromNetworkReachabilityStatus(status));
+}];
+
+[[AFNetworkReachabilityManager sharedManager] startMonitoring];
+```
+
+---
+
+### Security Policy
+
+`AFSecurityPolicy` evaluates server trust against pinned X.509 certificates and public keys over secure connections.
+
+Adding pinned SSL certificates to your app helps prevent man-in-the-middle attacks and other vulnerabilities. Applications dealing with sensitive customer data or financial information are strongly encouraged to route all communication over an HTTPS connection with SSL pinning configured and enabled.
+
+#### Allowing Invalid SSL Certificates
+
+```objective-c
+AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
+manager.securityPolicy.allowInvalidCertificates = YES; // not recommended for production
+```
+
+---
+
+## Unit Tests
+
+AFNetworking includes a suite of unit tests within the Tests subdirectory. These tests can be run simply be executed the test action on the platform framework you would like to test.
+
+## Credits
+
+AFNetworking is owned and maintained by the [Alamofire Software Foundation](http://alamofire.org).
+
+AFNetworking was originally created by [Scott Raymond](https://github.com/sco/) and [Mattt Thompson](https://github.com/mattt/) in the development of [Gowalla for iPhone](http://en.wikipedia.org/wiki/Gowalla).
+
+AFNetworking's logo was designed by [Alan Defibaugh](http://www.alandefibaugh.com/).
+
+And most of all, thanks to AFNetworking's [growing list of contributors](https://github.com/AFNetworking/AFNetworking/contributors).
+
+### Security Disclosure
+
+If you believe you have identified a security vulnerability with AFNetworking, you should report it as soon as possible via email to security@alamofire.org. Please do not post it to a public issue tracker.
+
+## License
+
+AFNetworking is released under the MIT license. See [LICENSE](https://github.com/AFNetworking/AFNetworking/blob/master/LICENSE) for details.

+ 160 - 0
Pods/AFNetworking/UIKit+AFNetworking/AFAutoPurgingImageCache.h

@@ -0,0 +1,160 @@
+// AFAutoPurgingImageCache.h
+// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import <TargetConditionals.h>
+#import <Foundation/Foundation.h>
+
+#if TARGET_OS_IOS || TARGET_OS_TV
+#import <UIKit/UIKit.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+/**
+ The `AFImageCache` protocol defines a set of APIs for adding, removing and fetching images from a cache synchronously.
+ */
+@protocol AFImageCache <NSObject>
+
+/**
+ Adds the image to the cache with the given identifier.
+
+ @param image The image to cache.
+ @param identifier The unique identifier for the image in the cache.
+ */
+- (void)addImage:(UIImage *)image withIdentifier:(NSString *)identifier;
+
+/**
+ Removes the image from the cache matching the given identifier.
+
+ @param identifier The unique identifier for the image in the cache.
+
+ @return A BOOL indicating whether or not the image was removed from the cache.
+ */
+- (BOOL)removeImageWithIdentifier:(NSString *)identifier;
+
+/**
+ Removes all images from the cache.
+
+ @return A BOOL indicating whether or not all images were removed from the cache.
+ */
+- (BOOL)removeAllImages;
+
+/**
+ Returns the image in the cache associated with the given identifier.
+
+ @param identifier The unique identifier for the image in the cache.
+
+ @return An image for the matching identifier, or nil.
+ */
+- (nullable UIImage *)imageWithIdentifier:(NSString *)identifier;
+@end
+
+
+/**
+ The `ImageRequestCache` protocol extends the `ImageCache` protocol by adding methods for adding, removing and fetching images from a cache given an `NSURLRequest` and additional identifier.
+ */
+@protocol AFImageRequestCache <AFImageCache>
+
+/**
+ Asks if the image should be cached using an identifier created from the request and additional identifier.
+ 
+ @param image The image to be cached.
+ @param request The unique URL request identifing the image asset.
+ @param identifier The additional identifier to apply to the URL request to identify the image.
+ 
+ @return A BOOL indicating whether or not the image should be added to the cache. YES will cache, NO will prevent caching.
+ */
+- (BOOL)shouldCacheImage:(UIImage *)image forRequest:(NSURLRequest *)request withAdditionalIdentifier:(nullable NSString *)identifier;
+
+/**
+ Adds the image to the cache using an identifier created from the request and additional identifier.
+
+ @param image The image to cache.
+ @param request The unique URL request identifing the image asset.
+ @param identifier The additional identifier to apply to the URL request to identify the image.
+ */
+- (void)addImage:(UIImage *)image forRequest:(NSURLRequest *)request withAdditionalIdentifier:(nullable NSString *)identifier;
+
+/**
+ Removes the image from the cache using an identifier created from the request and additional identifier.
+
+ @param request The unique URL request identifing the image asset.
+ @param identifier The additional identifier to apply to the URL request to identify the image.
+ 
+ @return A BOOL indicating whether or not all images were removed from the cache.
+ */
+- (BOOL)removeImageforRequest:(NSURLRequest *)request withAdditionalIdentifier:(nullable NSString *)identifier;
+
+/**
+ Returns the image from the cache associated with an identifier created from the request and additional identifier.
+
+ @param request The unique URL request identifing the image asset.
+ @param identifier The additional identifier to apply to the URL request to identify the image.
+
+ @return An image for the matching request and identifier, or nil.
+ */
+- (nullable UIImage *)imageforRequest:(NSURLRequest *)request withAdditionalIdentifier:(nullable NSString *)identifier;
+
+@end
+
+/**
+ The `AutoPurgingImageCache` in an in-memory image cache used to store images up to a given memory capacity. When the memory capacity is reached, the image cache is sorted by last access date, then the oldest image is continuously purged until the preferred memory usage after purge is met. Each time an image is accessed through the cache, the internal access date of the image is updated.
+ */
+@interface AFAutoPurgingImageCache : NSObject <AFImageRequestCache>
+
+/**
+ The total memory capacity of the cache in bytes.
+ */
+@property (nonatomic, assign) UInt64 memoryCapacity;
+
+/**
+ The preferred memory usage after purge in bytes. During a purge, images will be purged until the memory capacity drops below this limit.
+ */
+@property (nonatomic, assign) UInt64 preferredMemoryUsageAfterPurge;
+
+/**
+ The current total memory usage in bytes of all images stored within the cache.
+ */
+@property (nonatomic, assign, readonly) UInt64 memoryUsage;
+
+/**
+ Initialies the `AutoPurgingImageCache` instance with default values for memory capacity and preferred memory usage after purge limit. `memoryCapcity` defaults to `100 MB`. `preferredMemoryUsageAfterPurge` defaults to `60 MB`.
+
+ @return The new `AutoPurgingImageCache` instance.
+ */
+- (instancetype)init;
+
+/**
+ Initialies the `AutoPurgingImageCache` instance with the given memory capacity and preferred memory usage
+ after purge limit.
+
+ @param memoryCapacity The total memory capacity of the cache in bytes.
+ @param preferredMemoryCapacity The preferred memory usage after purge in bytes.
+
+ @return The new `AutoPurgingImageCache` instance.
+ */
+- (instancetype)initWithMemoryCapacity:(UInt64)memoryCapacity preferredMemoryCapacity:(UInt64)preferredMemoryCapacity;
+
+@end
+
+NS_ASSUME_NONNULL_END
+
+#endif
+

+ 205 - 0
Pods/AFNetworking/UIKit+AFNetworking/AFAutoPurgingImageCache.m

@@ -0,0 +1,205 @@
+// AFAutoPurgingImageCache.m
+// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import <TargetConditionals.h>
+
+#if TARGET_OS_IOS || TARGET_OS_TV 
+
+#import "AFAutoPurgingImageCache.h"
+
+@interface AFCachedImage : NSObject
+
+@property (nonatomic, strong) UIImage *image;
+@property (nonatomic, copy) NSString *identifier;
+@property (nonatomic, assign) UInt64 totalBytes;
+@property (nonatomic, strong) NSDate *lastAccessDate;
+@property (nonatomic, assign) UInt64 currentMemoryUsage;
+
+@end
+
+@implementation AFCachedImage
+
+- (instancetype)initWithImage:(UIImage *)image identifier:(NSString *)identifier {
+    if (self = [self init]) {
+        self.image = image;
+        self.identifier = identifier;
+
+        CGSize imageSize = CGSizeMake(image.size.width * image.scale, image.size.height * image.scale);
+        CGFloat bytesPerPixel = 4.0;
+        CGFloat bytesPerSize = imageSize.width * imageSize.height;
+        self.totalBytes = (UInt64)bytesPerPixel * (UInt64)bytesPerSize;
+        self.lastAccessDate = [NSDate date];
+    }
+    return self;
+}
+
+- (UIImage *)accessImage {
+    self.lastAccessDate = [NSDate date];
+    return self.image;
+}
+
+- (NSString *)description {
+    NSString *descriptionString = [NSString stringWithFormat:@"Idenfitier: %@  lastAccessDate: %@ ", self.identifier, self.lastAccessDate];
+    return descriptionString;
+
+}
+
+@end
+
+@interface AFAutoPurgingImageCache ()
+@property (nonatomic, strong) NSMutableDictionary <NSString* , AFCachedImage*> *cachedImages;
+@property (nonatomic, assign) UInt64 currentMemoryUsage;
+@property (nonatomic, strong) dispatch_queue_t synchronizationQueue;
+@end
+
+@implementation AFAutoPurgingImageCache
+
+- (instancetype)init {
+    return [self initWithMemoryCapacity:100 * 1024 * 1024 preferredMemoryCapacity:60 * 1024 * 1024];
+}
+
+- (instancetype)initWithMemoryCapacity:(UInt64)memoryCapacity preferredMemoryCapacity:(UInt64)preferredMemoryCapacity {
+    if (self = [super init]) {
+        self.memoryCapacity = memoryCapacity;
+        self.preferredMemoryUsageAfterPurge = preferredMemoryCapacity;
+        self.cachedImages = [[NSMutableDictionary alloc] init];
+
+        NSString *queueName = [NSString stringWithFormat:@"com.alamofire.autopurgingimagecache-%@", [[NSUUID UUID] UUIDString]];
+        self.synchronizationQueue = dispatch_queue_create([queueName cStringUsingEncoding:NSASCIIStringEncoding], DISPATCH_QUEUE_CONCURRENT);
+
+        [[NSNotificationCenter defaultCenter]
+         addObserver:self
+         selector:@selector(removeAllImages)
+         name:UIApplicationDidReceiveMemoryWarningNotification
+         object:nil];
+
+    }
+    return self;
+}
+
+- (void)dealloc {
+    [[NSNotificationCenter defaultCenter] removeObserver:self];
+}
+
+- (UInt64)memoryUsage {
+    __block UInt64 result = 0;
+    dispatch_sync(self.synchronizationQueue, ^{
+        result = self.currentMemoryUsage;
+    });
+    return result;
+}
+
+- (void)addImage:(UIImage *)image withIdentifier:(NSString *)identifier {
+    dispatch_barrier_async(self.synchronizationQueue, ^{
+        AFCachedImage *cacheImage = [[AFCachedImage alloc] initWithImage:image identifier:identifier];
+
+        AFCachedImage *previousCachedImage = self.cachedImages[identifier];
+        if (previousCachedImage != nil) {
+            self.currentMemoryUsage -= previousCachedImage.totalBytes;
+        }
+
+        self.cachedImages[identifier] = cacheImage;
+        self.currentMemoryUsage += cacheImage.totalBytes;
+    });
+
+    dispatch_barrier_async(self.synchronizationQueue, ^{
+        if (self.currentMemoryUsage > self.memoryCapacity) {
+            UInt64 bytesToPurge = self.currentMemoryUsage - self.preferredMemoryUsageAfterPurge;
+            NSMutableArray <AFCachedImage*> *sortedImages = [NSMutableArray arrayWithArray:self.cachedImages.allValues];
+            NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"lastAccessDate"
+                                                                           ascending:YES];
+            [sortedImages sortUsingDescriptors:@[sortDescriptor]];
+
+            UInt64 bytesPurged = 0;
+
+            for (AFCachedImage *cachedImage in sortedImages) {
+                [self.cachedImages removeObjectForKey:cachedImage.identifier];
+                bytesPurged += cachedImage.totalBytes;
+                if (bytesPurged >= bytesToPurge) {
+                    break;
+                }
+            }
+            self.currentMemoryUsage -= bytesPurged;
+        }
+    });
+}
+
+- (BOOL)removeImageWithIdentifier:(NSString *)identifier {
+    __block BOOL removed = NO;
+    dispatch_barrier_sync(self.synchronizationQueue, ^{
+        AFCachedImage *cachedImage = self.cachedImages[identifier];
+        if (cachedImage != nil) {
+            [self.cachedImages removeObjectForKey:identifier];
+            self.currentMemoryUsage -= cachedImage.totalBytes;
+            removed = YES;
+        }
+    });
+    return removed;
+}
+
+- (BOOL)removeAllImages {
+    __block BOOL removed = NO;
+    dispatch_barrier_sync(self.synchronizationQueue, ^{
+        if (self.cachedImages.count > 0) {
+            [self.cachedImages removeAllObjects];
+            self.currentMemoryUsage = 0;
+            removed = YES;
+        }
+    });
+    return removed;
+}
+
+- (nullable UIImage *)imageWithIdentifier:(NSString *)identifier {
+    __block UIImage *image = nil;
+    dispatch_sync(self.synchronizationQueue, ^{
+        AFCachedImage *cachedImage = self.cachedImages[identifier];
+        image = [cachedImage accessImage];
+    });
+    return image;
+}
+
+- (void)addImage:(UIImage *)image forRequest:(NSURLRequest *)request withAdditionalIdentifier:(NSString *)identifier {
+    [self addImage:image withIdentifier:[self imageCacheKeyFromURLRequest:request withAdditionalIdentifier:identifier]];
+}
+
+- (BOOL)removeImageforRequest:(NSURLRequest *)request withAdditionalIdentifier:(NSString *)identifier {
+    return [self removeImageWithIdentifier:[self imageCacheKeyFromURLRequest:request withAdditionalIdentifier:identifier]];
+}
+
+- (nullable UIImage *)imageforRequest:(NSURLRequest *)request withAdditionalIdentifier:(NSString *)identifier {
+    return [self imageWithIdentifier:[self imageCacheKeyFromURLRequest:request withAdditionalIdentifier:identifier]];
+}
+
+- (NSString *)imageCacheKeyFromURLRequest:(NSURLRequest *)request withAdditionalIdentifier:(NSString *)additionalIdentifier {
+    NSString *key = request.URL.absoluteString;
+    if (additionalIdentifier != nil) {
+        key = [key stringByAppendingString:additionalIdentifier];
+    }
+    return key;
+}
+
+- (BOOL)shouldCacheImage:(UIImage *)image forRequest:(NSURLRequest *)request withAdditionalIdentifier:(nullable NSString *)identifier {
+    return YES;
+}
+
+@end
+
+#endif

+ 171 - 0
Pods/AFNetworking/UIKit+AFNetworking/AFImageDownloader.h

@@ -0,0 +1,171 @@
+// AFImageDownloader.h
+// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import <TargetConditionals.h>
+
+#if TARGET_OS_IOS || TARGET_OS_TV 
+
+#import <Foundation/Foundation.h>
+#import "AFAutoPurgingImageCache.h"
+#import "AFHTTPSessionManager.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+typedef NS_ENUM(NSInteger, AFImageDownloadPrioritization) {
+    AFImageDownloadPrioritizationFIFO,
+    AFImageDownloadPrioritizationLIFO
+};
+
+/**
+ The `AFImageDownloadReceipt` is an object vended by the `AFImageDownloader` when starting a data task. It can be used to cancel active tasks running on the `AFImageDownloader` session. As a general rule, image data tasks should be cancelled using the `AFImageDownloadReceipt` instead of calling `cancel` directly on the `task` itself. The `AFImageDownloader` is optimized to handle duplicate task scenarios as well as pending versus active downloads.
+ */
+@interface AFImageDownloadReceipt : NSObject
+
+/**
+ The data task created by the `AFImageDownloader`.
+*/
+@property (nonatomic, strong) NSURLSessionDataTask *task;
+
+/**
+ The unique identifier for the success and failure blocks when duplicate requests are made.
+ */
+@property (nonatomic, strong) NSUUID *receiptID;
+@end
+
+/** The `AFImageDownloader` class is responsible for downloading images in parallel on a prioritized queue. Incoming downloads are added to the front or back of the queue depending on the download prioritization. Each downloaded image is cached in the underlying `NSURLCache` as well as the in-memory image cache. By default, any download request with a cached image equivalent in the image cache will automatically be served the cached image representation.
+ */
+@interface AFImageDownloader : NSObject
+
+/**
+ The image cache used to store all downloaded images in. `AFAutoPurgingImageCache` by default.
+ */
+@property (nonatomic, strong, nullable) id <AFImageRequestCache> imageCache;
+
+/**
+ The `AFHTTPSessionManager` used to download images. By default, this is configured with an `AFImageResponseSerializer`, and a shared `NSURLCache` for all image downloads.
+ */
+@property (nonatomic, strong) AFHTTPSessionManager *sessionManager;
+
+/**
+ Defines the order prioritization of incoming download requests being inserted into the queue. `AFImageDownloadPrioritizationFIFO` by default.
+ */
+@property (nonatomic, assign) AFImageDownloadPrioritization downloadPrioritization;
+
+/**
+ The shared default instance of `AFImageDownloader` initialized with default values.
+ */
++ (instancetype)defaultInstance;
+
+/**
+ Creates a default `NSURLCache` with common usage parameter values.
+
+ @returns The default `NSURLCache` instance.
+ */
++ (NSURLCache *)defaultURLCache;
+
+/**
+ The default `NSURLSessionConfiguration` with common usage parameter values.
+ */
++ (NSURLSessionConfiguration *)defaultURLSessionConfiguration;
+
+/**
+ Default initializer
+
+ @return An instance of `AFImageDownloader` initialized with default values.
+ */
+- (instancetype)init;
+
+/**
+ Initializer with specific `URLSessionConfiguration`
+ 
+ @param configuration The `NSURLSessionConfiguration` to be be used
+ 
+ @return An instance of `AFImageDownloader` initialized with default values and custom `NSURLSessionConfiguration`
+ */
+- (instancetype)initWithSessionConfiguration:(NSURLSessionConfiguration *)configuration;
+
+/**
+ Initializes the `AFImageDownloader` instance with the given session manager, download prioritization, maximum active download count and image cache.
+
+ @param sessionManager The session manager to use to download images.
+ @param downloadPrioritization The download prioritization of the download queue.
+ @param maximumActiveDownloads  The maximum number of active downloads allowed at any given time. Recommend `4`.
+ @param imageCache The image cache used to store all downloaded images in.
+
+ @return The new `AFImageDownloader` instance.
+ */
+- (instancetype)initWithSessionManager:(AFHTTPSessionManager *)sessionManager
+                downloadPrioritization:(AFImageDownloadPrioritization)downloadPrioritization
+                maximumActiveDownloads:(NSInteger)maximumActiveDownloads
+                            imageCache:(nullable id <AFImageRequestCache>)imageCache;
+
+/**
+ Creates a data task using the `sessionManager` instance for the specified URL request.
+
+ If the same data task is already in the queue or currently being downloaded, the success and failure blocks are
+ appended to the already existing task. Once the task completes, all success or failure blocks attached to the
+ task are executed in the order they were added.
+
+ @param request The URL request.
+ @param success A block to be executed when the image data task finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the image created from the response data of request. If the image was returned from cache, the response parameter will be `nil`.
+ @param failure A block object to be executed when the image data task finishes unsuccessfully, or that finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the error object describing the network or parsing error that occurred.
+
+ @return The image download receipt for the data task if available. `nil` if the image is stored in the cache.
+ cache and the URL request cache policy allows the cache to be used.
+ */
+- (nullable AFImageDownloadReceipt *)downloadImageForURLRequest:(NSURLRequest *)request
+                                                        success:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse  * _Nullable response, UIImage *responseObject))success
+                                                        failure:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, NSError *error))failure;
+
+/**
+ Creates a data task using the `sessionManager` instance for the specified URL request.
+
+ If the same data task is already in the queue or currently being downloaded, the success and failure blocks are
+ appended to the already existing task. Once the task completes, all success or failure blocks attached to the
+ task are executed in the order they were added.
+
+ @param request The URL request.
+ @param receiptID The identifier to use for the download receipt that will be created for this request. This must be a unique identifier that does not represent any other request.
+ @param success A block to be executed when the image data task finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the image created from the response data of request. If the image was returned from cache, the response parameter will be `nil`.
+ @param failure A block object to be executed when the image data task finishes unsuccessfully, or that finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the error object describing the network or parsing error that occurred.
+
+ @return The image download receipt for the data task if available. `nil` if the image is stored in the cache.
+ cache and the URL request cache policy allows the cache to be used.
+ */
+- (nullable AFImageDownloadReceipt *)downloadImageForURLRequest:(NSURLRequest *)request
+                                                 withReceiptID:(NSUUID *)receiptID
+                                                        success:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse  * _Nullable response, UIImage *responseObject))success
+                                                        failure:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, NSError *error))failure;
+
+/**
+ Cancels the data task in the receipt by removing the corresponding success and failure blocks and cancelling the data task if necessary.
+
+ If the data task is pending in the queue, it will be cancelled if no other success and failure blocks are registered with the data task. If the data task is currently executing or is already completed, the success and failure blocks are removed and will not be called when the task finishes.
+
+ @param imageDownloadReceipt The image download receipt to cancel.
+ */
+- (void)cancelTaskForImageDownloadReceipt:(AFImageDownloadReceipt *)imageDownloadReceipt;
+
+@end
+
+#endif
+
+NS_ASSUME_NONNULL_END

+ 421 - 0
Pods/AFNetworking/UIKit+AFNetworking/AFImageDownloader.m

@@ -0,0 +1,421 @@
+// AFImageDownloader.m
+// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import <TargetConditionals.h>
+
+#if TARGET_OS_IOS || TARGET_OS_TV
+
+#import "AFImageDownloader.h"
+#import "AFHTTPSessionManager.h"
+
+@interface AFImageDownloaderResponseHandler : NSObject
+@property (nonatomic, strong) NSUUID *uuid;
+@property (nonatomic, copy) void (^successBlock)(NSURLRequest *, NSHTTPURLResponse *, UIImage *);
+@property (nonatomic, copy) void (^failureBlock)(NSURLRequest *, NSHTTPURLResponse *, NSError *);
+@end
+
+@implementation AFImageDownloaderResponseHandler
+
+- (instancetype)initWithUUID:(NSUUID *)uuid
+                     success:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, UIImage *responseObject))success
+                     failure:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, NSError *error))failure {
+    if (self = [self init]) {
+        self.uuid = uuid;
+        self.successBlock = success;
+        self.failureBlock = failure;
+    }
+    return self;
+}
+
+- (NSString *)description {
+    return [NSString stringWithFormat: @"<AFImageDownloaderResponseHandler>UUID: %@", [self.uuid UUIDString]];
+}
+
+@end
+
+@interface AFImageDownloaderMergedTask : NSObject
+@property (nonatomic, strong) NSString *URLIdentifier;
+@property (nonatomic, strong) NSUUID *identifier;
+@property (nonatomic, strong) NSURLSessionDataTask *task;
+@property (nonatomic, strong) NSMutableArray <AFImageDownloaderResponseHandler*> *responseHandlers;
+
+@end
+
+@implementation AFImageDownloaderMergedTask
+
+- (instancetype)initWithURLIdentifier:(NSString *)URLIdentifier identifier:(NSUUID *)identifier task:(NSURLSessionDataTask *)task {
+    if (self = [self init]) {
+        self.URLIdentifier = URLIdentifier;
+        self.task = task;
+        self.identifier = identifier;
+        self.responseHandlers = [[NSMutableArray alloc] init];
+    }
+    return self;
+}
+
+- (void)addResponseHandler:(AFImageDownloaderResponseHandler *)handler {
+    [self.responseHandlers addObject:handler];
+}
+
+- (void)removeResponseHandler:(AFImageDownloaderResponseHandler *)handler {
+    [self.responseHandlers removeObject:handler];
+}
+
+@end
+
+@implementation AFImageDownloadReceipt
+
+- (instancetype)initWithReceiptID:(NSUUID *)receiptID task:(NSURLSessionDataTask *)task {
+    if (self = [self init]) {
+        self.receiptID = receiptID;
+        self.task = task;
+    }
+    return self;
+}
+
+@end
+
+@interface AFImageDownloader ()
+
+@property (nonatomic, strong) dispatch_queue_t synchronizationQueue;
+@property (nonatomic, strong) dispatch_queue_t responseQueue;
+
+@property (nonatomic, assign) NSInteger maximumActiveDownloads;
+@property (nonatomic, assign) NSInteger activeRequestCount;
+
+@property (nonatomic, strong) NSMutableArray *queuedMergedTasks;
+@property (nonatomic, strong) NSMutableDictionary *mergedTasks;
+
+@end
+
+@implementation AFImageDownloader
+
++ (NSURLCache *)defaultURLCache {
+    NSUInteger memoryCapacity = 20 * 1024 * 1024; // 20MB
+    NSUInteger diskCapacity = 150 * 1024 * 1024; // 150MB
+    NSURL *cacheURL = [[[NSFileManager defaultManager] URLForDirectory:NSCachesDirectory
+                                                              inDomain:NSUserDomainMask
+                                                     appropriateForURL:nil
+                                                                create:YES
+                                                                 error:nil]
+                       URLByAppendingPathComponent:@"com.alamofire.imagedownloader"];
+    
+#if TARGET_OS_MACCATALYST
+    return [[NSURLCache alloc] initWithMemoryCapacity:memoryCapacity
+                                         diskCapacity:diskCapacity
+                                         directoryURL:cacheURL];
+#else
+    return [[NSURLCache alloc] initWithMemoryCapacity:memoryCapacity
+                                         diskCapacity:diskCapacity
+                                             diskPath:[cacheURL path]];
+#endif
+}
+
++ (NSURLSessionConfiguration *)defaultURLSessionConfiguration {
+    NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
+
+    //TODO set the default HTTP headers
+
+    configuration.HTTPShouldSetCookies = YES;
+    configuration.HTTPShouldUsePipelining = NO;
+
+    configuration.requestCachePolicy = NSURLRequestUseProtocolCachePolicy;
+    configuration.allowsCellularAccess = YES;
+    configuration.timeoutIntervalForRequest = 60.0;
+    configuration.URLCache = [AFImageDownloader defaultURLCache];
+
+    return configuration;
+}
+
+- (instancetype)init {
+    NSURLSessionConfiguration *defaultConfiguration = [self.class defaultURLSessionConfiguration];
+    return [self initWithSessionConfiguration:defaultConfiguration];
+}
+
+- (instancetype)initWithSessionConfiguration:(NSURLSessionConfiguration *)configuration {
+    AFHTTPSessionManager *sessionManager = [[AFHTTPSessionManager alloc] initWithSessionConfiguration:configuration];
+    sessionManager.responseSerializer = [AFImageResponseSerializer serializer];
+
+    return [self initWithSessionManager:sessionManager
+                 downloadPrioritization:AFImageDownloadPrioritizationFIFO
+                 maximumActiveDownloads:4
+                             imageCache:[[AFAutoPurgingImageCache alloc] init]];
+}
+
+- (instancetype)initWithSessionManager:(AFHTTPSessionManager *)sessionManager
+                downloadPrioritization:(AFImageDownloadPrioritization)downloadPrioritization
+                maximumActiveDownloads:(NSInteger)maximumActiveDownloads
+                            imageCache:(id <AFImageRequestCache>)imageCache {
+    if (self = [super init]) {
+        self.sessionManager = sessionManager;
+
+        self.downloadPrioritization = downloadPrioritization;
+        self.maximumActiveDownloads = maximumActiveDownloads;
+        self.imageCache = imageCache;
+
+        self.queuedMergedTasks = [[NSMutableArray alloc] init];
+        self.mergedTasks = [[NSMutableDictionary alloc] init];
+        self.activeRequestCount = 0;
+
+        NSString *name = [NSString stringWithFormat:@"com.alamofire.imagedownloader.synchronizationqueue-%@", [[NSUUID UUID] UUIDString]];
+        self.synchronizationQueue = dispatch_queue_create([name cStringUsingEncoding:NSASCIIStringEncoding], DISPATCH_QUEUE_SERIAL);
+
+        name = [NSString stringWithFormat:@"com.alamofire.imagedownloader.responsequeue-%@", [[NSUUID UUID] UUIDString]];
+        self.responseQueue = dispatch_queue_create([name cStringUsingEncoding:NSASCIIStringEncoding], DISPATCH_QUEUE_CONCURRENT);
+    }
+
+    return self;
+}
+
++ (instancetype)defaultInstance {
+    static AFImageDownloader *sharedInstance = nil;
+    static dispatch_once_t onceToken;
+    dispatch_once(&onceToken, ^{
+        sharedInstance = [[self alloc] init];
+    });
+    return sharedInstance;
+}
+
+- (nullable AFImageDownloadReceipt *)downloadImageForURLRequest:(NSURLRequest *)request
+                                                        success:(void (^)(NSURLRequest * _Nonnull, NSHTTPURLResponse * _Nullable, UIImage * _Nonnull))success
+                                                        failure:(void (^)(NSURLRequest * _Nonnull, NSHTTPURLResponse * _Nullable, NSError * _Nonnull))failure {
+    return [self downloadImageForURLRequest:request withReceiptID:[NSUUID UUID] success:success failure:failure];
+}
+
+- (nullable AFImageDownloadReceipt *)downloadImageForURLRequest:(NSURLRequest *)request
+                                                  withReceiptID:(nonnull NSUUID *)receiptID
+                                                        success:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse  * _Nullable response, UIImage *responseObject))success
+                                                        failure:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, NSError *error))failure {
+    __block NSURLSessionDataTask *task = nil;
+    dispatch_sync(self.synchronizationQueue, ^{
+        NSString *URLIdentifier = request.URL.absoluteString;
+        if (URLIdentifier == nil) {
+            if (failure) {
+                NSError *error = [NSError errorWithDomain:NSURLErrorDomain code:NSURLErrorBadURL userInfo:nil];
+                dispatch_async(dispatch_get_main_queue(), ^{
+                    failure(request, nil, error);
+                });
+            }
+            return;
+        }
+
+        // 1) Append the success and failure blocks to a pre-existing request if it already exists
+        AFImageDownloaderMergedTask *existingMergedTask = self.mergedTasks[URLIdentifier];
+        if (existingMergedTask != nil) {
+            AFImageDownloaderResponseHandler *handler = [[AFImageDownloaderResponseHandler alloc] initWithUUID:receiptID success:success failure:failure];
+            [existingMergedTask addResponseHandler:handler];
+            task = existingMergedTask.task;
+            return;
+        }
+
+        // 2) Attempt to load the image from the image cache if the cache policy allows it
+        switch (request.cachePolicy) {
+            case NSURLRequestUseProtocolCachePolicy:
+            case NSURLRequestReturnCacheDataElseLoad:
+            case NSURLRequestReturnCacheDataDontLoad: {
+                UIImage *cachedImage = [self.imageCache imageforRequest:request withAdditionalIdentifier:nil];
+                if (cachedImage != nil) {
+                    if (success) {
+                        dispatch_async(dispatch_get_main_queue(), ^{
+                            success(request, nil, cachedImage);
+                        });
+                    }
+                    return;
+                }
+                break;
+            }
+            default:
+                break;
+        }
+
+        // 3) Create the request and set up authentication, validation and response serialization
+        NSUUID *mergedTaskIdentifier = [NSUUID UUID];
+        NSURLSessionDataTask *createdTask;
+        __weak __typeof__(self) weakSelf = self;
+
+        createdTask = [self.sessionManager
+                       dataTaskWithRequest:request
+                       uploadProgress:nil
+                       downloadProgress:nil
+                       completionHandler:^(NSURLResponse * _Nonnull response, id  _Nullable responseObject, NSError * _Nullable error) {
+                           dispatch_async(self.responseQueue, ^{
+                               __strong __typeof__(weakSelf) strongSelf = weakSelf;
+                               AFImageDownloaderMergedTask *mergedTask = [strongSelf safelyGetMergedTask:URLIdentifier];
+                               if ([mergedTask.identifier isEqual:mergedTaskIdentifier]) {
+                                   mergedTask = [strongSelf safelyRemoveMergedTaskWithURLIdentifier:URLIdentifier];
+                                   if (error) {
+                                       for (AFImageDownloaderResponseHandler *handler in mergedTask.responseHandlers) {
+                                           if (handler.failureBlock) {
+                                               dispatch_async(dispatch_get_main_queue(), ^{
+                                                   handler.failureBlock(request, (NSHTTPURLResponse *)response, error);
+                                               });
+                                           }
+                                       }
+                                   } else {
+                                       if ([strongSelf.imageCache shouldCacheImage:responseObject forRequest:request withAdditionalIdentifier:nil]) {
+                                           [strongSelf.imageCache addImage:responseObject forRequest:request withAdditionalIdentifier:nil];
+                                       }
+
+                                       for (AFImageDownloaderResponseHandler *handler in mergedTask.responseHandlers) {
+                                           if (handler.successBlock) {
+                                               dispatch_async(dispatch_get_main_queue(), ^{
+                                                   handler.successBlock(request, (NSHTTPURLResponse *)response, responseObject);
+                                               });
+                                           }
+                                       }
+                                       
+                                   }
+                               }
+                               [strongSelf safelyDecrementActiveTaskCount];
+                               [strongSelf safelyStartNextTaskIfNecessary];
+                           });
+                       }];
+
+        // 4) Store the response handler for use when the request completes
+        AFImageDownloaderResponseHandler *handler = [[AFImageDownloaderResponseHandler alloc] initWithUUID:receiptID
+                                                                                                   success:success
+                                                                                                   failure:failure];
+        AFImageDownloaderMergedTask *mergedTask = [[AFImageDownloaderMergedTask alloc]
+                                                   initWithURLIdentifier:URLIdentifier
+                                                   identifier:mergedTaskIdentifier
+                                                   task:createdTask];
+        [mergedTask addResponseHandler:handler];
+        self.mergedTasks[URLIdentifier] = mergedTask;
+
+        // 5) Either start the request or enqueue it depending on the current active request count
+        if ([self isActiveRequestCountBelowMaximumLimit]) {
+            [self startMergedTask:mergedTask];
+        } else {
+            [self enqueueMergedTask:mergedTask];
+        }
+
+        task = mergedTask.task;
+    });
+    if (task) {
+        return [[AFImageDownloadReceipt alloc] initWithReceiptID:receiptID task:task];
+    } else {
+        return nil;
+    }
+}
+
+- (void)cancelTaskForImageDownloadReceipt:(AFImageDownloadReceipt *)imageDownloadReceipt {
+    dispatch_sync(self.synchronizationQueue, ^{
+        NSString *URLIdentifier = imageDownloadReceipt.task.originalRequest.URL.absoluteString;
+        AFImageDownloaderMergedTask *mergedTask = self.mergedTasks[URLIdentifier];
+        NSUInteger index = [mergedTask.responseHandlers indexOfObjectPassingTest:^BOOL(AFImageDownloaderResponseHandler * _Nonnull handler, __unused NSUInteger idx, __unused BOOL * _Nonnull stop) {
+            return handler.uuid == imageDownloadReceipt.receiptID;
+        }];
+
+        if (index != NSNotFound) {
+            AFImageDownloaderResponseHandler *handler = mergedTask.responseHandlers[index];
+            [mergedTask removeResponseHandler:handler];
+            NSString *failureReason = [NSString stringWithFormat:@"ImageDownloader cancelled URL request: %@",imageDownloadReceipt.task.originalRequest.URL.absoluteString];
+            NSDictionary *userInfo = @{NSLocalizedFailureReasonErrorKey:failureReason};
+            NSError *error = [NSError errorWithDomain:NSURLErrorDomain code:NSURLErrorCancelled userInfo:userInfo];
+            if (handler.failureBlock) {
+                dispatch_async(dispatch_get_main_queue(), ^{
+                    handler.failureBlock(imageDownloadReceipt.task.originalRequest, nil, error);
+                });
+            }
+        }
+
+        if (mergedTask.responseHandlers.count == 0) {
+            [mergedTask.task cancel];
+            [self removeMergedTaskWithURLIdentifier:URLIdentifier];
+        }
+    });
+}
+
+- (AFImageDownloaderMergedTask *)safelyRemoveMergedTaskWithURLIdentifier:(NSString *)URLIdentifier {
+    __block AFImageDownloaderMergedTask *mergedTask = nil;
+    dispatch_sync(self.synchronizationQueue, ^{
+        mergedTask = [self removeMergedTaskWithURLIdentifier:URLIdentifier];
+    });
+    return mergedTask;
+}
+
+//This method should only be called from safely within the synchronizationQueue
+- (AFImageDownloaderMergedTask *)removeMergedTaskWithURLIdentifier:(NSString *)URLIdentifier {
+    AFImageDownloaderMergedTask *mergedTask = self.mergedTasks[URLIdentifier];
+    [self.mergedTasks removeObjectForKey:URLIdentifier];
+    return mergedTask;
+}
+
+- (void)safelyDecrementActiveTaskCount {
+    dispatch_sync(self.synchronizationQueue, ^{
+        if (self.activeRequestCount > 0) {
+            self.activeRequestCount -= 1;
+        }
+    });
+}
+
+- (void)safelyStartNextTaskIfNecessary {
+    dispatch_sync(self.synchronizationQueue, ^{
+        if ([self isActiveRequestCountBelowMaximumLimit]) {
+            while (self.queuedMergedTasks.count > 0) {
+                AFImageDownloaderMergedTask *mergedTask = [self dequeueMergedTask];
+                if (mergedTask.task.state == NSURLSessionTaskStateSuspended) {
+                    [self startMergedTask:mergedTask];
+                    break;
+                }
+            }
+        }
+    });
+}
+
+- (void)startMergedTask:(AFImageDownloaderMergedTask *)mergedTask {
+    [mergedTask.task resume];
+    ++self.activeRequestCount;
+}
+
+- (void)enqueueMergedTask:(AFImageDownloaderMergedTask *)mergedTask {
+    switch (self.downloadPrioritization) {
+        case AFImageDownloadPrioritizationFIFO:
+            [self.queuedMergedTasks addObject:mergedTask];
+            break;
+        case AFImageDownloadPrioritizationLIFO:
+            [self.queuedMergedTasks insertObject:mergedTask atIndex:0];
+            break;
+    }
+}
+
+- (AFImageDownloaderMergedTask *)dequeueMergedTask {
+    AFImageDownloaderMergedTask *mergedTask = nil;
+    mergedTask = [self.queuedMergedTasks firstObject];
+    [self.queuedMergedTasks removeObject:mergedTask];
+    return mergedTask;
+}
+
+- (BOOL)isActiveRequestCountBelowMaximumLimit {
+    return self.activeRequestCount < self.maximumActiveDownloads;
+}
+
+- (AFImageDownloaderMergedTask *)safelyGetMergedTask:(NSString *)URLIdentifier {
+    __block AFImageDownloaderMergedTask *mergedTask;
+    dispatch_sync(self.synchronizationQueue, ^(){
+        mergedTask = self.mergedTasks[URLIdentifier];
+    });
+    return mergedTask;
+}
+
+@end
+
+#endif

+ 103 - 0
Pods/AFNetworking/UIKit+AFNetworking/AFNetworkActivityIndicatorManager.h

@@ -0,0 +1,103 @@
+// AFNetworkActivityIndicatorManager.h
+// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import <Foundation/Foundation.h>
+
+#import <TargetConditionals.h>
+
+#if TARGET_OS_IOS
+
+#import <UIKit/UIKit.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+/**
+ `AFNetworkActivityIndicatorManager` manages the state of the network activity indicator in the status bar. When enabled, it will listen for notifications indicating that a session task has started or finished, and start or stop animating the indicator accordingly. The number of active requests is incremented and decremented much like a stack or a semaphore, and the activity indicator will animate so long as that number is greater than zero.
+
+ You should enable the shared instance of `AFNetworkActivityIndicatorManager` when your application finishes launching. In `AppDelegate application:didFinishLaunchingWithOptions:` you can do so with the following code:
+
+    [[AFNetworkActivityIndicatorManager sharedManager] setEnabled:YES];
+
+ By setting `enabled` to `YES` for `sharedManager`, the network activity indicator will show and hide automatically as requests start and finish. You should not ever need to call `incrementActivityCount` or `decrementActivityCount` yourself.
+
+ See the Apple Human Interface Guidelines section about the Network Activity Indicator for more information:
+ http://developer.apple.com/library/iOS/#documentation/UserExperience/Conceptual/MobileHIG/UIElementGuidelines/UIElementGuidelines.html#//apple_ref/doc/uid/TP40006556-CH13-SW44
+ */
+NS_EXTENSION_UNAVAILABLE_IOS("Use view controller based solutions where appropriate instead.")
+@interface AFNetworkActivityIndicatorManager : NSObject
+
+/**
+ A Boolean value indicating whether the manager is enabled.
+
+ If YES, the manager will change status bar network activity indicator according to network operation notifications it receives. The default value is NO.
+ */
+@property (nonatomic, assign, getter = isEnabled) BOOL enabled;
+
+/**
+ A Boolean value indicating whether the network activity indicator manager is currently active.
+*/
+@property (readonly, nonatomic, assign, getter=isNetworkActivityIndicatorVisible) BOOL networkActivityIndicatorVisible;
+
+/**
+ A time interval indicating the minimum duration of networking activity that should occur before the activity indicator is displayed. The default value 1 second. If the network activity indicator should be displayed immediately when network activity occurs, this value should be set to 0 seconds.
+ 
+ Apple's HIG describes the following:
+
+ > Display the network activity indicator to provide feedback when your app accesses the network for more than a couple of seconds. If the operation finishes sooner than that, you don’t have to show the network activity indicator, because the indicator is likely to disappear before users notice its presence.
+
+ */
+@property (nonatomic, assign) NSTimeInterval activationDelay;
+
+/**
+ A time interval indicating the duration of time of no networking activity required before the activity indicator is disabled. This allows for continuous display of the network activity indicator across multiple requests. The default value is 0.17 seconds.
+ */
+
+@property (nonatomic, assign) NSTimeInterval completionDelay;
+
+/**
+ Returns the shared network activity indicator manager object for the system.
+
+ @return The systemwide network activity indicator manager.
+ */
++ (instancetype)sharedManager;
+
+/**
+ Increments the number of active network requests. If this number was zero before incrementing, this will start animating the status bar network activity indicator.
+ */
+- (void)incrementActivityCount;
+
+/**
+ Decrements the number of active network requests. If this number becomes zero after decrementing, this will stop animating the status bar network activity indicator.
+ */
+- (void)decrementActivityCount;
+
+/**
+ Set the a custom method to be executed when the network activity indicator manager should be hidden/shown. By default, this is null, and the UIApplication Network Activity Indicator will be managed automatically. If this block is set, it is the responsiblity of the caller to manager the network activity indicator going forward.
+
+ @param block A block to be executed when the network activity indicator status changes.
+ */
+- (void)setNetworkingActivityActionWithBlock:(nullable void (^)(BOOL networkActivityIndicatorVisible))block;
+
+@end
+
+NS_ASSUME_NONNULL_END
+
+#endif

+ 239 - 0
Pods/AFNetworking/UIKit+AFNetworking/AFNetworkActivityIndicatorManager.m

@@ -0,0 +1,239 @@
+// AFNetworkActivityIndicatorManager.m
+// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import "AFNetworkActivityIndicatorManager.h"
+
+#if TARGET_OS_IOS
+#import "AFURLSessionManager.h"
+
+typedef NS_ENUM(NSInteger, AFNetworkActivityManagerState) {
+    AFNetworkActivityManagerStateNotActive,
+    AFNetworkActivityManagerStateDelayingStart,
+    AFNetworkActivityManagerStateActive,
+    AFNetworkActivityManagerStateDelayingEnd
+};
+
+static NSTimeInterval const kDefaultAFNetworkActivityManagerActivationDelay = 1.0;
+static NSTimeInterval const kDefaultAFNetworkActivityManagerCompletionDelay = 0.17;
+
+static NSURLRequest * AFNetworkRequestFromNotification(NSNotification *notification) {
+    if ([[notification object] respondsToSelector:@selector(originalRequest)]) {
+        return [(NSURLSessionTask *)[notification object] originalRequest];
+    } else {
+        return nil;
+    }
+}
+
+typedef void (^AFNetworkActivityActionBlock)(BOOL networkActivityIndicatorVisible);
+
+@interface AFNetworkActivityIndicatorManager ()
+@property (readwrite, nonatomic, assign) NSInteger activityCount;
+@property (readwrite, nonatomic, strong) NSTimer *activationDelayTimer;
+@property (readwrite, nonatomic, strong) NSTimer *completionDelayTimer;
+@property (readonly, nonatomic, getter = isNetworkActivityOccurring) BOOL networkActivityOccurring;
+@property (nonatomic, copy) AFNetworkActivityActionBlock networkActivityActionBlock;
+@property (nonatomic, assign) AFNetworkActivityManagerState currentState;
+@property (nonatomic, assign, getter=isNetworkActivityIndicatorVisible) BOOL networkActivityIndicatorVisible;
+
+- (void)updateCurrentStateForNetworkActivityChange;
+@end
+
+@implementation AFNetworkActivityIndicatorManager
+
++ (instancetype)sharedManager {
+    static AFNetworkActivityIndicatorManager *_sharedManager = nil;
+    static dispatch_once_t oncePredicate;
+    dispatch_once(&oncePredicate, ^{
+        _sharedManager = [[self alloc] init];
+    });
+
+    return _sharedManager;
+}
+
+- (instancetype)init {
+    self = [super init];
+    if (!self) {
+        return nil;
+    }
+    self.currentState = AFNetworkActivityManagerStateNotActive;
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(networkRequestDidStart:) name:AFNetworkingTaskDidResumeNotification object:nil];
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(networkRequestDidFinish:) name:AFNetworkingTaskDidSuspendNotification object:nil];
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(networkRequestDidFinish:) name:AFNetworkingTaskDidCompleteNotification object:nil];
+    self.activationDelay = kDefaultAFNetworkActivityManagerActivationDelay;
+    self.completionDelay = kDefaultAFNetworkActivityManagerCompletionDelay;
+
+    return self;
+}
+
+- (void)dealloc {
+    [[NSNotificationCenter defaultCenter] removeObserver:self];
+
+    [_activationDelayTimer invalidate];
+    [_completionDelayTimer invalidate];
+}
+
+- (void)setEnabled:(BOOL)enabled {
+    _enabled = enabled;
+    if (enabled == NO) {
+        [self setCurrentState:AFNetworkActivityManagerStateNotActive];
+    }
+}
+
+- (void)setNetworkingActivityActionWithBlock:(void (^)(BOOL networkActivityIndicatorVisible))block {
+    self.networkActivityActionBlock = block;
+}
+
+- (BOOL)isNetworkActivityOccurring {
+    @synchronized(self) {
+        return self.activityCount > 0;
+    }
+}
+
+- (void)setNetworkActivityIndicatorVisible:(BOOL)networkActivityIndicatorVisible {
+    if (_networkActivityIndicatorVisible != networkActivityIndicatorVisible) {
+        @synchronized(self) {
+            _networkActivityIndicatorVisible = networkActivityIndicatorVisible;
+        }
+        if (self.networkActivityActionBlock) {
+            self.networkActivityActionBlock(networkActivityIndicatorVisible);
+        } else {
+            [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:networkActivityIndicatorVisible];
+        }
+    }
+}
+
+
+- (void)incrementActivityCount {
+    @synchronized(self) {
+        self.activityCount++;
+    }
+    dispatch_async(dispatch_get_main_queue(), ^{
+        [self updateCurrentStateForNetworkActivityChange];
+    });
+}
+
+- (void)decrementActivityCount {
+    @synchronized(self) {
+        self.activityCount = MAX(_activityCount - 1, 0);
+    }
+    dispatch_async(dispatch_get_main_queue(), ^{
+        [self updateCurrentStateForNetworkActivityChange];
+    });
+}
+
+- (void)networkRequestDidStart:(NSNotification *)notification {
+    if ([AFNetworkRequestFromNotification(notification) URL]) {
+        [self incrementActivityCount];
+    }
+}
+
+- (void)networkRequestDidFinish:(NSNotification *)notification {
+    if ([AFNetworkRequestFromNotification(notification) URL]) {
+        [self decrementActivityCount];
+    }
+}
+
+#pragma mark - Internal State Management
+- (void)setCurrentState:(AFNetworkActivityManagerState)currentState {
+    @synchronized(self) {
+        if (_currentState != currentState) {
+            _currentState = currentState;
+            switch (currentState) {
+                case AFNetworkActivityManagerStateNotActive:
+                    [self cancelActivationDelayTimer];
+                    [self cancelCompletionDelayTimer];
+                    [self setNetworkActivityIndicatorVisible:NO];
+                    break;
+                case AFNetworkActivityManagerStateDelayingStart:
+                    [self startActivationDelayTimer];
+                    break;
+                case AFNetworkActivityManagerStateActive:
+                    [self cancelCompletionDelayTimer];
+                    [self setNetworkActivityIndicatorVisible:YES];
+                    break;
+                case AFNetworkActivityManagerStateDelayingEnd:
+                    [self startCompletionDelayTimer];
+                    break;
+            }
+        }
+    }
+}
+
+- (void)updateCurrentStateForNetworkActivityChange {
+    if (self.enabled) {
+        switch (self.currentState) {
+            case AFNetworkActivityManagerStateNotActive:
+                if (self.isNetworkActivityOccurring) {
+                    [self setCurrentState:AFNetworkActivityManagerStateDelayingStart];
+                }
+                break;
+            case AFNetworkActivityManagerStateDelayingStart:
+                //No op. Let the delay timer finish out.
+                break;
+            case AFNetworkActivityManagerStateActive:
+                if (!self.isNetworkActivityOccurring) {
+                    [self setCurrentState:AFNetworkActivityManagerStateDelayingEnd];
+                }
+                break;
+            case AFNetworkActivityManagerStateDelayingEnd:
+                if (self.isNetworkActivityOccurring) {
+                    [self setCurrentState:AFNetworkActivityManagerStateActive];
+                }
+                break;
+        }
+    }
+}
+
+- (void)startActivationDelayTimer {
+    self.activationDelayTimer = [NSTimer
+                                 timerWithTimeInterval:self.activationDelay target:self selector:@selector(activationDelayTimerFired) userInfo:nil repeats:NO];
+    [[NSRunLoop mainRunLoop] addTimer:self.activationDelayTimer forMode:NSRunLoopCommonModes];
+}
+
+- (void)activationDelayTimerFired {
+    if (self.networkActivityOccurring) {
+        [self setCurrentState:AFNetworkActivityManagerStateActive];
+    } else {
+        [self setCurrentState:AFNetworkActivityManagerStateNotActive];
+    }
+}
+
+- (void)startCompletionDelayTimer {
+    [self.completionDelayTimer invalidate];
+    self.completionDelayTimer = [NSTimer timerWithTimeInterval:self.completionDelay target:self selector:@selector(completionDelayTimerFired) userInfo:nil repeats:NO];
+    [[NSRunLoop mainRunLoop] addTimer:self.completionDelayTimer forMode:NSRunLoopCommonModes];
+}
+
+- (void)completionDelayTimerFired {
+    [self setCurrentState:AFNetworkActivityManagerStateNotActive];
+}
+
+- (void)cancelActivationDelayTimer {
+    [self.activationDelayTimer invalidate];
+}
+
+- (void)cancelCompletionDelayTimer {
+    [self.completionDelayTimer invalidate];
+}
+
+@end
+
+#endif

+ 48 - 0
Pods/AFNetworking/UIKit+AFNetworking/UIActivityIndicatorView+AFNetworking.h

@@ -0,0 +1,48 @@
+// UIActivityIndicatorView+AFNetworking.h
+// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import <Foundation/Foundation.h>
+
+#import <TargetConditionals.h>
+
+#if TARGET_OS_IOS || TARGET_OS_TV
+
+#import <UIKit/UIKit.h>
+
+/**
+ This category adds methods to the UIKit framework's `UIActivityIndicatorView` class. The methods in this category provide support for automatically starting and stopping animation depending on the loading state of a session task.
+ */
+@interface UIActivityIndicatorView (AFNetworking)
+
+///----------------------------------
+/// @name Animating for Session Tasks
+///----------------------------------
+
+/**
+ Binds the animating state to the state of the specified task.
+
+ @param task The task. If `nil`, automatic updating from any previously specified operation will be disabled.
+ */
+- (void)setAnimatingWithStateOfTask:(nullable NSURLSessionTask *)task;
+
+@end
+
+#endif

+ 114 - 0
Pods/AFNetworking/UIKit+AFNetworking/UIActivityIndicatorView+AFNetworking.m

@@ -0,0 +1,114 @@
+// UIActivityIndicatorView+AFNetworking.m
+// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import "UIActivityIndicatorView+AFNetworking.h"
+#import <objc/runtime.h>
+
+#if TARGET_OS_IOS || TARGET_OS_TV
+
+#import "AFURLSessionManager.h"
+
+@interface AFActivityIndicatorViewNotificationObserver : NSObject
+@property (readonly, nonatomic, weak) UIActivityIndicatorView *activityIndicatorView;
+- (instancetype)initWithActivityIndicatorView:(UIActivityIndicatorView *)activityIndicatorView;
+
+- (void)setAnimatingWithStateOfTask:(NSURLSessionTask *)task;
+
+@end
+
+@implementation UIActivityIndicatorView (AFNetworking)
+
+- (AFActivityIndicatorViewNotificationObserver *)af_notificationObserver {
+    AFActivityIndicatorViewNotificationObserver *notificationObserver = objc_getAssociatedObject(self, @selector(af_notificationObserver));
+    if (notificationObserver == nil) {
+        notificationObserver = [[AFActivityIndicatorViewNotificationObserver alloc] initWithActivityIndicatorView:self];
+        objc_setAssociatedObject(self, @selector(af_notificationObserver), notificationObserver, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
+    }
+    return notificationObserver;
+}
+
+- (void)setAnimatingWithStateOfTask:(NSURLSessionTask *)task {
+    [[self af_notificationObserver] setAnimatingWithStateOfTask:task];
+}
+
+@end
+
+@implementation AFActivityIndicatorViewNotificationObserver
+
+- (instancetype)initWithActivityIndicatorView:(UIActivityIndicatorView *)activityIndicatorView
+{
+    self = [super init];
+    if (self) {
+        _activityIndicatorView = activityIndicatorView;
+    }
+    return self;
+}
+
+- (void)setAnimatingWithStateOfTask:(NSURLSessionTask *)task {
+    NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
+
+    [notificationCenter removeObserver:self name:AFNetworkingTaskDidResumeNotification object:nil];
+    [notificationCenter removeObserver:self name:AFNetworkingTaskDidSuspendNotification object:nil];
+    [notificationCenter removeObserver:self name:AFNetworkingTaskDidCompleteNotification object:nil];
+    
+    if (task) {
+        if (task.state != NSURLSessionTaskStateCompleted) {
+            UIActivityIndicatorView *activityIndicatorView = self.activityIndicatorView;
+            if (task.state == NSURLSessionTaskStateRunning) {
+                [activityIndicatorView startAnimating];
+            } else {
+                [activityIndicatorView stopAnimating];
+            }
+
+            [notificationCenter addObserver:self selector:@selector(af_startAnimating) name:AFNetworkingTaskDidResumeNotification object:task];
+            [notificationCenter addObserver:self selector:@selector(af_stopAnimating) name:AFNetworkingTaskDidCompleteNotification object:task];
+            [notificationCenter addObserver:self selector:@selector(af_stopAnimating) name:AFNetworkingTaskDidSuspendNotification object:task];
+        }
+    }
+}
+
+#pragma mark -
+
+- (void)af_startAnimating {
+    dispatch_async(dispatch_get_main_queue(), ^{
+        [self.activityIndicatorView startAnimating];
+    });
+}
+
+- (void)af_stopAnimating {
+    dispatch_async(dispatch_get_main_queue(), ^{
+        [self.activityIndicatorView stopAnimating];
+    });
+}
+
+#pragma mark -
+
+- (void)dealloc {
+    NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
+    
+    [notificationCenter removeObserver:self name:AFNetworkingTaskDidCompleteNotification object:nil];
+    [notificationCenter removeObserver:self name:AFNetworkingTaskDidResumeNotification object:nil];
+    [notificationCenter removeObserver:self name:AFNetworkingTaskDidSuspendNotification object:nil];
+}
+
+@end
+
+#endif

+ 175 - 0
Pods/AFNetworking/UIKit+AFNetworking/UIButton+AFNetworking.h

@@ -0,0 +1,175 @@
+// UIButton+AFNetworking.h
+// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import <Foundation/Foundation.h>
+
+#import <TargetConditionals.h>
+
+#if TARGET_OS_IOS || TARGET_OS_TV
+
+#import <UIKit/UIKit.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@class AFImageDownloader;
+
+/**
+ This category adds methods to the UIKit framework's `UIButton` class. The methods in this category provide support for loading remote images and background images asynchronously from a URL.
+
+ @warning Compound values for control `state` (such as `UIControlStateHighlighted | UIControlStateDisabled`) are unsupported.
+ */
+@interface UIButton (AFNetworking)
+
+///------------------------------------
+/// @name Accessing the Image Downloader
+///------------------------------------
+
+/**
+ Set the shared image downloader used to download images.
+
+ @param imageDownloader The shared image downloader used to download images.
+*/
++ (void)setSharedImageDownloader:(AFImageDownloader *)imageDownloader;
+
+/**
+ The shared image downloader used to download images.
+ */
++ (AFImageDownloader *)sharedImageDownloader;
+
+///--------------------
+/// @name Setting Image
+///--------------------
+
+/**
+ Asynchronously downloads an image from the specified URL, and sets it as the image for the specified state once the request is finished. Any previous image request for the receiver will be cancelled.
+
+  If the image is cached locally, the image is set immediately, otherwise the specified placeholder image will be set immediately, and then the remote image will be set once the request is finished.
+
+ @param state The control state.
+ @param url The URL used for the image request.
+ */
+- (void)setImageForState:(UIControlState)state
+                 withURL:(NSURL *)url;
+
+/**
+ Asynchronously downloads an image from the specified URL, and sets it as the image for the specified state once the request is finished. Any previous image request for the receiver will be cancelled.
+
+ If the image is cached locally, the image is set immediately, otherwise the specified placeholder image will be set immediately, and then the remote image will be set once the request is finished.
+
+ @param state The control state.
+ @param url The URL used for the image request.
+ @param placeholderImage The image to be set initially, until the image request finishes. If `nil`, the button will not change its image until the image request finishes.
+ */
+- (void)setImageForState:(UIControlState)state
+                 withURL:(NSURL *)url
+        placeholderImage:(nullable UIImage *)placeholderImage;
+
+/**
+ Asynchronously downloads an image from the specified URL request, and sets it as the image for the specified state once the request is finished. Any previous image request for the receiver will be cancelled.
+
+ If the image is cached locally, the image is set immediately, otherwise the specified placeholder image will be set immediately, and then the remote image will be set once the request is finished.
+
+ If a success block is specified, it is the responsibility of the block to set the image of the button before returning. If no success block is specified, the default behavior of setting the image with `setImage:forState:` is applied.
+
+ @param state The control state.
+ @param urlRequest The URL request used for the image request.
+ @param placeholderImage The image to be set initially, until the image request finishes. If `nil`, the button will not change its image until the image request finishes.
+ @param success A block to be executed when the image data task finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the image created from the response data of request. If the image was returned from cache, the response parameter will be `nil`.
+ @param failure A block object to be executed when the image data task finishes unsuccessfully, or that finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the error object describing the network or parsing error that occurred.
+ */
+- (void)setImageForState:(UIControlState)state
+          withURLRequest:(NSURLRequest *)urlRequest
+        placeholderImage:(nullable UIImage *)placeholderImage
+                 success:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, UIImage *image))success
+                 failure:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, NSError *error))failure;
+
+
+///-------------------------------
+/// @name Setting Background Image
+///-------------------------------
+
+/**
+ Asynchronously downloads an image from the specified URL, and sets it as the background image for the specified state once the request is finished. Any previous background image request for the receiver will be cancelled.
+
+ If the background image is cached locally, the background image is set immediately, otherwise the specified placeholder background image will be set immediately, and then the remote background image will be set once the request is finished.
+
+ @param state The control state.
+ @param url The URL used for the background image request.
+ */
+- (void)setBackgroundImageForState:(UIControlState)state
+                           withURL:(NSURL *)url;
+
+/**
+ Asynchronously downloads an image from the specified URL, and sets it as the background image for the specified state once the request is finished. Any previous image request for the receiver will be cancelled.
+
+ If the image is cached locally, the image is set immediately, otherwise the specified placeholder image will be set immediately, and then the remote image will be set once the request is finished.
+
+ @param state The control state.
+ @param url The URL used for the background image request.
+ @param placeholderImage The background image to be set initially, until the background image request finishes. If `nil`, the button will not change its background image until the background image request finishes.
+ */
+- (void)setBackgroundImageForState:(UIControlState)state
+                           withURL:(NSURL *)url
+                  placeholderImage:(nullable UIImage *)placeholderImage;
+
+/**
+ Asynchronously downloads an image from the specified URL request, and sets it as the image for the specified state once the request is finished. Any previous image request for the receiver will be cancelled.
+
+ If the image is cached locally, the image is set immediately, otherwise the specified placeholder image will be set immediately, and then the remote image will be set once the request is finished.
+
+ If a success block is specified, it is the responsibility of the block to set the image of the button before returning. If no success block is specified, the default behavior of setting the image with `setBackgroundImage:forState:` is applied.
+
+ @param state The control state.
+ @param urlRequest The URL request used for the image request.
+ @param placeholderImage The background image to be set initially, until the background image request finishes. If `nil`, the button will not change its background image until the background image request finishes.
+ @param success A block to be executed when the image data task finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the image created from the response data of request. If the image was returned from cache, the response parameter will be `nil`.
+ @param failure A block object to be executed when the image data task finishes unsuccessfully, or that finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the error object describing the network or parsing error that occurred.
+ */
+- (void)setBackgroundImageForState:(UIControlState)state
+                    withURLRequest:(NSURLRequest *)urlRequest
+                  placeholderImage:(nullable UIImage *)placeholderImage
+                           success:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, UIImage *image))success
+                           failure:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, NSError *error))failure;
+
+
+///------------------------------
+/// @name Canceling Image Loading
+///------------------------------
+
+/**
+ Cancels any executing image task for the specified control state of the receiver, if one exists.
+
+ @param state The control state.
+ */
+- (void)cancelImageDownloadTaskForState:(UIControlState)state;
+
+/**
+ Cancels any executing background image task for the specified control state of the receiver, if one exists.
+
+ @param state The control state.
+ */
+- (void)cancelBackgroundImageDownloadTaskForState:(UIControlState)state;
+
+@end
+
+NS_ASSUME_NONNULL_END
+
+#endif

+ 302 - 0
Pods/AFNetworking/UIKit+AFNetworking/UIButton+AFNetworking.m

@@ -0,0 +1,302 @@
+// UIButton+AFNetworking.m
+// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import "UIButton+AFNetworking.h"
+
+#import <objc/runtime.h>
+
+#if TARGET_OS_IOS || TARGET_OS_TV
+
+#import "UIImageView+AFNetworking.h"
+#import "AFImageDownloader.h"
+
+@interface UIButton (_AFNetworking)
+@end
+
+@implementation UIButton (_AFNetworking)
+
+#pragma mark -
+
+static char AFImageDownloadReceiptNormal;
+static char AFImageDownloadReceiptHighlighted;
+static char AFImageDownloadReceiptSelected;
+static char AFImageDownloadReceiptDisabled;
+
+static const char * af_imageDownloadReceiptKeyForState(UIControlState state) {
+    switch (state) {
+        case UIControlStateHighlighted:
+            return &AFImageDownloadReceiptHighlighted;
+        case UIControlStateSelected:
+            return &AFImageDownloadReceiptSelected;
+        case UIControlStateDisabled:
+            return &AFImageDownloadReceiptDisabled;
+        case UIControlStateNormal:
+        default:
+            return &AFImageDownloadReceiptNormal;
+    }
+}
+
+- (AFImageDownloadReceipt *)af_imageDownloadReceiptForState:(UIControlState)state {
+    return (AFImageDownloadReceipt *)objc_getAssociatedObject(self, af_imageDownloadReceiptKeyForState(state));
+}
+
+- (void)af_setImageDownloadReceipt:(AFImageDownloadReceipt *)imageDownloadReceipt
+                           forState:(UIControlState)state
+{
+    objc_setAssociatedObject(self, af_imageDownloadReceiptKeyForState(state), imageDownloadReceipt, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
+}
+
+#pragma mark -
+
+static char AFBackgroundImageDownloadReceiptNormal;
+static char AFBackgroundImageDownloadReceiptHighlighted;
+static char AFBackgroundImageDownloadReceiptSelected;
+static char AFBackgroundImageDownloadReceiptDisabled;
+
+static const char * af_backgroundImageDownloadReceiptKeyForState(UIControlState state) {
+    switch (state) {
+        case UIControlStateHighlighted:
+            return &AFBackgroundImageDownloadReceiptHighlighted;
+        case UIControlStateSelected:
+            return &AFBackgroundImageDownloadReceiptSelected;
+        case UIControlStateDisabled:
+            return &AFBackgroundImageDownloadReceiptDisabled;
+        case UIControlStateNormal:
+        default:
+            return &AFBackgroundImageDownloadReceiptNormal;
+    }
+}
+
+- (AFImageDownloadReceipt *)af_backgroundImageDownloadReceiptForState:(UIControlState)state {
+    return (AFImageDownloadReceipt *)objc_getAssociatedObject(self, af_backgroundImageDownloadReceiptKeyForState(state));
+}
+
+- (void)af_setBackgroundImageDownloadReceipt:(AFImageDownloadReceipt *)imageDownloadReceipt
+                                     forState:(UIControlState)state
+{
+    objc_setAssociatedObject(self, af_backgroundImageDownloadReceiptKeyForState(state), imageDownloadReceipt, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
+}
+
+@end
+
+#pragma mark -
+
+@implementation UIButton (AFNetworking)
+
++ (AFImageDownloader *)sharedImageDownloader {
+
+    return objc_getAssociatedObject([UIButton class], @selector(sharedImageDownloader)) ?: [AFImageDownloader defaultInstance];
+}
+
++ (void)setSharedImageDownloader:(AFImageDownloader *)imageDownloader {
+    objc_setAssociatedObject([UIButton class], @selector(sharedImageDownloader), imageDownloader, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
+}
+
+#pragma mark -
+
+- (void)setImageForState:(UIControlState)state
+                 withURL:(NSURL *)url
+{
+    [self setImageForState:state withURL:url placeholderImage:nil];
+}
+
+- (void)setImageForState:(UIControlState)state
+                 withURL:(NSURL *)url
+        placeholderImage:(UIImage *)placeholderImage
+{
+    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
+    [request addValue:@"image/*" forHTTPHeaderField:@"Accept"];
+
+    [self setImageForState:state withURLRequest:request placeholderImage:placeholderImage success:nil failure:nil];
+}
+
+- (void)setImageForState:(UIControlState)state
+          withURLRequest:(NSURLRequest *)urlRequest
+        placeholderImage:(nullable UIImage *)placeholderImage
+                 success:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, UIImage *image))success
+                 failure:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, NSError *error))failure
+{
+    if ([self isActiveTaskURLEqualToURLRequest:urlRequest forState:state]) {
+        return;
+    }
+
+    [self cancelImageDownloadTaskForState:state];
+
+    AFImageDownloader *downloader = [[self class] sharedImageDownloader];
+    id <AFImageRequestCache> imageCache = downloader.imageCache;
+
+    //Use the image from the image cache if it exists
+    UIImage *cachedImage = [imageCache imageforRequest:urlRequest withAdditionalIdentifier:nil];
+    if (cachedImage) {
+        if (success) {
+            success(urlRequest, nil, cachedImage);
+        } else {
+            [self setImage:cachedImage forState:state];
+        }
+        [self af_setImageDownloadReceipt:nil forState:state];
+    } else {
+        if (placeholderImage) {
+            [self setImage:placeholderImage forState:state];
+        }
+
+        __weak __typeof(self)weakSelf = self;
+        NSUUID *downloadID = [NSUUID UUID];
+        AFImageDownloadReceipt *receipt;
+        receipt = [downloader
+                   downloadImageForURLRequest:urlRequest
+                   withReceiptID:downloadID
+                   success:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, UIImage * _Nonnull responseObject) {
+                       __strong __typeof(weakSelf)strongSelf = weakSelf;
+                       if ([[strongSelf af_imageDownloadReceiptForState:state].receiptID isEqual:downloadID]) {
+                           if (success) {
+                               success(request, response, responseObject);
+                           } else if (responseObject) {
+                               [strongSelf setImage:responseObject forState:state];
+                           }
+                           [strongSelf af_setImageDownloadReceipt:nil forState:state];
+                       }
+
+                   }
+                   failure:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, NSError * _Nonnull error) {
+                       __strong __typeof(weakSelf)strongSelf = weakSelf;
+                       if ([[strongSelf af_imageDownloadReceiptForState:state].receiptID isEqual:downloadID]) {
+                           if (failure) {
+                               failure(request, response, error);
+                           }
+                           [strongSelf  af_setImageDownloadReceipt:nil forState:state];
+                       }
+                   }];
+
+        [self af_setImageDownloadReceipt:receipt forState:state];
+    }
+}
+
+#pragma mark -
+
+- (void)setBackgroundImageForState:(UIControlState)state
+                           withURL:(NSURL *)url
+{
+    [self setBackgroundImageForState:state withURL:url placeholderImage:nil];
+}
+
+- (void)setBackgroundImageForState:(UIControlState)state
+                           withURL:(NSURL *)url
+                  placeholderImage:(nullable UIImage *)placeholderImage
+{
+    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
+    [request addValue:@"image/*" forHTTPHeaderField:@"Accept"];
+
+    [self setBackgroundImageForState:state withURLRequest:request placeholderImage:placeholderImage success:nil failure:nil];
+}
+
+- (void)setBackgroundImageForState:(UIControlState)state
+                    withURLRequest:(NSURLRequest *)urlRequest
+                  placeholderImage:(nullable UIImage *)placeholderImage
+                           success:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, UIImage *image))success
+                           failure:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, NSError *error))failure
+{
+    if ([self isActiveBackgroundTaskURLEqualToURLRequest:urlRequest forState:state]) {
+        return;
+    }
+
+    [self cancelBackgroundImageDownloadTaskForState:state];
+
+    AFImageDownloader *downloader = [[self class] sharedImageDownloader];
+    id <AFImageRequestCache> imageCache = downloader.imageCache;
+
+    //Use the image from the image cache if it exists
+    UIImage *cachedImage = [imageCache imageforRequest:urlRequest withAdditionalIdentifier:nil];
+    if (cachedImage) {
+        if (success) {
+            success(urlRequest, nil, cachedImage);
+        } else {
+            [self setBackgroundImage:cachedImage forState:state];
+        }
+        [self af_setBackgroundImageDownloadReceipt:nil forState:state];
+    } else {
+        if (placeholderImage) {
+            [self setBackgroundImage:placeholderImage forState:state];
+        }
+
+        __weak __typeof(self)weakSelf = self;
+        NSUUID *downloadID = [NSUUID UUID];
+        AFImageDownloadReceipt *receipt;
+        receipt = [downloader
+                   downloadImageForURLRequest:urlRequest
+                   withReceiptID:downloadID
+                   success:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, UIImage * _Nonnull responseObject) {
+                       __strong __typeof(weakSelf)strongSelf = weakSelf;
+                       if ([[strongSelf af_backgroundImageDownloadReceiptForState:state].receiptID isEqual:downloadID]) {
+                           if (success) {
+                               success(request, response, responseObject);
+                           } else if (responseObject) {
+                               [strongSelf setBackgroundImage:responseObject forState:state];
+                           }
+                           [strongSelf af_setBackgroundImageDownloadReceipt:nil forState:state];
+                       }
+
+                   }
+                   failure:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, NSError * _Nonnull error) {
+                       __strong __typeof(weakSelf)strongSelf = weakSelf;
+                       if ([[strongSelf af_backgroundImageDownloadReceiptForState:state].receiptID isEqual:downloadID]) {
+                           if (failure) {
+                               failure(request, response, error);
+                           }
+                           [strongSelf  af_setBackgroundImageDownloadReceipt:nil forState:state];
+                       }
+                   }];
+
+        [self af_setBackgroundImageDownloadReceipt:receipt forState:state];
+    }
+}
+
+#pragma mark -
+
+- (void)cancelImageDownloadTaskForState:(UIControlState)state {
+    AFImageDownloadReceipt *receipt = [self af_imageDownloadReceiptForState:state];
+    if (receipt != nil) {
+        [[self.class sharedImageDownloader] cancelTaskForImageDownloadReceipt:receipt];
+        [self af_setImageDownloadReceipt:nil forState:state];
+    }
+}
+
+- (void)cancelBackgroundImageDownloadTaskForState:(UIControlState)state {
+    AFImageDownloadReceipt *receipt = [self af_backgroundImageDownloadReceiptForState:state];
+    if (receipt != nil) {
+        [[self.class sharedImageDownloader] cancelTaskForImageDownloadReceipt:receipt];
+        [self af_setBackgroundImageDownloadReceipt:nil forState:state];
+    }
+}
+
+- (BOOL)isActiveTaskURLEqualToURLRequest:(NSURLRequest *)urlRequest forState:(UIControlState)state {
+    AFImageDownloadReceipt *receipt = [self af_imageDownloadReceiptForState:state];
+    return [receipt.task.originalRequest.URL.absoluteString isEqualToString:urlRequest.URL.absoluteString];
+}
+
+- (BOOL)isActiveBackgroundTaskURLEqualToURLRequest:(NSURLRequest *)urlRequest forState:(UIControlState)state {
+    AFImageDownloadReceipt *receipt = [self af_backgroundImageDownloadReceiptForState:state];
+    return [receipt.task.originalRequest.URL.absoluteString isEqualToString:urlRequest.URL.absoluteString];
+}
+
+
+@end
+
+#endif

+ 109 - 0
Pods/AFNetworking/UIKit+AFNetworking/UIImageView+AFNetworking.h

@@ -0,0 +1,109 @@
+// UIImageView+AFNetworking.h
+// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import <Foundation/Foundation.h>
+
+#import <TargetConditionals.h>
+
+#if TARGET_OS_IOS || TARGET_OS_TV
+
+#import <UIKit/UIKit.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@class AFImageDownloader;
+
+/**
+ This category adds methods to the UIKit framework's `UIImageView` class. The methods in this category provide support for loading remote images asynchronously from a URL.
+ */
+@interface UIImageView (AFNetworking)
+
+///------------------------------------
+/// @name Accessing the Image Downloader
+///------------------------------------
+
+/**
+ Set the shared image downloader used to download images.
+
+ @param imageDownloader The shared image downloader used to download images.
+ */
++ (void)setSharedImageDownloader:(AFImageDownloader *)imageDownloader;
+
+/**
+ The shared image downloader used to download images.
+ */
++ (AFImageDownloader *)sharedImageDownloader;
+
+///--------------------
+/// @name Setting Image
+///--------------------
+
+/**
+ Asynchronously downloads an image from the specified URL, and sets it once the request is finished. Any previous image request for the receiver will be cancelled.
+
+ If the image is cached locally, the image is set immediately, otherwise the specified placeholder image will be set immediately, and then the remote image will be set once the request is finished.
+
+ By default, URL requests have a `Accept` header field value of "image / *", a cache policy of `NSURLCacheStorageAllowed` and a timeout interval of 30 seconds, and are set not handle cookies. To configure URL requests differently, use `setImageWithURLRequest:placeholderImage:success:failure:`
+
+ @param url The URL used for the image request.
+ */
+- (void)setImageWithURL:(NSURL *)url;
+
+/**
+ Asynchronously downloads an image from the specified URL, and sets it once the request is finished. Any previous image request for the receiver will be cancelled.
+
+ If the image is cached locally, the image is set immediately, otherwise the specified placeholder image will be set immediately, and then the remote image will be set once the request is finished.
+
+ By default, URL requests have a `Accept` header field value of "image / *", a cache policy of `NSURLCacheStorageAllowed` and a timeout interval of 30 seconds, and are set not handle cookies. To configure URL requests differently, use `setImageWithURLRequest:placeholderImage:success:failure:`
+
+ @param url The URL used for the image request.
+ @param placeholderImage The image to be set initially, until the image request finishes. If `nil`, the image view will not change its image until the image request finishes.
+ */
+- (void)setImageWithURL:(NSURL *)url
+       placeholderImage:(nullable UIImage *)placeholderImage;
+
+/**
+ Asynchronously downloads an image from the specified URL request, and sets it once the request is finished. Any previous image request for the receiver will be cancelled.
+
+ If the image is cached locally, the image is set immediately, otherwise the specified placeholder image will be set immediately, and then the remote image will be set once the request is finished.
+
+ If a success block is specified, it is the responsibility of the block to set the image of the image view before returning. If no success block is specified, the default behavior of setting the image with `self.image = image` is applied.
+
+ @param urlRequest The URL request used for the image request.
+ @param placeholderImage The image to be set initially, until the image request finishes. If `nil`, the image view will not change its image until the image request finishes.
+ @param success A block to be executed when the image data task finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the image created from the response data of request. If the image was returned from cache, the response parameter will be `nil`.
+ @param failure A block object to be executed when the image data task finishes unsuccessfully, or that finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the error object describing the network or parsing error that occurred.
+ */
+- (void)setImageWithURLRequest:(NSURLRequest *)urlRequest
+              placeholderImage:(nullable UIImage *)placeholderImage
+                       success:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, UIImage *image))success
+                       failure:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, NSError *error))failure;
+
+/**
+ Cancels any executing image operation for the receiver, if one exists.
+ */
+- (void)cancelImageDownloadTask;
+
+@end
+
+NS_ASSUME_NONNULL_END
+
+#endif

+ 159 - 0
Pods/AFNetworking/UIKit+AFNetworking/UIImageView+AFNetworking.m

@@ -0,0 +1,159 @@
+// UIImageView+AFNetworking.m
+// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import "UIImageView+AFNetworking.h"
+
+#import <objc/runtime.h>
+
+#if TARGET_OS_IOS || TARGET_OS_TV
+
+#import "AFImageDownloader.h"
+
+@interface UIImageView (_AFNetworking)
+@property (readwrite, nonatomic, strong, setter = af_setActiveImageDownloadReceipt:) AFImageDownloadReceipt *af_activeImageDownloadReceipt;
+@end
+
+@implementation UIImageView (_AFNetworking)
+
+- (AFImageDownloadReceipt *)af_activeImageDownloadReceipt {
+    return (AFImageDownloadReceipt *)objc_getAssociatedObject(self, @selector(af_activeImageDownloadReceipt));
+}
+
+- (void)af_setActiveImageDownloadReceipt:(AFImageDownloadReceipt *)imageDownloadReceipt {
+    objc_setAssociatedObject(self, @selector(af_activeImageDownloadReceipt), imageDownloadReceipt, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
+}
+
+@end
+
+#pragma mark -
+
+@implementation UIImageView (AFNetworking)
+
++ (AFImageDownloader *)sharedImageDownloader {
+    return objc_getAssociatedObject([UIImageView class], @selector(sharedImageDownloader)) ?: [AFImageDownloader defaultInstance];
+}
+
++ (void)setSharedImageDownloader:(AFImageDownloader *)imageDownloader {
+    objc_setAssociatedObject([UIImageView class], @selector(sharedImageDownloader), imageDownloader, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
+}
+
+#pragma mark -
+
+- (void)setImageWithURL:(NSURL *)url {
+    [self setImageWithURL:url placeholderImage:nil];
+}
+
+- (void)setImageWithURL:(NSURL *)url
+       placeholderImage:(UIImage *)placeholderImage
+{
+    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
+    [request addValue:@"image/*" forHTTPHeaderField:@"Accept"];
+
+    [self setImageWithURLRequest:request placeholderImage:placeholderImage success:nil failure:nil];
+}
+
+- (void)setImageWithURLRequest:(NSURLRequest *)urlRequest
+              placeholderImage:(UIImage *)placeholderImage
+                       success:(void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, UIImage *image))success
+                       failure:(void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, NSError *error))failure
+{
+    if ([urlRequest URL] == nil) {
+        self.image = placeholderImage;
+        if (failure) {
+            NSError *error = [NSError errorWithDomain:NSURLErrorDomain code:NSURLErrorBadURL userInfo:nil];
+            failure(urlRequest, nil, error);
+        }
+        return;
+    }
+    
+    if ([self isActiveTaskURLEqualToURLRequest:urlRequest]) {
+        return;
+    }
+    
+    [self cancelImageDownloadTask];
+
+    AFImageDownloader *downloader = [[self class] sharedImageDownloader];
+    id <AFImageRequestCache> imageCache = downloader.imageCache;
+
+    //Use the image from the image cache if it exists
+    UIImage *cachedImage = [imageCache imageforRequest:urlRequest withAdditionalIdentifier:nil];
+    if (cachedImage) {
+        if (success) {
+            success(urlRequest, nil, cachedImage);
+        } else {
+            self.image = cachedImage;
+        }
+        [self clearActiveDownloadInformation];
+    } else {
+        if (placeholderImage) {
+            self.image = placeholderImage;
+        }
+
+        __weak __typeof(self)weakSelf = self;
+        NSUUID *downloadID = [NSUUID UUID];
+        AFImageDownloadReceipt *receipt;
+        receipt = [downloader
+                   downloadImageForURLRequest:urlRequest
+                   withReceiptID:downloadID
+                   success:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, UIImage * _Nonnull responseObject) {
+                       __strong __typeof(weakSelf)strongSelf = weakSelf;
+                       if ([strongSelf.af_activeImageDownloadReceipt.receiptID isEqual:downloadID]) {
+                           if (success) {
+                               success(request, response, responseObject);
+                           } else if (responseObject) {
+                               strongSelf.image = responseObject;
+                           }
+                           [strongSelf clearActiveDownloadInformation];
+                       }
+
+                   }
+                   failure:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, NSError * _Nonnull error) {
+                       __strong __typeof(weakSelf)strongSelf = weakSelf;
+                        if ([strongSelf.af_activeImageDownloadReceipt.receiptID isEqual:downloadID]) {
+                            if (failure) {
+                                failure(request, response, error);
+                            }
+                            [strongSelf clearActiveDownloadInformation];
+                        }
+                   }];
+
+        self.af_activeImageDownloadReceipt = receipt;
+    }
+}
+
+- (void)cancelImageDownloadTask {
+    if (self.af_activeImageDownloadReceipt != nil) {
+        [[self.class sharedImageDownloader] cancelTaskForImageDownloadReceipt:self.af_activeImageDownloadReceipt];
+        [self clearActiveDownloadInformation];
+     }
+}
+
+- (void)clearActiveDownloadInformation {
+    self.af_activeImageDownloadReceipt = nil;
+}
+
+- (BOOL)isActiveTaskURLEqualToURLRequest:(NSURLRequest *)urlRequest {
+    return [self.af_activeImageDownloadReceipt.task.originalRequest.URL.absoluteString isEqualToString:urlRequest.URL.absoluteString];
+}
+
+@end
+
+#endif

+ 43 - 0
Pods/AFNetworking/UIKit+AFNetworking/UIKit+AFNetworking.h

@@ -0,0 +1,43 @@
+// UIKit+AFNetworking.h
+//
+// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import <TargetConditionals.h>
+
+#ifndef _UIKIT_AFNETWORKING_
+    #define _UIKIT_AFNETWORKING_
+
+#if TARGET_OS_IOS || TARGET_OS_TV
+    #import "AFAutoPurgingImageCache.h"
+    #import "AFImageDownloader.h"
+    #import "UIActivityIndicatorView+AFNetworking.h"
+    #import "UIButton+AFNetworking.h"
+    #import "UIImageView+AFNetworking.h"
+    #import "UIProgressView+AFNetworking.h"
+#endif
+
+#if TARGET_OS_IOS
+    #import "AFNetworkActivityIndicatorManager.h"
+    #import "UIRefreshControl+AFNetworking.h"
+    #import "WKWebView+AFNetworking.h"
+#endif
+
+#endif /* _UIKIT_AFNETWORKING_ */

+ 64 - 0
Pods/AFNetworking/UIKit+AFNetworking/UIProgressView+AFNetworking.h

@@ -0,0 +1,64 @@
+// UIProgressView+AFNetworking.h
+// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import <Foundation/Foundation.h>
+
+#import <TargetConditionals.h>
+
+#if TARGET_OS_IOS || TARGET_OS_TV
+
+#import <UIKit/UIKit.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+
+/**
+ This category adds methods to the UIKit framework's `UIProgressView` class. The methods in this category provide support for binding the progress to the upload and download progress of a session task.
+ */
+@interface UIProgressView (AFNetworking)
+
+///------------------------------------
+/// @name Setting Session Task Progress
+///------------------------------------
+
+/**
+ Binds the progress to the upload progress of the specified session task.
+
+ @param task The session task.
+ @param animated `YES` if the change should be animated, `NO` if the change should happen immediately.
+ */
+- (void)setProgressWithUploadProgressOfTask:(NSURLSessionUploadTask *)task
+                                   animated:(BOOL)animated;
+
+/**
+ Binds the progress to the download progress of the specified session task.
+
+ @param task The session task.
+ @param animated `YES` if the change should be animated, `NO` if the change should happen immediately.
+ */
+- (void)setProgressWithDownloadProgressOfTask:(NSURLSessionDownloadTask *)task
+                                     animated:(BOOL)animated;
+
+@end
+
+NS_ASSUME_NONNULL_END
+
+#endif

+ 126 - 0
Pods/AFNetworking/UIKit+AFNetworking/UIProgressView+AFNetworking.m

@@ -0,0 +1,126 @@
+// UIProgressView+AFNetworking.m
+// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import "UIProgressView+AFNetworking.h"
+
+#import <objc/runtime.h>
+
+#if TARGET_OS_IOS || TARGET_OS_TV
+
+#import "AFURLSessionManager.h"
+
+static void * AFTaskCountOfBytesSentContext = &AFTaskCountOfBytesSentContext;
+static void * AFTaskCountOfBytesReceivedContext = &AFTaskCountOfBytesReceivedContext;
+
+#pragma mark -
+
+@implementation UIProgressView (AFNetworking)
+
+- (BOOL)af_uploadProgressAnimated {
+    return [(NSNumber *)objc_getAssociatedObject(self, @selector(af_uploadProgressAnimated)) boolValue];
+}
+
+- (void)af_setUploadProgressAnimated:(BOOL)animated {
+    objc_setAssociatedObject(self, @selector(af_uploadProgressAnimated), @(animated), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
+}
+
+- (BOOL)af_downloadProgressAnimated {
+    return [(NSNumber *)objc_getAssociatedObject(self, @selector(af_downloadProgressAnimated)) boolValue];
+}
+
+- (void)af_setDownloadProgressAnimated:(BOOL)animated {
+    objc_setAssociatedObject(self, @selector(af_downloadProgressAnimated), @(animated), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
+}
+
+#pragma mark -
+
+- (void)setProgressWithUploadProgressOfTask:(NSURLSessionUploadTask *)task
+                                   animated:(BOOL)animated
+{
+    if (task.state == NSURLSessionTaskStateCompleted) {
+        return;
+    }
+    
+    [task addObserver:self forKeyPath:@"state" options:(NSKeyValueObservingOptions)0 context:AFTaskCountOfBytesSentContext];
+    [task addObserver:self forKeyPath:@"countOfBytesSent" options:(NSKeyValueObservingOptions)0 context:AFTaskCountOfBytesSentContext];
+
+    [self af_setUploadProgressAnimated:animated];
+}
+
+- (void)setProgressWithDownloadProgressOfTask:(NSURLSessionDownloadTask *)task
+                                     animated:(BOOL)animated
+{
+    if (task.state == NSURLSessionTaskStateCompleted) {
+        return;
+    }
+    
+    [task addObserver:self forKeyPath:@"state" options:(NSKeyValueObservingOptions)0 context:AFTaskCountOfBytesReceivedContext];
+    [task addObserver:self forKeyPath:@"countOfBytesReceived" options:(NSKeyValueObservingOptions)0 context:AFTaskCountOfBytesReceivedContext];
+
+    [self af_setDownloadProgressAnimated:animated];
+}
+
+#pragma mark - NSKeyValueObserving
+
+- (void)observeValueForKeyPath:(NSString *)keyPath
+                      ofObject:(id)object
+                        change:(__unused NSDictionary *)change
+                       context:(void *)context
+{
+    if (context == AFTaskCountOfBytesSentContext || context == AFTaskCountOfBytesReceivedContext) {
+        if ([keyPath isEqualToString:NSStringFromSelector(@selector(countOfBytesSent))]) {
+            if ([object countOfBytesExpectedToSend] > 0) {
+                dispatch_async(dispatch_get_main_queue(), ^{
+                    [self setProgress:[object countOfBytesSent] / ([object countOfBytesExpectedToSend] * 1.0f) animated:self.af_uploadProgressAnimated];
+                });
+            }
+        }
+
+        if ([keyPath isEqualToString:NSStringFromSelector(@selector(countOfBytesReceived))]) {
+            if ([object countOfBytesExpectedToReceive] > 0) {
+                dispatch_async(dispatch_get_main_queue(), ^{
+                    [self setProgress:[object countOfBytesReceived] / ([object countOfBytesExpectedToReceive] * 1.0f) animated:self.af_downloadProgressAnimated];
+                });
+            }
+        }
+
+        if ([keyPath isEqualToString:NSStringFromSelector(@selector(state))]) {
+            if ([(NSURLSessionTask *)object state] == NSURLSessionTaskStateCompleted) {
+                @try {
+                    [object removeObserver:self forKeyPath:NSStringFromSelector(@selector(state))];
+
+                    if (context == AFTaskCountOfBytesSentContext) {
+                        [object removeObserver:self forKeyPath:NSStringFromSelector(@selector(countOfBytesSent))];
+                    }
+
+                    if (context == AFTaskCountOfBytesReceivedContext) {
+                        [object removeObserver:self forKeyPath:NSStringFromSelector(@selector(countOfBytesReceived))];
+                    }
+                }
+                @catch (NSException * __unused exception) {}
+            }
+        }
+    }
+}
+
+@end
+
+#endif

+ 53 - 0
Pods/AFNetworking/UIKit+AFNetworking/UIRefreshControl+AFNetworking.h

@@ -0,0 +1,53 @@
+// UIRefreshControl+AFNetworking.m
+//
+// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import <Foundation/Foundation.h>
+
+#import <TargetConditionals.h>
+
+#if TARGET_OS_IOS
+
+#import <UIKit/UIKit.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+/**
+ This category adds methods to the UIKit framework's `UIRefreshControl` class. The methods in this category provide support for automatically beginning and ending refreshing depending on the loading state of a session task.
+ */
+@interface UIRefreshControl (AFNetworking)
+
+///-----------------------------------
+/// @name Refreshing for Session Tasks
+///-----------------------------------
+
+/**
+ Binds the refreshing state to the state of the specified task.
+ 
+ @param task The task. If `nil`, automatic updating from any previously specified operation will be disabled.
+ */
+- (void)setRefreshingWithStateOfTask:(NSURLSessionTask *)task;
+
+@end
+
+NS_ASSUME_NONNULL_END
+
+#endif

+ 113 - 0
Pods/AFNetworking/UIKit+AFNetworking/UIRefreshControl+AFNetworking.m

@@ -0,0 +1,113 @@
+// UIRefreshControl+AFNetworking.m
+//
+// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import "UIRefreshControl+AFNetworking.h"
+#import <objc/runtime.h>
+
+#if TARGET_OS_IOS
+
+#import "AFURLSessionManager.h"
+
+@interface AFRefreshControlNotificationObserver : NSObject
+@property (readonly, nonatomic, weak) UIRefreshControl *refreshControl;
+- (instancetype)initWithActivityRefreshControl:(UIRefreshControl *)refreshControl;
+
+- (void)setRefreshingWithStateOfTask:(NSURLSessionTask *)task;
+
+@end
+
+@implementation UIRefreshControl (AFNetworking)
+
+- (AFRefreshControlNotificationObserver *)af_notificationObserver {
+    AFRefreshControlNotificationObserver *notificationObserver = objc_getAssociatedObject(self, @selector(af_notificationObserver));
+    if (notificationObserver == nil) {
+        notificationObserver = [[AFRefreshControlNotificationObserver alloc] initWithActivityRefreshControl:self];
+        objc_setAssociatedObject(self, @selector(af_notificationObserver), notificationObserver, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
+    }
+    return notificationObserver;
+}
+
+- (void)setRefreshingWithStateOfTask:(NSURLSessionTask *)task {
+    [[self af_notificationObserver] setRefreshingWithStateOfTask:task];
+}
+
+@end
+
+@implementation AFRefreshControlNotificationObserver
+
+- (instancetype)initWithActivityRefreshControl:(UIRefreshControl *)refreshControl
+{
+    self = [super init];
+    if (self) {
+        _refreshControl = refreshControl;
+    }
+    return self;
+}
+
+- (void)setRefreshingWithStateOfTask:(NSURLSessionTask *)task {
+    NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
+
+    [notificationCenter removeObserver:self name:AFNetworkingTaskDidResumeNotification object:nil];
+    [notificationCenter removeObserver:self name:AFNetworkingTaskDidSuspendNotification object:nil];
+    [notificationCenter removeObserver:self name:AFNetworkingTaskDidCompleteNotification object:nil];
+
+    if (task) {
+        UIRefreshControl *refreshControl = self.refreshControl;
+        if (task.state == NSURLSessionTaskStateRunning) {
+            [refreshControl beginRefreshing];
+
+            [notificationCenter addObserver:self selector:@selector(af_beginRefreshing) name:AFNetworkingTaskDidResumeNotification object:task];
+            [notificationCenter addObserver:self selector:@selector(af_endRefreshing) name:AFNetworkingTaskDidCompleteNotification object:task];
+            [notificationCenter addObserver:self selector:@selector(af_endRefreshing) name:AFNetworkingTaskDidSuspendNotification object:task];
+        } else {
+            [refreshControl endRefreshing];
+        }
+    }
+}
+
+#pragma mark -
+
+- (void)af_beginRefreshing {
+    dispatch_async(dispatch_get_main_queue(), ^{
+        [self.refreshControl beginRefreshing];
+    });
+}
+
+- (void)af_endRefreshing {
+    dispatch_async(dispatch_get_main_queue(), ^{
+        [self.refreshControl endRefreshing];
+    });
+}
+
+#pragma mark -
+
+- (void)dealloc {
+    NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
+    
+    [notificationCenter removeObserver:self name:AFNetworkingTaskDidCompleteNotification object:nil];
+    [notificationCenter removeObserver:self name:AFNetworkingTaskDidResumeNotification object:nil];
+    [notificationCenter removeObserver:self name:AFNetworkingTaskDidSuspendNotification object:nil];
+}
+
+@end
+
+#endif

+ 80 - 0
Pods/AFNetworking/UIKit+AFNetworking/WKWebView+AFNetworking.h

@@ -0,0 +1,80 @@
+// WkWebView+AFNetworking.h
+// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import <Foundation/Foundation.h>
+
+#import <TargetConditionals.h>
+
+#if TARGET_OS_IOS
+
+#import <UIKit/UIKit.h>
+#import <WebKit/WebKit.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@class AFHTTPSessionManager;
+
+@interface WKWebView (AFNetworking)
+
+/**
+ The session manager used to download all request
+ */
+@property (nonatomic, strong) AFHTTPSessionManager *sessionManager;
+
+/**
+ Asynchronously loads the specified request.
+ 
+ @param request A URL request identifying the location of the content to load. This must not be `nil`.
+ @param navigation The WKNavigation object that containts information for tracking the loading progress of a webpage. This must not be `nil`.
+ @param progress A progress object monitoring the current download progress.
+ @param success A block object to be executed when the request finishes loading successfully. This block returns the HTML string to be loaded by the web view, and takes two arguments: the response, and the response string.
+ @param failure A block object to be executed when the data task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a single argument: the error that occurred.
+ */
+- (void)loadRequest:(NSURLRequest *)request
+         navigation:(WKNavigation * _Nonnull)navigation
+           progress:(NSProgress * _Nullable __autoreleasing * _Nullable)progress
+            success:(nullable NSString * (^)(NSHTTPURLResponse *response, NSString *HTML))success
+            failure:(nullable void (^)(NSError *error))failure;
+
+/**
+ Asynchronously loads the data associated with a particular request with a specified MIME type and text encoding.
+ 
+ @param request A URL request identifying the location of the content to load. This must not be `nil`.
+ @param navigation The WKNavigation object that containts information for tracking the loading progress of a webpage.  This must not be `nil`.
+ @param MIMEType The MIME type of the content. Defaults to the content type of the response if not specified.
+ @param textEncodingName The IANA encoding name, as in `utf-8` or `utf-16`. Defaults to the response text encoding if not specified.
+ @param progress A progress object monitoring the current download progress.
+ @param success A block object to be executed when the request finishes loading successfully. This block returns the data to be loaded by the web view and takes two arguments: the response, and the downloaded data.
+ @param failure A block object to be executed when the data task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a single argument: the error that occurred.
+ */
+- (void)loadRequest:(NSURLRequest *)request
+         navigation:(WKNavigation * _Nonnull)navigation
+           MIMEType:(nullable NSString *)MIMEType
+   textEncodingName:(nullable NSString *)textEncodingName
+           progress:(NSProgress * _Nullable __autoreleasing * _Nullable)progress
+            success:(nullable NSData * (^)(NSHTTPURLResponse *response, NSData *data))success
+            failure:(nullable void (^)(NSError *error))failure;
+
+@end
+
+NS_ASSUME_NONNULL_END
+
+#endif

+ 154 - 0
Pods/AFNetworking/UIKit+AFNetworking/WKWebView+AFNetworking.m

@@ -0,0 +1,154 @@
+// WkWebView+AFNetworking.m
+// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import "WKWebView+AFNetworking.h"
+
+#import <objc/runtime.h>
+
+#if TARGET_OS_IOS
+
+#import "AFHTTPSessionManager.h"
+#import "AFURLResponseSerialization.h"
+#import "AFURLRequestSerialization.h"
+
+@interface WKWebView (_AFNetworking)
+@property (readwrite, nonatomic, strong, setter = af_setURLSessionTask:) NSURLSessionDataTask *af_URLSessionTask;
+@end
+
+@implementation WKWebView (_AFNetworking)
+
+- (NSURLSessionDataTask *)af_URLSessionTask {
+    return (NSURLSessionDataTask *)objc_getAssociatedObject(self, @selector(af_URLSessionTask));
+}
+
+- (void)af_setURLSessionTask:(NSURLSessionDataTask *)af_URLSessionTask {
+    objc_setAssociatedObject(self, @selector(af_URLSessionTask), af_URLSessionTask, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
+}
+
+@end
+
+#pragma mark -
+
+@implementation WKWebView (AFNetworking)
+
+- (AFHTTPSessionManager *)sessionManager {
+    static AFHTTPSessionManager *_af_defaultHTTPSessionManager = nil;
+    static dispatch_once_t onceToken;
+    dispatch_once(&onceToken, ^{
+        _af_defaultHTTPSessionManager = [[AFHTTPSessionManager alloc] initWithSessionConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]];
+        _af_defaultHTTPSessionManager.requestSerializer = [AFHTTPRequestSerializer serializer];
+        _af_defaultHTTPSessionManager.responseSerializer = [AFHTTPResponseSerializer serializer];
+    });
+    
+    return objc_getAssociatedObject(self, @selector(sessionManager)) ?: _af_defaultHTTPSessionManager;
+}
+
+- (void)setSessionManager:(AFHTTPSessionManager *)sessionManager {
+    objc_setAssociatedObject(self, @selector(sessionManager), sessionManager, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
+}
+
+- (AFHTTPResponseSerializer <AFURLResponseSerialization> *)responseSerializer {
+    static AFHTTPResponseSerializer <AFURLResponseSerialization> *_af_defaultResponseSerializer = nil;
+    static dispatch_once_t onceToken;
+    dispatch_once(&onceToken, ^{
+        _af_defaultResponseSerializer = [AFHTTPResponseSerializer serializer];
+    });
+    
+    return objc_getAssociatedObject(self, @selector(responseSerializer)) ?: _af_defaultResponseSerializer;
+}
+
+- (void)setResponseSerializer:(AFHTTPResponseSerializer<AFURLResponseSerialization> *)responseSerializer {
+    objc_setAssociatedObject(self, @selector(responseSerializer), responseSerializer, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
+}
+
+#pragma mark -
+
+- (void)loadRequest:(NSURLRequest *)request
+         navigation:(WKNavigation * _Nonnull)navigation
+           progress:(NSProgress * _Nullable __autoreleasing * _Nullable)progress
+            success:(nullable NSString * (^)(NSHTTPURLResponse *response, NSString *HTML))success
+            failure:(nullable void (^)(NSError *error))failure {
+    [self loadRequest:request navigation:navigation MIMEType:nil textEncodingName:nil progress:progress success:^NSData * _Nonnull(NSHTTPURLResponse * _Nonnull response, NSData * _Nonnull data) {
+        NSStringEncoding stringEncoding = NSUTF8StringEncoding;
+        if (response.textEncodingName) {
+            CFStringEncoding encoding = CFStringConvertIANACharSetNameToEncoding((CFStringRef)response.textEncodingName);
+            if (encoding != kCFStringEncodingInvalidId) {
+                stringEncoding = CFStringConvertEncodingToNSStringEncoding(encoding);
+            }
+        }
+        
+        NSString *string = [[NSString alloc] initWithData:data encoding:stringEncoding];
+        if (success) {
+            string = success(response, string);
+        }
+        
+        return [string dataUsingEncoding:stringEncoding];
+    } failure:failure];
+}
+
+- (void)loadRequest:(NSURLRequest *)request
+         navigation:(WKNavigation * _Nonnull)navigation
+           MIMEType:(nullable NSString *)MIMEType
+   textEncodingName:(nullable NSString *)textEncodingName
+           progress:(NSProgress * _Nullable __autoreleasing * _Nullable)progress
+            success:(nullable NSData * (^)(NSHTTPURLResponse *response, NSData *data))success
+            failure:(nullable void (^)(NSError *error))failure {
+    NSParameterAssert(request);
+    
+    if (self.af_URLSessionTask.state == NSURLSessionTaskStateRunning || self.af_URLSessionTask.state == NSURLSessionTaskStateSuspended) {
+        [self.af_URLSessionTask cancel];
+    }
+    self.af_URLSessionTask = nil;
+    
+    __weak __typeof(self)weakSelf = self;
+    __block NSURLSessionDataTask *dataTask;
+    __strong __typeof(weakSelf) strongSelf = weakSelf;
+    __strong __typeof(weakSelf.navigationDelegate) strongSelfDelegate = strongSelf.navigationDelegate;
+    dataTask = [self.sessionManager dataTaskWithRequest:request uploadProgress:nil downloadProgress:nil completionHandler:^(NSURLResponse * _Nonnull response, id  _Nullable responseObject, NSError * _Nullable error) {
+        if (error) {
+            if (failure) {
+                failure(error);
+            }
+        } else {
+            if (success) {
+                success((NSHTTPURLResponse *)response, responseObject);
+            }
+            [strongSelf loadData:responseObject MIMEType:MIMEType characterEncodingName:textEncodingName baseURL:[dataTask.currentRequest URL]];
+            
+            if ([strongSelfDelegate respondsToSelector:@selector(webView:didFinishNavigation:)]) {
+                [strongSelfDelegate webView:strongSelf didFinishNavigation:navigation];
+            }
+        }
+    }];
+    self.af_URLSessionTask = dataTask;
+    if (progress != nil) {
+        *progress = [self.sessionManager downloadProgressForTask:dataTask];
+    }
+    [self.af_URLSessionTask resume];
+    
+    if ([strongSelfDelegate respondsToSelector:@selector(webView:didStartProvisionalNavigation:)]) {
+        [strongSelfDelegate webView:self didStartProvisionalNavigation:navigation];
+    }
+}
+
+@end
+
+#endif

+ 16 - 0
Pods/BRPickerView/BRPickerView/BRPickerView.h

@@ -0,0 +1,16 @@
+//
+//  BRPickerView.h
+//  BRPickerViewDemo
+//
+//  Created by renbo on 2017/8/11.
+//  Copyright © 2017 irenb. All rights reserved.
+//
+//  最新代码下载地址:https://github.com/agiapp/BRPickerView
+
+#ifndef BRPickerView_h
+#define BRPickerView_h
+
+#import "BRDatePickerView.h"
+#import "BRTextPickerView.h"
+
+#endif /* BRPickerView_h */

+ 73 - 0
Pods/BRPickerView/BRPickerView/Core/BRPickerAlertView.h

@@ -0,0 +1,73 @@
+//
+//  BRPickerAlertView.h
+//  BRPickerViewDemo
+//
+//  Created by renbo on 2017/8/11.
+//  Copyright © 2017 irenb. All rights reserved.
+//
+//  最新代码下载地址:https://github.com/agiapp/BRPickerView
+
+#import <UIKit/UIKit.h>
+#import "BRPickerStyle.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+typedef void(^BRPickerAlertCancelBlock)(void);
+typedef void(^BRPickerAlertDoneBlock)(void);
+
+@interface BRPickerAlertView : UIView
+
+/** 选择器标题 */
+@property (nullable, nonatomic, copy) NSString *title;
+
+/** 自定义UI样式(不传或为nil时,是默认样式) */
+@property (nullable, nonatomic, strong) BRPickerStyle *pickerStyle;
+
+/** accessory view for above picker view. default is nil */
+@property (nullable, nonatomic, strong) UIView *pickerHeaderView;
+
+/** accessory view below picker view. default is nil */
+@property (nullable, nonatomic, strong) UIView *pickerFooterView;
+
+/** 取消选择的回调 */
+@property (nullable, nonatomic, copy) BRPickerAlertCancelBlock cancelBlock;
+
+/// 确定按钮点击事件的回调
+/// 应用场景:如果是自定义确定按钮,需要在该按钮点击事件方法里,执行一下 doneBlock 回调。目的是触发组件内部执行 resultBlock 回调,回调选择的值
+@property (nullable, nonatomic, copy) BRPickerAlertDoneBlock doneBlock;
+
+/** 弹框视图(使用场景:可以在 alertView 上添加选择器的自定义背景视图) */
+@property (nullable, nonatomic, strong) UIView *alertView;
+
+/** 组件的父视图:可以传 自己获取的 keyWindow,或页面的 view */
+@property (nullable, nonatomic, strong) UIView *keyView;
+
+
+/// 刷新选择器数据
+/// 应用场景:动态更新数据源、动态更新选择的值、选择器类型切换等
+- (void)reloadData;
+
+/// 扩展一:添加选择器到指定容器视图上
+/// 应用场景:可将中间的滚轮选择器 pickerView 视图(不包含蒙层及标题栏)添加到任何自定义视图上(会自动填满容器视图),也方便自定义更多的弹框样式
+/// 补充说明:如果是自定义确定按钮,需要回调默认选择的值:只需在自定义确定按钮的点击事件方法里执行一下 doneBlock 回调(目的是去触发组件内部执行 resultBlock 回调,进而回调默认选择的值)
+/// @param view 容器视图
+- (void)addPickerToView:(nullable UIView *)view NS_REQUIRES_SUPER;
+
+/// 从指定容器视图上移除选择器
+/// @param view 容器视图
+- (void)removePickerFromView:(nullable UIView *)view;
+
+/// 扩展二:添加自定义视图到选择器(pickerView)上
+/// 应用场景:可以添加一些固定的标题、单位等到选择器中间
+/// @param customView 自定义视图
+- (void)addSubViewToPicker:(UIView *)customView;
+
+/// 扩展三:添加自定义视图到标题栏(titleBarView)上
+/// 应用场景:可以添加一些子控件到标题栏
+/// @param customView 自定义视图
+- (void)addSubViewToTitleBar:(UIView *)customView;
+
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 398 - 0
Pods/BRPickerView/BRPickerView/Core/BRPickerAlertView.m

@@ -0,0 +1,398 @@
+//
+//  BRPickerAlertView.m
+//  BRPickerViewDemo
+//
+//  Created by renbo on 2017/8/11.
+//  Copyright © 2017 irenb. All rights reserved.
+//
+//  最新代码下载地址:https://github.com/agiapp/BRPickerView
+
+#import "BRPickerAlertView.h"
+
+@interface BRPickerAlertView ()
+// 蒙层视图
+@property (nonatomic, strong) UIView *maskBgView;
+// 标题栏背景视图
+@property (nonatomic, strong) UIView *titleBarView;
+// 左边取消按钮
+@property (nonatomic, strong) UIButton *cancelBtn;
+// 右边确定按钮
+@property (nonatomic, strong) UIButton *doneBtn;
+// 中间标题
+@property (nonatomic, strong) UILabel *titleLabel;
+
+// 取消按钮离屏幕边缘的距离
+@property (nonatomic, assign) CGFloat cancelBtnMargin;
+// 确定按钮离屏幕边缘的距离
+@property (nonatomic, assign) CGFloat doneBtnMargin;
+
+@end
+
+@implementation BRPickerAlertView
+
+- (void)initUI {
+    self.frame = self.keyView.bounds;
+    // 设置子视图的宽度随着父视图变化
+    self.autoresizingMask = UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
+    
+    if (!self.pickerStyle.hiddenMaskView) {
+        [self addSubview:self.maskBgView];
+    }
+    
+    [self addSubview:self.alertView];
+    
+    // 是否隐藏标题栏
+    if (!self.pickerStyle.hiddenTitleBarView) {
+        [self.alertView addSubview:self.titleBarView];
+        [self.alertView sendSubviewToBack:self.titleBarView];
+
+        if (!self.pickerStyle.hiddenTitleLabel) {
+            [self.titleBarView addSubview:self.titleLabel];
+        }
+        if (!self.pickerStyle.hiddenCancelBtn) {
+            [self.titleBarView addSubview:self.cancelBtn];
+            // 获取边距
+            if (self.pickerStyle.cancelBtnFrame.origin.x < self.bounds.size.width / 2) {
+                self.cancelBtnMargin = self.pickerStyle.cancelBtnFrame.origin.x;
+            } else {
+                self.cancelBtnMargin = self.bounds.size.width - self.pickerStyle.cancelBtnFrame.origin.x - self.pickerStyle.cancelBtnFrame.size.width;
+            }
+        }
+        if (!self.pickerStyle.hiddenDoneBtn) {
+            [self.titleBarView addSubview:self.doneBtn];
+            // 获取边距
+            if (self.pickerStyle.doneBtnFrame.origin.x < self.bounds.size.width / 2) {
+                self.doneBtnMargin = self.pickerStyle.doneBtnFrame.origin.x;
+            } else {
+                self.doneBtnMargin = self.bounds.size.width - self.pickerStyle.doneBtnFrame.origin.x - self.pickerStyle.doneBtnFrame.size.width;
+            }
+        }
+    }
+}
+
+#pragma mark - 适配横屏安全区域,更新子视图布局
+- (void)layoutSubviews {
+    [super layoutSubviews];
+    if (_cancelBtn || _doneBtn) {
+        if (@available(iOS 11.0, *)) {
+            UIEdgeInsets safeInsets = self.safeAreaInsets;
+            if (_cancelBtn) {
+                CGRect cancelBtnFrame = self.pickerStyle.cancelBtnFrame;
+                if (cancelBtnFrame.origin.x < MIN(self.bounds.size.width / 2, self.bounds.size.height / 2)) {
+                    cancelBtnFrame.origin.x += safeInsets.left;
+                } else {
+                    cancelBtnFrame.origin.x = self.bounds.size.width - cancelBtnFrame.size.width - safeInsets.right - self.cancelBtnMargin;
+                }
+                self.cancelBtn.frame = cancelBtnFrame;
+            }
+            if (_doneBtn) {
+                CGRect doneBtnFrame = self.pickerStyle.doneBtnFrame;
+                if (doneBtnFrame.origin.x < MIN(self.bounds.size.width / 2, self.bounds.size.height / 2)) {
+                    doneBtnFrame.origin.x += safeInsets.left;
+                } else {
+                    doneBtnFrame.origin.x = self.bounds.size.width - doneBtnFrame.size.width - safeInsets.right - self.doneBtnMargin;
+                }
+                self.doneBtn.frame = doneBtnFrame;
+            }
+        }
+    }
+    
+    if (_alertView && self.pickerStyle.topCornerRadius > 0) {
+        // 设置顶部圆角
+        [BRPickerStyle br_setView:_alertView roundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight withRadius:self.pickerStyle.topCornerRadius];
+    }
+}
+
+#pragma mark - 蒙层视图
+- (UIView *)maskBgView {
+    if (!_maskBgView) {
+        _maskBgView = [[UIView alloc]initWithFrame:self.keyView.bounds];
+        _maskBgView.backgroundColor = self.pickerStyle.maskColor;
+        // 设置子视图的大小随着父视图变化
+        _maskBgView.autoresizingMask = UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
+        _maskBgView.userInteractionEnabled = YES;
+        UITapGestureRecognizer *myTap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(didTapMaskBgView:)];
+        [_maskBgView addGestureRecognizer:myTap];
+    }
+    return _maskBgView;
+}
+
+#pragma mark - 弹框视图
+- (UIView *)alertView {
+    if (!_alertView) {
+        CGFloat accessoryViewHeight = 0;
+        if (self.pickerHeaderView) {
+            accessoryViewHeight += self.pickerHeaderView.bounds.size.height;
+        }
+        if (self.pickerFooterView) {
+            accessoryViewHeight += self.pickerFooterView.bounds.size.height;
+        }
+        CGFloat height = self.pickerStyle.titleBarHeight + self.pickerStyle.pickerHeight + self.pickerStyle.paddingBottom + accessoryViewHeight;
+        _alertView = [[UIView alloc]initWithFrame:CGRectMake(0, self.keyView.bounds.size.height - height, self.keyView.bounds.size.width, height)];
+        _alertView.backgroundColor = self.pickerStyle.alertViewColor ? self.pickerStyle.alertViewColor : self.pickerStyle.pickerColor;
+        if (!self.pickerStyle.topCornerRadius && !self.pickerStyle.hiddenShadowLine) {
+            // 设置弹框视图顶部边框线
+            UIView *shadowLineView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, _alertView.frame.size.width, self.pickerStyle.shadowLineHeight)];
+            shadowLineView.backgroundColor = self.pickerStyle.shadowLineColor;
+            shadowLineView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
+            [_alertView addSubview:shadowLineView];
+        }
+        _alertView.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth;
+    }
+    return _alertView;
+}
+
+#pragma mark - 标题栏视图
+- (UIView *)titleBarView {
+    if (!_titleBarView) {
+        _titleBarView =[[UIView alloc]initWithFrame:CGRectMake(0, 0, self.keyView.bounds.size.width, self.pickerStyle.titleBarHeight)];
+        _titleBarView.backgroundColor = self.pickerStyle.titleBarColor;
+        _titleBarView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
+        if (!self.pickerStyle.hiddenTitleLine) {
+            // 设置标题栏底部分割线
+            UIView *titleLineView = [[UIView alloc]initWithFrame:CGRectMake(0, _titleBarView.frame.size.height - 0.5f, _titleBarView.frame.size.width, 0.5f)];
+            titleLineView.backgroundColor = self.pickerStyle.titleLineColor;
+            titleLineView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
+            [_titleBarView addSubview:titleLineView];
+        }
+    }
+    return _titleBarView;
+}
+
+#pragma mark - 取消按钮
+- (UIButton *)cancelBtn {
+    if (!_cancelBtn) {
+        _cancelBtn = [UIButton buttonWithType:UIButtonTypeCustom];
+        _cancelBtn.frame = self.pickerStyle.cancelBtnFrame;
+        _cancelBtn.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleLeftMargin;
+        _cancelBtn.backgroundColor = self.pickerStyle.cancelColor;;
+        _cancelBtn.titleLabel.font = self.pickerStyle.cancelTextFont;
+        [_cancelBtn setTitleColor:self.pickerStyle.cancelTextColor forState:UIControlStateNormal];
+        if (self.pickerStyle.cancelBtnImage) {
+            [_cancelBtn setImage:self.pickerStyle.cancelBtnImage forState:UIControlStateNormal];
+        }
+        if (self.pickerStyle.cancelBtnTitle) {
+            [_cancelBtn setTitle:self.pickerStyle.cancelBtnTitle forState:UIControlStateNormal];
+        }
+        [_cancelBtn addTarget:self action:@selector(clickCancelBtn) forControlEvents:UIControlEventTouchUpInside];
+        // 设置按钮圆角或边框
+        if (self.pickerStyle.cancelBorderStyle == BRBorderStyleSolid) {
+            _cancelBtn.layer.cornerRadius = self.pickerStyle.cancelCornerRadius > 0 ? self.pickerStyle.cancelCornerRadius : 6.0f;
+            _cancelBtn.layer.borderColor = self.pickerStyle.cancelTextColor.CGColor;
+            _cancelBtn.layer.borderWidth = self.pickerStyle.cancelBorderWidth > 0 ? self.pickerStyle.cancelBorderWidth : 1.0f;
+            _cancelBtn.layer.masksToBounds = YES;
+        } else if (self.pickerStyle.cancelBorderStyle == BRBorderStyleFill) {
+            _cancelBtn.layer.cornerRadius = self.pickerStyle.cancelCornerRadius > 0 ? self.pickerStyle.cancelCornerRadius : 6.0f;
+            _cancelBtn.layer.masksToBounds = YES;
+        }
+    }
+    return _cancelBtn;
+}
+
+#pragma mark - 确定按钮
+- (UIButton *)doneBtn {
+    if (!_doneBtn) {
+        _doneBtn = [UIButton buttonWithType:UIButtonTypeCustom];
+        _doneBtn.frame = self.pickerStyle.doneBtnFrame;
+        _doneBtn.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleLeftMargin;
+        _doneBtn.backgroundColor = self.pickerStyle.doneColor;
+        if (self.pickerStyle.doneBtnImage) {
+            [_doneBtn setImage:self.pickerStyle.doneBtnImage forState:UIControlStateNormal];
+        }
+        if (self.pickerStyle.doneBtnTitle) {
+            _doneBtn.titleLabel.font = self.pickerStyle.doneTextFont;
+            [_doneBtn setTitleColor:self.pickerStyle.doneTextColor forState:UIControlStateNormal];
+            [_doneBtn setTitle:self.pickerStyle.doneBtnTitle forState:UIControlStateNormal];
+        }
+        [_doneBtn addTarget:self action:@selector(clickDoneBtn) forControlEvents:UIControlEventTouchUpInside];
+        // 设置按钮圆角或边框
+        if (self.pickerStyle.doneBorderStyle == BRBorderStyleSolid) {
+            _doneBtn.layer.cornerRadius = self.pickerStyle.doneCornerRadius > 0 ? self.pickerStyle.doneCornerRadius : 6.0f;
+            _doneBtn.layer.borderColor = self.pickerStyle.doneTextColor.CGColor;
+            _doneBtn.layer.borderWidth = self.pickerStyle.doneBorderWidth > 0 ? self.pickerStyle.doneBorderWidth : 1.0f;
+            _doneBtn.layer.masksToBounds = YES;
+        } else if (self.pickerStyle.doneBorderStyle == BRBorderStyleFill) {
+            _doneBtn.layer.cornerRadius = self.pickerStyle.doneCornerRadius > 0 ? self.pickerStyle.doneCornerRadius : 6.0f;
+            _doneBtn.layer.masksToBounds = YES;
+        }
+    }
+    return _doneBtn;
+}
+
+#pragma mark - 中间标题label
+- (UILabel *)titleLabel {
+    if (!_titleLabel) {
+        _titleLabel = [[UILabel alloc]initWithFrame:self.pickerStyle.titleLabelFrame];
+        _titleLabel.backgroundColor = self.pickerStyle.titleLabelColor;
+        _titleLabel.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleLeftMargin;
+        _titleLabel.textAlignment = NSTextAlignmentCenter;
+        _titleLabel.font = self.pickerStyle.titleTextFont;
+        _titleLabel.textColor = self.pickerStyle.titleTextColor;
+        _titleLabel.text = self.title;
+    }
+    return _titleLabel;
+}
+
+#pragma mark - 点击蒙层视图事件
+- (void)didTapMaskBgView:(UITapGestureRecognizer *)sender {
+    [self removePickerFromView:nil];
+    if (self.cancelBlock) {
+        self.cancelBlock();
+    }
+}
+
+#pragma mark - 取消按钮的点击事件
+- (void)clickCancelBtn {
+    if (self.cancelBlock) {
+        self.cancelBlock();
+    }
+    [self removePickerFromView:nil];
+}
+
+#pragma mark - 确定按钮的点击事件
+- (void)clickDoneBtn {
+    if (self.doneBlock) {
+        self.doneBlock();
+    }
+    [self removePickerFromView:nil];
+}
+
+#pragma mark - 添加视图方法
+- (void)addPickerToView:(UIView *)view {
+    if (view) {
+        self.frame = view.bounds;
+        self.autoresizingMask = UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
+        
+        CGFloat accessoryViewHeight = 0;
+        if (self.pickerHeaderView) {
+            CGRect rect = self.pickerHeaderView.frame;
+            self.pickerHeaderView.frame = CGRectMake(0, 0, view.bounds.size.width, rect.size.height);
+            self.pickerHeaderView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
+            [self addSubview:self.pickerHeaderView];
+            
+            accessoryViewHeight += self.pickerHeaderView.bounds.size.height;
+        }
+        if (self.pickerFooterView) {
+            CGRect rect = self.pickerFooterView.frame;
+            self.pickerFooterView.frame = CGRectMake(0, view.bounds.size.height - rect.size.height, view.bounds.size.width, rect.size.height);
+            self.pickerFooterView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
+            [self addSubview:self.pickerFooterView];
+            
+            accessoryViewHeight += self.pickerFooterView.bounds.size.height;
+        }
+        
+        [view addSubview:self];
+    } else {
+        [self initUI];
+        
+        if (self.pickerHeaderView) {
+            CGRect rect = self.pickerHeaderView.frame;
+            CGFloat titleBarHeight = self.pickerStyle.hiddenTitleBarView ? 0 : self.pickerStyle.titleBarHeight;
+            self.pickerHeaderView.frame = CGRectMake(0, titleBarHeight, self.alertView.bounds.size.width, rect.size.height);
+            self.pickerHeaderView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
+            [self.alertView addSubview:self.pickerHeaderView];
+        }
+        if (self.pickerFooterView) {
+            CGRect rect = self.pickerFooterView.frame;
+            self.pickerFooterView.frame = CGRectMake(0, self.alertView.bounds.size.height - self.pickerStyle.paddingBottom - rect.size.height, self.alertView.bounds.size.width, rect.size.height);
+            self.pickerFooterView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
+            [self.alertView addSubview:self.pickerFooterView];
+        }
+    
+        [self.keyView addSubview:self];
+        
+        // iOS16:重新设置 alertView 高度(解决懒加载设置frame不生效问题)
+        CGFloat accessoryViewHeight = 0;
+        if (self.pickerHeaderView) {
+            accessoryViewHeight += self.pickerHeaderView.bounds.size.height;
+        }
+        if (self.pickerFooterView) {
+            accessoryViewHeight += self.pickerFooterView.bounds.size.height;
+        }
+        CGFloat height = self.pickerStyle.titleBarHeight + self.pickerStyle.pickerHeight + self.pickerStyle.paddingBottom + accessoryViewHeight;
+        self.alertView.frame = CGRectMake(0, self.keyView.bounds.size.height - height, self.keyView.bounds.size.width, height);
+        
+        // 动画前初始位置
+        CGRect rect = self.alertView.frame;
+        rect.origin.y = self.bounds.size.height;
+        self.alertView.frame = rect;
+        // 弹出动画
+        if (!self.pickerStyle.hiddenMaskView) {
+            self.maskBgView.alpha = 0;
+        }
+        [UIView animateWithDuration:0.3f animations:^{
+            if (!self.pickerStyle.hiddenMaskView) {
+                self.maskBgView.alpha = 1;
+            }
+            CGFloat alertViewHeight = self.alertView.bounds.size.height;
+            CGRect rect = self.alertView.frame;
+            rect.origin.y -= alertViewHeight;
+            self.alertView.frame = rect;
+        }];
+    }
+}
+
+#pragma mark - 移除视图方法
+- (void)removePickerFromView:(UIView *)view {
+    if (view) {
+        [self removeFromSuperview];
+    } else {
+        // 关闭动画
+        [UIView animateWithDuration:0.2f animations:^{
+            CGFloat alertViewHeight = self.alertView.bounds.size.height;
+            CGRect rect = self.alertView.frame;
+            rect.origin.y += alertViewHeight;
+            self.alertView.frame = rect;
+            if (!self.pickerStyle.hiddenMaskView) {
+                self.maskBgView.alpha = 0;
+            }
+        } completion:^(BOOL finished) {
+            [self removeFromSuperview];
+        }];
+    }
+}
+
+#pragma mark - 刷新选择器数据
+- (void)reloadData {
+    
+}
+
+#pragma mark - 添加自定义视图到选择器(picker)上
+- (void)addSubViewToPicker:(UIView *)customView {
+    
+}
+
+#pragma mark - 添加自定义视图到标题栏(titleBar)上
+- (void)addSubViewToTitleBar:(UIView *)customView {
+    if (!self.pickerStyle.hiddenTitleBarView) {
+        [self.titleBarView addSubview:customView];
+    }
+}
+
+- (BRPickerStyle *)pickerStyle {
+    if (!_pickerStyle) {
+        _pickerStyle = [[BRPickerStyle alloc]init];
+    }
+    return _pickerStyle;
+}
+
+- (UIView *)keyView {
+    if (!_keyView) {
+        _keyView = BRGetKeyWindow();
+    }
+    return _keyView;
+}
+
+#pragma mark - setter 方法(支持动态设置标题)
+- (void)setTitle:(NSString *)title {
+    _title = title;
+    if (_titleLabel) {
+        _titleLabel.text = title;
+    }
+}
+
+- (void)dealloc {
+    NSLog(@"%@ dealloc", NSStringFromClass([self class]));
+}
+
+@end

+ 261 - 0
Pods/BRPickerView/BRPickerView/Core/BRPickerStyle.h

@@ -0,0 +1,261 @@
+//
+//  BRPickerStyle.h
+//  BRPickerViewDemo
+//
+//  Created by renbo on 2019/10/2.
+//  Copyright © 2019 irenb. All rights reserved.
+//
+//  最新代码下载地址:https://github.com/agiapp/BRPickerView
+
+#import <Foundation/Foundation.h>
+#import <UIKit/UIKit.h>
+#import "BRPickerViewMacro.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+// 边框样式(左边取消按钮/右边确定按钮)
+typedef NS_ENUM(NSInteger, BRBorderStyle) {
+    /** 无边框(默认) */
+    BRBorderStyleNone = 0,
+    /** 有圆角和边框 */
+    BRBorderStyleSolid,
+    /** 仅有圆角 */
+    BRBorderStyleFill
+};
+
+@interface BRPickerStyle : NSObject
+
+
+/////////////////////////////// 蒙层视图(maskView)///////////////////////////////
+
+/** 设置背景颜色 */
+@property (nullable, nonatomic, strong) UIColor *maskColor;
+
+/** 隐藏 maskView,默认为 NO */
+@property (nonatomic, assign) BOOL hiddenMaskView;
+
+
+////////////////////////////// 弹框视图(alertView)///////////////////////////////
+
+/** 设置 alertView 弹框视图的背景颜色 */
+@property (nullable, nonatomic, strong) UIColor *alertViewColor;
+
+/** 设置 alertView 弹框视图左上和右上的圆角半径  */
+@property (nonatomic, assign) NSInteger topCornerRadius;
+
+/** 设置 alertView 弹框视图顶部边框线颜色  */
+@property (nullable, nonatomic, strong) UIColor *shadowLineColor;
+
+/** 设置 alertView 弹框视图顶部边框线高度  */
+@property (nonatomic, assign) CGFloat shadowLineHeight;
+
+/** 隐藏 alertView 弹框视图顶部边框线,默认为 NO */
+@property (nonatomic, assign) BOOL hiddenShadowLine;
+
+/** 设置 alertView 弹框视图底部内边距,默认为安全区域底部距屏幕底部的高度  */
+@property (nonatomic, assign) CGFloat paddingBottom;
+
+
+//////////////////////////// 标题栏视图(titleBarView) ////////////////////////////
+
+/** 设置 titleBarView 标题栏的背景颜色 */
+@property (nullable, nonatomic, strong) UIColor *titleBarColor;
+
+/** 设置 titleBarView 标题栏的高度 */
+@property (nonatomic, assign) CGFloat titleBarHeight;
+
+/** 设置 titleBarView 标题栏底部分割线颜色 */
+@property (nullable, nonatomic, strong) UIColor *titleLineColor;
+
+/** 隐藏 titleBarView 标题栏底部分割线,默认为 NO  */
+@property (nonatomic, assign) BOOL hiddenTitleLine;
+
+/** 隐藏 titleBarView,默认为 NO */
+@property (nonatomic, assign) BOOL hiddenTitleBarView;
+
+
+////////////////////////// 标题栏中间label(titleLabel)///////////////////////////
+
+/** 设置 titleLabel 的背景颜色 */
+@property (nullable, nonatomic, strong) UIColor *titleLabelColor;
+
+/** 设置 titleLabel 文本颜色 */
+@property (nullable, nonatomic, strong) UIColor *titleTextColor;
+
+/** 设置 titleLabel 字体大小 */
+@property (nullable, nonatomic, strong) UIFont *titleTextFont;
+
+/** 设置 titleLabel 的 frame */
+@property (nonatomic, assign) CGRect titleLabelFrame;
+
+/** 隐藏 titleLabel,默认为 NO */
+@property (nonatomic, assign) BOOL hiddenTitleLabel;
+
+
+/////////////////////////////// 取消按钮(cancelBtn)//////////////////////////////
+
+/** 设置 cancelBtn 的背景颜色 */
+@property (nullable, nonatomic, strong) UIColor *cancelColor;
+
+/** 设置 cancelBtn 标题的颜色 */
+@property (nullable, nonatomic, strong) UIColor *cancelTextColor;
+
+/** 设置 cancelBtn 标题的字体 */
+@property (nullable, nonatomic, strong) UIFont *cancelTextFont;
+
+/** 设置 cancelBtn 的 frame */
+@property (nonatomic, assign) CGRect cancelBtnFrame;
+
+/** 设置 cancelBtn 的边框样式 */
+@property (nonatomic, assign) BRBorderStyle cancelBorderStyle;
+
+/** 设置 cancelBtn 的圆角大小 */
+@property (nonatomic, assign) CGFloat cancelCornerRadius;
+
+/** 设置 cancelBtn 的边框宽度 */
+@property (nonatomic, assign) CGFloat cancelBorderWidth;
+
+/** 设置 cancelBtn 的 image */
+@property (nullable, nonatomic, strong) UIImage *cancelBtnImage;
+
+/** 设置 cancelBtn 的 title */
+@property (nullable, nonatomic, copy) NSString *cancelBtnTitle;
+
+/** 隐藏 cancelBtn,默认为 NO */
+@property (nonatomic, assign) BOOL hiddenCancelBtn;
+
+
+/////////////////////////////// 确定按钮(doneBtn)////////////////////////////////
+
+/** 设置 doneBtn 的背景颜色 */
+@property (nullable, nonatomic, strong) UIColor *doneColor;
+
+/** 设置 doneBtn 标题的颜色 */
+@property (nullable, nonatomic, strong) UIColor *doneTextColor;
+
+/** 设置 doneBtn 标题的字体 */
+@property (nullable, nonatomic, strong) UIFont *doneTextFont;
+
+/** 设置 doneBtn 的 frame */
+@property (nonatomic, assign) CGRect doneBtnFrame;
+
+/** 设置 doneBtn 的边框样式 */
+@property (nonatomic, assign) BRBorderStyle doneBorderStyle;
+
+/** 设置 doneBtn 的圆角大小 */
+@property (nonatomic, assign) CGFloat doneCornerRadius;
+
+/** 设置 doneBtn 的边框宽度 */
+@property (nonatomic, assign) CGFloat doneBorderWidth;
+
+/** 设置 doneBtn 的 image */
+@property (nullable, nonatomic, strong) UIImage *doneBtnImage;
+
+/** 设置 doneBtn 的 title */
+@property (nullable, nonatomic, copy) NSString *doneBtnTitle;
+
+/** 隐藏 doneBtn,默认为 NO */
+@property (nonatomic, assign) BOOL hiddenDoneBtn;
+
+
+/////////////////////////////// 选择器(pickerView)///////////////////////////////
+
+/** 设置 picker 的背景颜色 */
+@property (nullable, nonatomic, strong) UIColor *pickerColor;
+
+/** 设置 picker 中间两条分割线的背景颜色。暂不支持日期选择器前4种类型 */
+@property (nullable, nonatomic, strong) UIColor *separatorColor;
+
+/** 设置 picker 中间两条分割线的高度。暂不支持日期选择器前4种类型 */
+@property (nonatomic, assign) CGFloat separatorHeight;
+
+/** 设置 picker 文本的颜色。暂不支持日期选择器前4种类型 */
+@property (nullable, nonatomic, strong) UIColor *pickerTextColor;
+
+/** 设置 picker 文本的字体。暂不支持日期选择器前4种类型 */
+@property (nullable, nonatomic, strong) UIFont *pickerTextFont;
+
+/** 设置 picker 中间选中行的背景颜色。暂不支持日期选择器前4种类型 */
+@property (nullable, nonatomic, strong) UIColor *selectRowColor;
+
+/** 设置 picker 中间选中行文本的颜色。暂不支持日期选择器前4种类型 */
+@property (nullable, nonatomic, strong) UIColor *selectRowTextColor;
+
+/** 设置 picker 中间选中行文本的字体。暂不支持日期选择器前4种类型 */
+@property (nullable, nonatomic, strong) UIFont *selectRowTextFont;
+
+/** 设置 picker 的高度,系统默认高度为 216 */
+@property (nonatomic, assign) CGFloat pickerHeight;
+
+/** 设置 picker 的行高,默认为 35 */
+@property (nonatomic, assign) CGFloat rowHeight;
+/** 设置 picker 的列宽 */
+@property (nonatomic, assign) CGFloat columnWidth;
+/** 设置 picker 的列间隔,仅支持`BRTextPickerView` */
+@property (nonatomic, assign) CGFloat columnSpacing;
+
+/** 设置 picker 文本支持的最大行数,默认为 2 */
+@property (nonatomic, assign) NSUInteger maxTextLines;
+
+/**
+ *  清除iOS14之后选择器默认自带的新样式。暂不支持日期选择器前4种类型
+ *  主要是:①隐藏中间选择行的背景样式,②清除默认的内边距,③新增中间选择行的两条分割线;与iOS14之前的样式保持一致),默认为 YES
+ */
+@property (nonatomic, assign) BOOL clearPickerNewStyle;
+
+
+/**
+ *  设置语言(不设置或为nil时,将随系统的语言自动改变)
+ *  language: zh-Hans(简体中文)、zh-Hant(繁体中文)、en(英语 )
+ */
+@property(nullable, nonatomic, copy) NSString *language;
+
+
+/////// 日期选择器单位样式(showUnitType == BRShowUnitTypeOnlyCenter 时生效。暂不支持日期选择器前4种类型 )///////
+
+/** 设置日期选择器单位文本的颜色 */
+@property (nullable, nonatomic, strong) UIColor *dateUnitTextColor;
+
+/** 设置日期选择器单位文本的字体 */
+@property (nullable, nonatomic, strong) UIFont *dateUnitTextFont;
+
+/** 设置日期选择器单位 label 的水平方向偏移量 */
+@property (nonatomic, assign) CGFloat dateUnitOffsetX;
+
+/** 设置日期选择器单位 label 的竖直方向偏移量 */
+@property (nonatomic, assign) CGFloat dateUnitOffsetY;
+
+/** 设置日期选择器单位 label 的 centerX 差值(自定义调整各日期单位的水平偏移差值) */
+@property (nonatomic, copy) NSArray *dateUnitDeltaX;
+
+
+//////////////////////////////// 常用的几种模板样式 ////////////////////////////////
+
+/// 弹框模板样式1 - 取消/确定按钮圆角样式
+/// @param themeColor 主题颜色
++ (instancetype)pickerStyleWithThemeColor:(nullable UIColor *)themeColor;
+
+/// 弹框模板样式2 - 顶部圆角样式 + 完成按钮
+/// @param doneTextColor 完成按钮标题的颜色
++ (instancetype)pickerStyleWithDoneTextColor:(nullable UIColor *)doneTextColor;
+
+/// 弹框模板样式3 - 顶部圆角样式 + 图标按钮
+/// @param doneBtnImage 完成按钮的 image
++ (instancetype)pickerStyleWithDoneBtnImage:(nullable UIImage *)doneBtnImage;
+
+
+//////////////////////////////// 以下是组件内部使用的几个封装方法 ////////////////////////////////
+
+/** 设置选择器中间选中行的样式 */
+- (void)setupPickerSelectRowStyle:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component;
+
+/** 添加选择器中间行上下两条分割线(iOS14之后系统默认去掉,需要手动添加)*/
+- (void)addSeparatorLineView:(UIView *)pickerView;
+
+/** 设置 view 的部分圆角 */
+// corners(枚举类型,可组合使用):UIRectCornerTopLeft | UIRectCornerTopRight | UIRectCornerBottomLeft | UIRectCornerBottomRight | UIRectCornerAllCorners
++ (void)br_setView:(UIView *)view roundingCorners:(UIRectCorner)corners withRadius:(CGFloat)radius;
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 508 - 0
Pods/BRPickerView/BRPickerView/Core/BRPickerStyle.m

@@ -0,0 +1,508 @@
+//
+//  BRPickerStyle.m
+//  BRPickerViewDemo
+//
+//  Created by renbo on 2019/10/2.
+//  Copyright © 2019 irenb. All dones reserved.
+//
+//  最新代码下载地址:https://github.com/agiapp/BRPickerView
+
+#import "BRPickerStyle.h"
+#import "NSBundle+BRPickerView.h"
+
+// 标题颜色
+#define kBRDefaultTextColor BR_RGB_HEX(0x333333, 1.0f)
+
+@implementation BRPickerStyle
+
+- (instancetype)init {
+    if (self = [super init]) {
+        self.clearPickerNewStyle = YES;
+    }
+    return self;
+}
+
+/// 设置默认样式
+
+- (UIColor *)maskColor {
+    if (!_maskColor) {
+        _maskColor = [self br_colorWithLightColor:BR_RGB_HEX(0x000000, 0.3f) darkColor:BR_RGB_HEX(0x666666, 0.3f)];
+    }
+    return _maskColor;
+}
+
+- (UIColor *)shadowLineColor {
+    if (!_shadowLineColor) {
+        if (@available(iOS 13.0, *)) {
+            // 边框线颜色,有透明度
+            _shadowLineColor = [UIColor separatorColor];
+        } else {
+            _shadowLineColor = BR_RGB_HEX(0xc6c6c8, 1.0f);
+        }
+    }
+    return _shadowLineColor;
+}
+
+- (CGFloat)shadowLineHeight {
+    if (_shadowLineHeight <= 0 || _shadowLineHeight > 5.0f) {
+        _shadowLineHeight = 0.5f;
+    }
+    return _shadowLineHeight;
+}
+
+- (CGFloat)paddingBottom {
+    if (_paddingBottom <= 0) {
+        _paddingBottom = BR_BOTTOM_MARGIN;
+    }
+    return _paddingBottom;
+}
+
+- (UIColor *)titleBarColor {
+    if (!_titleBarColor) {
+        if (@available(iOS 13.0, *)) {
+            // #ffffff(正常)、#1c1c1e(深色)
+            _titleBarColor = [UIColor secondarySystemGroupedBackgroundColor];
+        } else {
+            _titleBarColor = [UIColor whiteColor];
+        }
+    }
+    return _titleBarColor;
+}
+
+- (CGFloat)titleBarHeight {
+    if (!self.hiddenTitleBarView) {
+        if (_titleBarHeight < 44.0f && (!self.hiddenCancelBtn || !self.hiddenDoneBtn || !self.hiddenTitleLabel)) {
+            _titleBarHeight = 44.0f;
+        }
+    } else {
+        _titleBarHeight = 0;
+    }
+    return _titleBarHeight;
+}
+
+- (UIColor *)titleLineColor {
+    if (!_titleLineColor) {
+        _titleLineColor = [self br_colorWithLightColor:BR_RGB_HEX(0xededee, 1.0f) darkColor:BR_RGB_HEX(0x18181c, 1.0f)];
+    }
+    return _titleLineColor;
+}
+
+- (UIColor *)cancelColor {
+    if (!_cancelColor) {
+        _cancelColor = [UIColor clearColor];
+    }
+    return _cancelColor;
+}
+
+- (UIColor *)cancelTextColor {
+    if (!_cancelTextColor) {
+        if (@available(iOS 13.0, *)) {
+            _cancelTextColor = [UIColor labelColor];
+        } else {
+            _cancelTextColor = kBRDefaultTextColor;
+        }
+    }
+    return _cancelTextColor;
+}
+
+- (UIFont *)cancelTextFont {
+    if (!_cancelTextFont) {
+        _cancelTextFont = [UIFont systemFontOfSize:16.0f];
+    }
+    return _cancelTextFont;
+}
+
+- (NSString *)cancelBtnTitle {
+    if (!_cancelBtnTitle && !_cancelBtnImage) {
+        _cancelBtnTitle = [NSBundle br_localizedStringForKey:@"取消" language:self.language];
+    }
+    return _cancelBtnTitle;
+}
+
+- (CGRect)cancelBtnFrame {
+    if (CGRectEqualToRect(_cancelBtnFrame, CGRectZero) || _cancelBtnFrame.size.height == 0) {
+        _cancelBtnFrame = CGRectMake(5, 8, 60, 28);
+    }
+    return _cancelBtnFrame;
+}
+
+- (UIColor *)titleLabelColor {
+    if (!_titleLabelColor) {
+        _titleLabelColor = [UIColor clearColor];
+    }
+    return _titleLabelColor;
+}
+
+- (UIColor *)titleTextColor {
+    if (!_titleTextColor) {
+        if (@available(iOS 13.0, *)) {
+            _titleTextColor = [UIColor secondaryLabelColor];
+        } else {
+            _titleTextColor = BR_RGB_HEX(0x999999, 1.0f);
+        }
+    }
+    return _titleTextColor;
+}
+
+- (UIFont *)titleTextFont {
+    if (!_titleTextFont) {
+        _titleTextFont = [UIFont systemFontOfSize:15.0f];
+    }
+    return _titleTextFont;
+}
+
+- (CGRect)titleLabelFrame {
+    if (CGRectEqualToRect(_titleLabelFrame, CGRectZero) || _titleLabelFrame.size.height == 0) {
+        _titleLabelFrame = CGRectMake(5 + 60 + 2, 0, BRGetKeyWindow().bounds.size.width - 2 * (5 + 60 + 2), 44);
+    }
+    return _titleLabelFrame;
+}
+
+- (UIColor *)doneColor {
+    if (!_doneColor) {
+        _doneColor = [UIColor clearColor];
+    }
+    return _doneColor;
+}
+
+- (UIColor *)doneTextColor {
+    if (!_doneTextColor) {
+        if (@available(iOS 13.0, *)) {
+            _doneTextColor = [UIColor labelColor];
+        } else {
+            _doneTextColor = kBRDefaultTextColor;
+        }
+    }
+    return _doneTextColor;
+}
+
+- (UIFont *)doneTextFont {
+    if (!_doneTextFont) {
+        _doneTextFont = [UIFont systemFontOfSize:16.0f];
+    }
+    return _doneTextFont;
+}
+
+- (NSString *)doneBtnTitle {
+    if (!_doneBtnTitle && !_doneBtnImage) {
+        _doneBtnTitle = [NSBundle br_localizedStringForKey:@"确定" language:self.language];
+    }
+    return _doneBtnTitle;
+}
+
+- (CGRect)doneBtnFrame {
+    if (CGRectEqualToRect(_doneBtnFrame, CGRectZero) || _doneBtnFrame.size.height == 0) {
+        _doneBtnFrame = CGRectMake(BRGetKeyWindow().bounds.size.width - 60 - 5, 8, 60, 28);
+    }
+    return _doneBtnFrame;
+}
+
+- (UIColor *)pickerColor {
+    if (!_pickerColor) {
+        if (@available(iOS 13.0, *)) {
+            // #ffffff(正常)、#1c1c1e(深色)
+            _pickerColor = [UIColor secondarySystemGroupedBackgroundColor];
+        } else {
+            _pickerColor = [UIColor whiteColor];
+        }
+    }
+    return _pickerColor;
+}
+
+- (UIColor *)separatorColor {
+    if (!_separatorColor) {
+        if (@available(iOS 13.0, *)) {
+            // 分割线颜色,无透明度
+            _separatorColor = [UIColor opaqueSeparatorColor];
+        } else {
+            _separatorColor = BR_RGB_HEX(0xc6c6c8, 1.0f);
+        }
+    }
+    return _separatorColor;
+}
+
+- (UIColor *)pickerTextColor {
+    if (!_pickerTextColor) {
+        if (@available(iOS 13.0, *)) {
+            _pickerTextColor = [UIColor labelColor];
+        } else {
+            _pickerTextColor = kBRDefaultTextColor;
+        }
+    }
+    return _pickerTextColor;
+}
+
+- (UIFont *)pickerTextFont {
+    if (!_pickerTextFont) {
+        _pickerTextFont = [UIFont systemFontOfSize:18.0f];
+    }
+    return _pickerTextFont;
+}
+
+- (CGFloat)pickerHeight {
+    if (_pickerHeight < 40) {
+        _pickerHeight = 216.0f;
+    }
+    return _pickerHeight;
+}
+
+- (CGFloat)rowHeight {
+    if (_rowHeight < 20) {
+        _rowHeight = 35.0f;
+    }
+    return _rowHeight;
+}
+
+- (NSUInteger)maxTextLines {
+    if (_maxTextLines < 1) {
+        _maxTextLines = 2;
+    }
+    return _maxTextLines;
+}
+
+- (NSString *)language {
+    if (!_language) {
+        // 跟随系统的首选语言自动改变
+        // zh-Hans-CN(简体中文)、zh-Hant-CN(繁体中文)、en-CN(美式英语)、en-GB(英式英语)
+        // 其中`CN`是iOS9以后新增的地区代码,如:CN 代表中国,US 代表美国
+        _language = [NSLocale preferredLanguages].firstObject;
+    }
+    return _language;
+}
+
+- (UIColor *)dateUnitTextColor {
+    if (!_dateUnitTextColor) {
+        if (@available(iOS 13.0, *)) {
+            _dateUnitTextColor = [UIColor labelColor];
+        } else {
+            _dateUnitTextColor = kBRDefaultTextColor;
+        }
+    }
+    return _dateUnitTextColor;
+}
+
+- (UIFont *)dateUnitTextFont {
+    if (!_dateUnitTextFont) {
+        _dateUnitTextFont = [UIFont systemFontOfSize:18.0f];
+    }
+    return _dateUnitTextFont;
+}
+
+- (NSArray *)dateUnitDeltaX {
+    if (!_dateUnitDeltaX) {
+        _dateUnitDeltaX = [[NSArray alloc]init];
+    }
+    return _dateUnitDeltaX;
+}
+
+#pragma mark - 创建自定义动态颜色(适配深色模式)
+- (UIColor *)br_colorWithLightColor:(UIColor *)lightColor darkColor:(UIColor *)darkColor {
+    if (@available(iOS 13.0, *)) {
+        UIColor *dyColor = [UIColor colorWithDynamicProvider:^UIColor * _Nonnull(UITraitCollection * _Nonnull traitCollection) {
+            if ([traitCollection userInterfaceStyle] == UIUserInterfaceStyleLight) {
+                return lightColor;
+            } else {
+                return darkColor;
+            }
+        }];
+        return dyColor;
+    } else {
+        return lightColor;
+    }
+}
+
+#pragma mark - 弹框模板样式1 - 取消/确定按钮圆角样式
++ (instancetype)pickerStyleWithThemeColor:(UIColor *)themeColor {
+    BRPickerStyle *customStyle = [[self alloc]init];
+    if (themeColor) {
+        customStyle.cancelTextColor = themeColor;
+        customStyle.cancelBorderStyle = BRBorderStyleSolid;
+        customStyle.doneColor = themeColor;
+        customStyle.doneTextColor = [UIColor whiteColor];
+        customStyle.doneBorderStyle = BRBorderStyleFill;
+    }
+    return customStyle;
+}
+
+#pragma mark - 弹框模板样式2 - 顶部圆角样式 + 完成按钮
++ (instancetype)pickerStyleWithDoneTextColor:(UIColor *)doneTextColor {
+    BRPickerStyle *customStyle = [[self alloc]init];
+    if (doneTextColor) {
+        customStyle.topCornerRadius = 16.0f;
+        customStyle.hiddenCancelBtn = YES;
+        customStyle.hiddenTitleLine = YES;
+        customStyle.titleLabelFrame = CGRectMake(20, 4, 100, 40);
+        customStyle.doneTextColor = doneTextColor;
+        customStyle.doneTextFont = [UIFont boldSystemFontOfSize:18.0f];
+        customStyle.doneBtnFrame = CGRectMake(BRGetKeyWindow().bounds.size.width - 60, 4, 60, 40);
+        customStyle.doneBtnTitle = [NSBundle br_localizedStringForKey:@"完成" language:customStyle.language];
+        customStyle.selectRowTextColor = doneTextColor;
+        customStyle.selectRowTextFont = [UIFont boldSystemFontOfSize:20.0f];
+    }
+    return customStyle;
+}
+
+#pragma mark - 弹框模板样式3 - 顶部圆角样式 + 图标按钮
++ (instancetype)pickerStyleWithDoneBtnImage:(UIImage *)doneBtnImage {
+    BRPickerStyle *customStyle = [[self alloc]init];
+    if (doneBtnImage) {
+        customStyle.topCornerRadius = 16.0f;
+        customStyle.hiddenTitleLine = YES;
+        customStyle.hiddenCancelBtn = YES;
+        customStyle.titleLabelFrame = CGRectMake(20, 4, 100, 40);
+        customStyle.doneBtnImage = doneBtnImage;
+        customStyle.doneBtnFrame = CGRectMake(BRGetKeyWindow().bounds.size.width - 44, 4, 40, 40);
+    }
+    return customStyle;
+}
+
+
+#pragma mark - 设置选择器中间选中行的样式
+- (void)setupPickerSelectRowStyle:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component {
+    // 1.设置分割线的颜色
+    NSString *systemVersion = [UIDevice currentDevice].systemVersion;
+    if (systemVersion.doubleValue < 14.0) {
+        for (UIView *subView in pickerView.subviews) {
+            if (subView && [subView isKindOfClass:[UIView class]] && subView.frame.size.height <= 1) {
+                subView.backgroundColor = self.separatorColor;
+                // 设置分割线高度
+                if (self.separatorHeight > 0) {
+                    CGRect rect = subView.frame;
+                    rect.size.height = self.separatorHeight;
+                    subView.frame = rect;
+                }
+            }
+        }
+    }
+    
+    // 2.设置选择器中间选中行的背景颜色
+    UIView *contentView = nil;
+    NSArray *subviews = pickerView.subviews;
+    if (subviews.count > 0) {
+        id firstView = subviews.firstObject;
+        if (firstView && [firstView isKindOfClass:[UIView class]]) {
+            contentView = (UIView *)firstView;
+        }
+    }
+    if (self.selectRowColor) {
+        UIView *columnView = nil;
+        if (contentView) {
+            id obj = [contentView valueForKey:@"subviewCache"];
+            if (obj && [obj isKindOfClass:[NSArray class]]) {
+                NSArray *columnViews = (NSArray *)obj;
+                if (columnViews.count > 0) {
+                    id columnObj = columnViews.firstObject;
+                    if (columnObj && [columnObj isKindOfClass:[UIView class]]) {
+                        columnView = (UIView *)columnObj;
+                    }
+                }
+            }
+        }
+        if (columnView) {
+            id obj = [columnView valueForKey:@"middleContainerView"];
+            if (obj && [obj isKindOfClass:[UIView class]]) {
+                UIView *selectRowView = (UIView *)obj;
+                // 中间选中行的背景颜色
+                selectRowView.backgroundColor = self.selectRowColor;
+            }
+        }
+    }
+    
+    if (contentView && self.clearPickerNewStyle) {
+        if (systemVersion.doubleValue >= 14.0) {
+            // ①隐藏中间选择行的背景样式
+            id lastView = subviews.lastObject;
+            if (lastView && [lastView isKindOfClass:[UIView class]]) {
+                UIView *rectBgView = (UIView *)lastView;
+                rectBgView.hidden = YES;
+            }
+            
+            // ②清除iOS14上选择器默认的内边距
+            if (systemVersion.doubleValue < 15.0f) {
+                [self setPickerAllSubViewsStyle:contentView];
+            }
+        }
+    }
+    
+    // 3.设置选择器中间选中行的字体颜色/字体大小
+    if (self.selectRowTextColor || self.selectRowTextFont) {
+        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+            // 当前选中的 label
+            UILabel *selectLabel = (UILabel *)[pickerView viewForRow:row forComponent:component];
+            if (selectLabel) {
+                if (self.selectRowTextColor) {
+                    selectLabel.textColor = self.selectRowTextColor;
+                }
+                if (self.selectRowTextFont) {
+                    selectLabel.font = self.selectRowTextFont;
+                }
+            }
+        });
+    }
+}
+
+// 遍历子视图,重新设置 frame(清空在 iOS14 上 UIPickerView 出现的内边距)
+- (void)setPickerAllSubViewsStyle:(UIView *)view {
+    NSArray *subViews = view.subviews;
+    if (subViews.count == 0 || [view isKindOfClass:[UILabel class]]) return;
+    for (UIView *subView in subViews) {
+        NSString *className = NSStringFromClass([subView class]);
+        if ([className isEqualToString:@"UIPickerColumnView"]) {
+            CGRect rect = subView.frame;
+            rect.origin.x = 0;
+            rect.size.width = view.bounds.size.width;
+            subView.frame = rect;
+        }
+        NSString *superClassName = NSStringFromClass([view class]);
+        if ([superClassName isEqualToString:@"UIPickerColumnView"]) {
+            CGRect rect = subView.frame;
+            rect.size.width = view.bounds.size.width;
+            subView.frame = rect;
+        }
+        if ([subView isKindOfClass:[UILabel class]]) {
+            CGRect rect = subView.frame;
+            rect.origin.x = 10;
+            subView.frame = rect;
+        }
+        
+        [self setPickerAllSubViewsStyle:subView];
+    }
+}
+
+#pragma mark - 添加选择器中间行上下两条分割线(iOS14之后系统默认去掉,需要手动添加)
+- (void)addSeparatorLineView:(UIView *)pickerView {
+    if ([UIDevice currentDevice].systemVersion.doubleValue >= 14.0) {
+        UIView *topLineView = [[UIView alloc]initWithFrame:CGRectMake(0, pickerView.bounds.size.height / 2 - self.rowHeight / 2, pickerView.bounds.size.width, 0.5f)];
+        topLineView.autoresizingMask = UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth;
+        topLineView.backgroundColor = self.separatorColor;
+        // 设置分割线高度
+        if (self.separatorHeight > 0) {
+            CGRect topRect = topLineView.frame;
+            topRect.size.height = self.separatorHeight;
+            topLineView.frame = topRect;
+        }
+        [pickerView addSubview:topLineView];
+        
+        UIView *bottomLineView = [[UIView alloc]initWithFrame:CGRectMake(0, pickerView.bounds.size.height / 2 + self.rowHeight / 2, pickerView.bounds.size.width, 0.5f)];
+        bottomLineView.autoresizingMask = UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth;
+        bottomLineView.backgroundColor = self.separatorColor;
+        // 设置分割线高度
+        if (self.separatorHeight > 0) {
+            CGRect bottomRect = bottomLineView.frame;
+            bottomRect.size.height = self.separatorHeight;
+            bottomLineView.frame = bottomRect;
+        }
+        [pickerView addSubview:bottomLineView];
+    }
+}
+
+#pragma mark - 设置 view 的部分圆角
+// corners(枚举类型,可组合使用):UIRectCornerTopLeft | UIRectCornerTopRight | UIRectCornerBottomLeft | UIRectCornerBottomRight | UIRectCornerAllCorners
++ (void)br_setView:(UIView *)view roundingCorners:(UIRectCorner)corners withRadius:(CGFloat)radius {
+    UIBezierPath *rounded = [UIBezierPath bezierPathWithRoundedRect:view.bounds byRoundingCorners:corners cornerRadii:CGSizeMake(radius, radius)];
+    CAShapeLayer *shape = [[CAShapeLayer alloc]init];
+    [shape setPath:rounded.CGPath];
+    view.layer.mask = shape;
+}
+
+@end

+ 35 - 0
Pods/BRPickerView/BRPickerView/Core/BRPickerView.bundle/en.lproj/Localizable.strings

@@ -0,0 +1,35 @@
+/* 
+  Localizable.strings
+  BRPickerViewDemo
+
+  Created by renbo on 2019/10/30.
+  Copyright © 2019 irenb. All rights reserved.
+*/
+
+"确定" = "OK";
+"取消" = "Cancel";
+"完成" = "Done";
+
+"年" = " ";
+"月" = " ";
+"日" = " ";
+"时" = " ";
+"分" = " ";
+"秒" = " ";
+
+"周" = " ";
+"季度" = " ";
+
+"上午" = "AM";
+"下午" = "PM";
+
+"至今" = " Now";
+"今天" = " Today";
+
+"周一" = " Mon";
+"周二" = " Tue";
+"周三" = " Wed";
+"周四" = " Thu";
+"周五" = " Fri";
+"周六" = " Sat";
+"周日" = " Sun";

+ 35 - 0
Pods/BRPickerView/BRPickerView/Core/BRPickerView.bundle/zh-Hans.lproj/Localizable.strings

@@ -0,0 +1,35 @@
+/* 
+  Localizable.strings
+  BRPickerViewDemo
+
+  Created by renbo on 2019/10/30.
+  Copyright © 2019 irenb. All rights reserved.
+*/
+
+"确定" = "确定";
+"取消" = "取消";
+"完成" = "完成";
+
+"年" = "年";
+"月" = "月";
+"日" = "日";
+"时" = "时";
+"分" = "分";
+"秒" = "秒";
+
+"周" = "周";
+"季度" = "季度";
+
+"上午" = "上午";
+"下午" = "下午";
+
+"至今" = "至今";
+"今天" = "今天";
+
+"周一" = "周一";
+"周二" = "周二";
+"周三" = "周三";
+"周四" = "周四";
+"周五" = "周五";
+"周六" = "周六";
+"周日" = "周日";

+ 35 - 0
Pods/BRPickerView/BRPickerView/Core/BRPickerView.bundle/zh-Hant.lproj/Localizable.strings

@@ -0,0 +1,35 @@
+/* 
+  Localizable.strings
+  BRPickerViewDemo
+
+  Created by renbo on 2019/10/30.
+  Copyright © 2019 irenb. All rights reserved.
+*/
+
+"确定" = "確定";
+"取消" = "取消";
+"完成" = "完成";
+
+"年" = "年";
+"月" = "月";
+"日" = "日";
+"时" = "時";
+"分" = "分";
+"秒" = "秒";
+
+"周" = "周";
+"季度" = "季度";
+
+"上午" = "上午";
+"下午" = "下午";
+
+"至今" = "至今";
+"今天" = "今天";
+
+"周一" = "周壹";
+"周二" = "周二";
+"周三" = "周三";
+"周四" = "周四";
+"周五" = "周五";
+"周六" = "周六";
+"周日" = "周日";

+ 87 - 0
Pods/BRPickerView/BRPickerView/Core/BRPickerViewMacro.h

@@ -0,0 +1,87 @@
+//
+//  BRPickerViewMacro.h
+//  BRPickerViewDemo
+//
+//  Created by renbo on 2018/4/23.
+//  Copyright © 2018 irenb. All rights reserved.
+//
+//  最新代码下载地址:https://github.com/agiapp/BRPickerView
+
+#ifndef BRPickerViewMacro_h
+#define BRPickerViewMacro_h
+
+#import <UIKit/UIKit.h>
+;
+// 屏幕安全区域下边距
+#define BR_BOTTOM_MARGIN \
+({CGFloat safeBottomHeight = 0;\
+if (@available(iOS 11.0, *)) {\
+safeBottomHeight = BRGetKeyWindow().safeAreaInsets.bottom;\
+}\
+(safeBottomHeight);})
+
+
+// 静态库中编写 Category 时的便利宏,用于解决 Category 方法从静态库中加载需要特别设置的问题
+#ifndef BRSYNTH_DUMMY_CLASS
+
+#define BRSYNTH_DUMMY_CLASS(_name_) \
+@interface BRSYNTH_DUMMY_CLASS_ ## _name_ : NSObject @end \
+@implementation BRSYNTH_DUMMY_CLASS_ ## _name_ @end
+
+#endif
+
+
+// 打印错误日志
+#ifdef DEBUG
+    #define BRErrorLog(...) NSLog(@"【BRPickerView】error log. reason: %@", [NSString stringWithFormat:__VA_ARGS__])
+#else
+    #define BRErrorLog(...)
+#endif
+
+
+/** RGB颜色(16进制) */
+static inline UIColor *BR_RGB_HEX(uint32_t rgbValue, CGFloat alpha) {
+    return [UIColor colorWithRed:((CGFloat)((rgbValue & 0xFF0000) >> 16)) / 255.0
+                           green:((CGFloat)((rgbValue & 0xFF00) >> 8)) / 255.0
+                            blue:((CGFloat)(rgbValue & 0xFF)) / 255.0
+                           alpha:(alpha)];
+}
+
+
+/** 获取 keyWindow */
+static inline UIWindow *BRGetKeyWindow(void) {
+    UIWindow *keyWindow = nil;
+#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 // 编译时检查SDK版本(兼容不同版本的Xcode,防止编译报错)
+    if (@available(iOS 13.0, *)) { // 运行时检查系统版本(兼容不同版本的系统,防止运行报错)
+        NSSet<UIScene *> *connectedScenes = [UIApplication sharedApplication].connectedScenes;
+        for (UIScene *scene in connectedScenes) {
+            if (scene.activationState == UISceneActivationStateForegroundActive && [scene isKindOfClass:[UIWindowScene class]]) {
+                UIWindowScene *windowScene = (UIWindowScene *)scene;
+                for (UIWindow *window in windowScene.windows) {
+                    if (window.isKeyWindow) {
+                        keyWindow = window;
+                        break;
+                    }
+                }
+            }
+        }
+    }
+#endif
+        
+    if (!keyWindow) {
+        keyWindow = [UIApplication sharedApplication].windows.firstObject;
+        if (!keyWindow.isKeyWindow) {
+#if __IPHONE_OS_VERSION_MIN_REQUIRED < 130000
+            UIWindow *window = [UIApplication sharedApplication].keyWindow;
+            if (CGRectEqualToRect(window.bounds, UIScreen.mainScreen.bounds)) {
+                keyWindow = window;
+            }
+#endif
+        }
+    }
+    
+    return keyWindow;
+}
+
+
+#endif /* BRPickerViewMacro_h */

+ 26 - 0
Pods/BRPickerView/BRPickerView/Core/NSBundle+BRPickerView.h

@@ -0,0 +1,26 @@
+//
+//  NSBundle+BRPickerView.h
+//  BRPickerViewDemo
+//
+//  Created by renbo on 2019/10/30.
+//  Copyright © 2019 irenb. All rights reserved.
+//
+//  最新代码下载地址:https://github.com/agiapp/BRPickerView
+
+#import <Foundation/Foundation.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface NSBundle (BRPickerView)
+
+/// 获取 BRPickerView.bundle
++ (instancetype)br_pickerBundle;
+
+/// 获取国际化后的文本
+/// @param key 代表 Localizable.strings 文件中 key-value 中的 key。
+/// @param language 设置语言(可为空,为nil时将随系统的语言自动改变)
++ (NSString *)br_localizedStringForKey:(NSString *)key language:(NSString *)language;
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 63 - 0
Pods/BRPickerView/BRPickerView/Core/NSBundle+BRPickerView.m

@@ -0,0 +1,63 @@
+//
+//  NSBundle+BRPickerView.m
+//  BRPickerViewDemo
+//
+//  Created by renbo on 2019/10/30.
+//  Copyright © 2019 irenb. All rights reserved.
+//
+//  最新代码下载地址:https://github.com/agiapp/BRPickerView
+
+#import "NSBundle+BRPickerView.h"
+#import "BRPickerAlertView.h"
+
+BRSYNTH_DUMMY_CLASS(NSBundle_BRPickerView)
+
+@implementation NSBundle (BRPickerView)
+
+#pragma mark - 获取 BRPickerView.bundle
++ (instancetype)br_pickerBundle {
+    static NSBundle *pickerBundle = nil;
+    if (!pickerBundle) {
+        // 获取 BRPickerView.bundle
+        NSBundle *bundle = [NSBundle bundleForClass:[BRPickerAlertView class]];
+        NSString *bundlePath = [bundle pathForResource:@"BRPickerView" ofType:@"bundle"];
+        pickerBundle = [NSBundle bundleWithPath:bundlePath];
+    }
+    return pickerBundle;
+}
+
+#pragma mark - 获取国际化后的文本
++ (NSString *)br_localizedStringForKey:(NSString *)key language:(NSString *)language {
+    return [self br_localizedStringForKey:key value:nil language:language];
+}
+
++ (NSString *)br_localizedStringForKey:(NSString *)key value:(NSString *)value language:(NSString *)language {
+    static NSBundle *bundle = nil;
+    if (!bundle) {
+        // 如果没有手动设置语言,将随系统的语言自动改变
+        if (!language) {
+            // 系统首选语言
+            language = [NSLocale preferredLanguages].firstObject;
+        }
+        
+        if ([language hasPrefix:@"en"]) {
+            language = @"en";
+        } else if ([language hasPrefix:@"zh"]) {
+            if ([language rangeOfString:@"Hans"].location != NSNotFound) {
+                language = @"zh-Hans"; // 简体中文
+            } else { // zh-Hant、zh-HK、zh-TW
+                language = @"zh-Hant"; // 繁體中文
+            }
+        } else {
+            language = @"en";
+        }
+        
+        // 从 BRPickerView.bundle 中查找资源
+        bundle = [NSBundle bundleWithPath:[[self br_pickerBundle] pathForResource:language ofType:@"lproj"]];
+    }
+    value = [bundle localizedStringForKey:key value:value table:nil];
+    
+    return [[NSBundle mainBundle] localizedStringForKey:key value:value table:nil];
+}
+
+@end

+ 111 - 0
Pods/BRPickerView/BRPickerView/DatePicker/BRDatePickerView+BR.h

@@ -0,0 +1,111 @@
+//
+//  BRDatePickerView+BR.h
+//  BRPickerViewDemo
+//
+//  Created by renbo on 2020/6/16.
+//  Copyright © 2020 irenb. All rights reserved.
+//
+//  最新代码下载地址:https://github.com/agiapp/BRPickerView
+
+#import "BRDatePickerView.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface BRDatePickerView (BR)
+
+/** 最小日期 */
+- (NSDate *)handlerMinDate:(nullable NSDate *)minDate;
+
+/** 最大日期 */
+- (NSDate *)handlerMaxDate:(nullable NSDate *)maxDate;
+
+/** 默认选中的日期 */
+- (NSDate *)handlerSelectDate:(nullable NSDate *)selectDate dateFormat:(NSString *)dateFormat;
+
+/** NSDate 转 NSString */
+- (NSString *)br_stringFromDate:(NSDate *)date dateFormat:(NSString *)dateFormat;
+
+/** NSString 转 NSDate */
+- (NSDate *)br_dateFromString:(NSString *)dateString dateFormat:(NSString *)dateFormat;
+
+/** 比较两个日期大小(可以指定比较级数,即按指定格式进行比较) */
+- (NSComparisonResult)br_compareDate:(NSDate *)date targetDate:(NSDate *)targetDate dateFormat:(NSString *)dateFormat;
+
+/** 获取 yearArr 数组 */
+- (NSArray *)getYearArr;
+
+/** 获取 monthArr 数组 */
+- (NSArray *)getMonthArr:(NSInteger)year;
+
+/** 获取 dayArr 数组 */
+- (NSArray *)getDayArr:(NSInteger)year month:(NSInteger)month;
+
+/** 获取 hourArr 数组 */
+- (NSArray *)getHourArr:(NSInteger)year month:(NSInteger)month day:(NSInteger)day;
+
+/** 获取 minuteArr 数组 */
+- (NSArray *)getMinuteArr:(NSInteger)year month:(NSInteger)month day:(NSInteger)day hour:(NSInteger)hour;
+
+/** 获取 secondArr 数组 */
+- (NSArray *)getSecondArr:(NSInteger)year month:(NSInteger)month day:(NSInteger)day hour:(NSInteger)hour minute:(NSInteger)minute;
+
+/**  获取 monthWeekArr 数组 */
+- (NSArray *)getMonthWeekArr:(NSInteger)year month:(NSInteger)month;
+
+/**  获取 yearWeekArr 数组 */
+- (NSArray *)getYearWeekArr:(NSInteger)year;
+
+ /**  获取 quarterArr 数组 */
+- (NSArray *)getQuarterArr:(NSInteger)year;
+
+/** 添加 pickerView */
+- (void)setupPickerView:(UIView *)pickerView toView:(UIView *)view;
+
+/** 设置日期单位 */
+- (NSArray *)setupPickerUnitLabel:(UIPickerView *)pickerView unitArr:(NSArray *)unitArr;
+
+- (NSString *)getYearNumber:(NSInteger)year;
+
+- (NSString *)getMDHMSNumber:(NSInteger)number;
+
+- (NSString *)getYearText:(NSArray *)yearArr row:(NSInteger)row;
+
+- (NSString *)getMonthText:(NSArray *)monthArr row:(NSInteger)row;
+
+- (NSString *)getDayText:(NSArray *)dayArr row:(NSInteger)row mSelectDate:(NSDate *)mSelectDate;
+
+- (NSString *)getHourText:(NSArray *)hourArr row:(NSInteger)row;
+
+- (NSString *)getMinuteText:(NSArray *)minuteArr row:(NSInteger)row;
+
+- (NSString *)getSecondText:(NSArray *)secondArr row:(NSInteger)row;
+
+- (NSString *)getWeekText:(NSArray *)weekArr row:(NSInteger)row;
+
+- (NSString *)getQuarterText:(NSArray *)quarterArr row:(NSInteger)row;
+
+- (NSString *)getAMText;
+
+- (NSString *)getPMText;
+
+- (NSString *)getYearUnit;
+
+- (NSString *)getMonthUnit;
+
+- (NSString *)getDayUnit;
+
+- (NSString *)getHourUnit;
+
+- (NSString *)getMinuteUnit;
+
+- (NSString *)getSecondUnit;
+
+- (NSString *)getWeekUnit;
+
+- (NSString *)getQuarterUnit;
+
+- (NSInteger)getIndexWithArray:(NSArray *)array object:(NSString *)obj;
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 792 - 0
Pods/BRPickerView/BRPickerView/DatePicker/BRDatePickerView+BR.m

@@ -0,0 +1,792 @@
+//
+//  BRDatePickerView+BR.m
+//  BRPickerViewDemo
+//
+//  Created by renbo on 2020/6/16.
+//  Copyright © 2020 irenb. All rights reserved.
+//
+//  最新代码下载地址:https://github.com/agiapp/BRPickerView
+
+#import "BRDatePickerView+BR.h"
+#import "NSBundle+BRPickerView.h"
+
+BRSYNTH_DUMMY_CLASS(BRDatePickerView_BR)
+
+//////////////////////////////////////////
+/// 本分类主要是给 BRDatePickerView 文件瘦身
+//////////////////////////////////////////
+
+@implementation BRDatePickerView (BR)
+
+#pragma mark - 最小日期
+- (NSDate *)handlerMinDate:(NSDate *)minDate {
+    if (!minDate) {
+        if (self.pickerMode == BRDatePickerModeMDHM) {
+            minDate = [NSDate br_setMonth:1 day:1 hour:0 minute:0];
+        } else if (self.pickerMode == BRDatePickerModeMD) {
+            minDate = [NSDate br_setMonth:1 day:1];
+        } else if (self.pickerMode == BRDatePickerModeTime || self.pickerMode == BRDatePickerModeCountDownTimer || self.pickerMode == BRDatePickerModeHM) {
+            minDate = [NSDate br_setHour:0 minute:0];
+        } else if (self.pickerMode == BRDatePickerModeHMS) {
+            minDate = [NSDate br_setHour:0 minute:0 second:0];
+        } else if (self.pickerMode == BRDatePickerModeMS) {
+            minDate = [NSDate br_setMinute:0 second:0];
+        } else {
+            minDate = [NSDate distantPast]; // 遥远的过去的一个时间点
+        }
+    }
+    
+    // 如果是12小时制,hour的最小值为1
+    if (self.isTwelveHourMode) {
+        minDate = [minDate br_setTwelveHour:1];
+    }
+    
+    return minDate;
+}
+
+#pragma mark - 最大日期
+- (NSDate *)handlerMaxDate:(NSDate *)maxDate {
+    if (!maxDate) {
+        if (self.pickerMode == BRDatePickerModeMDHM) {
+            maxDate = [NSDate br_setMonth:12 day:31 hour:23 minute:59];
+        } else if (self.pickerMode == BRDatePickerModeMD) {
+            maxDate = [NSDate br_setMonth:12 day:31];
+        } else if (self.pickerMode == BRDatePickerModeTime || self.pickerMode == BRDatePickerModeCountDownTimer || self.pickerMode == BRDatePickerModeHM) {
+            maxDate = [NSDate br_setHour:23 minute:59];
+        } else if (self.pickerMode == BRDatePickerModeHMS) {
+            maxDate = [NSDate br_setHour:23 minute:59 second:59];
+        } else if (self.pickerMode == BRDatePickerModeMS) {
+            maxDate = [NSDate br_setMinute:59 second:59];
+        } else {
+            maxDate = [NSDate distantFuture]; // 遥远的未来的一个时间点
+        }
+    }
+    
+    // 如果是12小时制,hour的最大值为12
+    if (self.isTwelveHourMode) {
+        maxDate = [maxDate br_setTwelveHour:12];
+    }
+    
+    return maxDate;
+}
+
+#pragma mark - 默认选中的日期
+- (NSDate *)handlerSelectDate:(NSDate *)selectDate dateFormat:(NSString *)dateFormat {
+    // selectDate 优先级高于 selectValue(推荐使用 selectDate 设置默认选中的日期)
+    if (!selectDate) {
+        if (self.selectValue && self.selectValue.length > 0) {
+            if (self.pickerMode == BRDatePickerModeYMDH && self.isShowAMAndPM) {
+                NSString *firstString = [[self.selectValue componentsSeparatedByString:@" "] firstObject];
+                NSString *lastString = [[self.selectValue componentsSeparatedByString:@" "] lastObject];
+                if ([lastString isEqualToString:[self getAMText]]) {
+                    self.selectValue = [NSString stringWithFormat:@"%@ 00", firstString];
+                }
+                if ([lastString isEqualToString:[self getPMText]]) {
+                    self.selectValue = [NSString stringWithFormat:@"%@ 12", firstString];
+                }
+            }
+            
+            NSDate *date = nil;
+            if ([self.selectValue isEqualToString:self.lastRowContent]) {
+                date = self.addToNow ? [NSDate date] : nil;
+            } else if ([self.selectValue isEqualToString:self.firstRowContent]) {
+                date = nil;
+            } else {
+                date = [self br_dateFromString:self.selectValue dateFormat:dateFormat];
+                if (!date) {
+                    BRErrorLog(@"参数异常!字符串 selectValue 的正确格式是:%@", dateFormat);
+                    date = [NSDate date]; // 默认值参数格式错误时,重置/忽略默认值,防止在 Release 环境下崩溃!
+                }
+                if (self.pickerMode == BRDatePickerModeMDHM) {
+                    selectDate = [NSDate br_setMonth:date.br_month day:date.br_day hour:date.br_hour minute:date.br_minute];
+                } else if (self.pickerMode == BRDatePickerModeMD) {
+                    selectDate = [NSDate br_setMonth:date.br_month day:date.br_day];
+                } else if (self.pickerMode == BRDatePickerModeTime || self.pickerMode == BRDatePickerModeCountDownTimer || self.pickerMode == BRDatePickerModeHM) {
+                    selectDate = [NSDate br_setHour:date.br_hour minute:date.br_minute];
+                } else if (self.pickerMode == BRDatePickerModeHMS) {
+                    selectDate = [NSDate br_setHour:date.br_hour minute:date.br_minute second:date.br_second];
+                } else if (self.pickerMode == BRDatePickerModeMS) {
+                    selectDate = [NSDate br_setMinute:date.br_minute second:date.br_second];
+                } else {
+                    selectDate = date;
+                }
+            }
+        } else {
+            // 不设置默认日期
+            if (self.pickerMode == BRDatePickerModeTime ||
+                self.pickerMode == BRDatePickerModeCountDownTimer ||
+                self.pickerMode == BRDatePickerModeHM ||
+                self.pickerMode == BRDatePickerModeHMS ||
+                self.pickerMode == BRDatePickerModeMS) {
+                // 默认选中最小日期
+                selectDate = self.minDate;
+            } else {
+                if (self.minuteInterval > 1 || self.secondInterval > 1) {
+                    NSDate *date = [NSDate date];
+                    NSInteger minute = self.minDate.br_minute % self.minuteInterval == 0 ? self.minDate.br_minute : 0;
+                    NSInteger second = self.minDate.br_second % self.secondInterval == 0 ? self.minDate.br_second : 0;
+                    selectDate = [NSDate br_setYear:date.br_year month:date.br_month day:date.br_day hour:date.br_hour minute:minute second:second];
+                } else {
+                    // 默认选中今天的日期
+                    selectDate = [NSDate date];
+                }
+            }
+        }
+    }
+    
+    // 判断日期是否超过边界限制
+    BOOL selectLessThanMin = [self br_compareDate:selectDate targetDate:self.minDate dateFormat:dateFormat] == NSOrderedAscending;
+    BOOL selectMoreThanMax = [self br_compareDate:selectDate targetDate:self.maxDate dateFormat:dateFormat] == NSOrderedDescending;
+    if (selectLessThanMin) {
+        BRErrorLog(@"默认选择的日期不能小于最小日期!");
+        selectDate = self.minDate;
+    }
+    if (selectMoreThanMax) {
+        BRErrorLog(@"默认选择的日期不能大于最大日期!");
+        selectDate = self.maxDate;
+    }
+    
+    return selectDate;
+}
+
+#pragma mark - NSDate 转 NSString
+- (NSString *)br_stringFromDate:(NSDate *)date dateFormat:(NSString *)dateFormat {
+    return [NSDate br_stringFromDate:date dateFormat:dateFormat language:self.pickerStyle.language];
+}
+
+#pragma mark - NSString 转 NSDate
+- (NSDate *)br_dateFromString:(NSString *)dateString dateFormat:(NSString *)dateFormat {
+    return [NSDate br_dateFromString:dateString dateFormat:dateFormat language:self.pickerStyle.language];
+}
+
+#pragma mark - 比较两个日期大小(可以指定比较级数,即按指定格式进行比较)
+- (NSComparisonResult)br_compareDate:(NSDate *)date targetDate:(NSDate *)targetDate dateFormat:(NSString *)dateFormat {
+    NSString *dateString1 = [self br_stringFromDate:date dateFormat:dateFormat];
+    NSString *dateString2 = [self br_stringFromDate:targetDate dateFormat:dateFormat];
+    NSDate *date1 = [self br_dateFromString:dateString1 dateFormat:dateFormat];
+    NSDate *date2 = [self br_dateFromString:dateString2 dateFormat:dateFormat];
+    if ([date1 compare:date2] == NSOrderedDescending) {
+        return 1; // 大于
+    } else if ([date1 compare:date2] == NSOrderedAscending) {
+        return -1; // 小于
+    } else {
+        return 0; // 等于
+    }
+}
+
+#pragma mark - 获取 yearArr 数组
+- (NSArray *)getYearArr {
+    NSMutableArray *tempArr = [[NSMutableArray alloc]init];
+    for (NSInteger i = self.minDate.br_year; i <= self.maxDate.br_year; i++) {
+        [tempArr addObject:[self getYearNumber:i]];
+    }
+    if (self.isDescending) {
+        NSArray *reversedArr = [[tempArr reverseObjectEnumerator] allObjects];
+        tempArr = [reversedArr mutableCopy];
+    }
+    // 判断是否需要添加【自定义字符串】
+    if (self.lastRowContent || self.firstRowContent) {
+        switch (self.pickerMode) {
+            case BRDatePickerModeYMDHMS:
+            case BRDatePickerModeYMDHM:
+            case BRDatePickerModeYMDH:
+            case BRDatePickerModeYMD:
+            case BRDatePickerModeYM:
+            case BRDatePickerModeY:
+            {
+                if (self.lastRowContent) {
+                    [tempArr addObject:self.lastRowContent];
+                }
+                if (self.firstRowContent) {
+                    [tempArr insertObject:self.firstRowContent atIndex:0];
+                }
+            }
+                break;
+                
+            default:
+                break;
+        }
+    }
+    
+    return [tempArr copy];
+}
+
+#pragma mark - 获取 monthArr 数组
+- (NSArray *)getMonthArr:(NSInteger)year {
+    NSInteger startMonth = 1;
+    NSInteger endMonth = 12;
+    if (year == self.minDate.br_year) {
+        startMonth = self.minDate.br_month;
+    }
+    if (year == self.maxDate.br_year) {
+        endMonth = self.maxDate.br_month;
+    }
+    NSMutableArray *tempArr = [[NSMutableArray alloc]init];
+    for (NSInteger i = startMonth; i <= endMonth; i++) {
+        [tempArr addObject:[self getMDHMSNumber:i]];
+    }
+    if (self.isDescending) {
+        NSArray *reversedArr = [[tempArr reverseObjectEnumerator] allObjects];
+        tempArr = [reversedArr mutableCopy];
+    }
+    // 判断是否需要添加【自定义字符串】
+    if (self.lastRowContent || self.firstRowContent) {
+        switch (self.pickerMode) {
+            case BRDatePickerModeMDHM:
+            case BRDatePickerModeMD:
+            {
+                if (self.lastRowContent) {
+                    [tempArr addObject:self.lastRowContent];
+                }
+                if (self.firstRowContent) {
+                    [tempArr insertObject:self.firstRowContent atIndex:0];
+                }
+            }
+                break;
+                
+            default:
+                break;
+        }
+    }
+    
+    return [tempArr copy];
+}
+
+#pragma mark - 获取 dayArr 数组
+- (NSArray *)getDayArr:(NSInteger)year month:(NSInteger)month {
+    NSInteger startDay = 1;
+    NSInteger endDay = [NSDate br_getDaysInYear:year month:month];
+    if (year == self.minDate.br_year && month == self.minDate.br_month) {
+        startDay = self.minDate.br_day;
+    }
+    if (year == self.maxDate.br_year && month == self.maxDate.br_month) {
+        endDay = self.maxDate.br_day;
+    }
+    NSMutableArray *tempArr = [[NSMutableArray alloc]init];
+    for (NSInteger i = startDay; i <= endDay; i++) {
+        [tempArr addObject:[self getMDHMSNumber:i]];
+    }
+    if (self.isDescending) {
+        return [[tempArr reverseObjectEnumerator] allObjects];
+    }
+    
+    return [tempArr copy];
+}
+
+#pragma mark - 获取 hourArr 数组
+- (NSArray *)getHourArr:(NSInteger)year month:(NSInteger)month day:(NSInteger)day {
+    if (self.pickerMode == BRDatePickerModeYMDH && self.isShowAMAndPM) {
+        return @[[self getAMText], [self getPMText]];
+    }
+    
+    NSInteger startHour = self.isTwelveHourMode ? 1 : 0;
+    NSInteger endHour = self.isTwelveHourMode ? 12 : 23;
+    if (year == self.minDate.br_year && month == self.minDate.br_month && day == self.minDate.br_day) {
+        startHour = self.minDate.br_hour;
+        if (self.isTwelveHourMode) {
+            if (startHour < 1 || startHour > 12) {
+                startHour = 1;
+            }
+        }
+    }
+    if (year == self.maxDate.br_year && month == self.maxDate.br_month && day == self.maxDate.br_day) {
+        endHour = self.maxDate.br_hour;
+        if (self.isTwelveHourMode) {
+            if (endHour < 1 || endHour > 12) {
+                endHour = 12;
+            }
+        }
+    }
+    NSMutableArray *tempArr = [[NSMutableArray alloc]init];
+    for (NSInteger i = startHour; i <= endHour; i++) {
+        [tempArr addObject:[self getMDHMSNumber:i]];
+    }
+    if (self.isDescending) {
+        NSArray *reversedArr = [[tempArr reverseObjectEnumerator] allObjects];
+        tempArr = [reversedArr mutableCopy];
+    }
+    // 判断是否需要添加【自定义字符串】
+    if (self.lastRowContent || self.firstRowContent) {
+        switch (self.pickerMode) {
+            case BRDatePickerModeHMS:
+            case BRDatePickerModeHM:
+            {
+                if (self.lastRowContent) {
+                    [tempArr addObject:self.lastRowContent];
+                }
+                if (self.firstRowContent) {
+                    [tempArr insertObject:self.firstRowContent atIndex:0];
+                }
+            }
+                break;
+                
+            default:
+                break;
+        }
+    }
+    
+    return [tempArr copy];
+}
+
+#pragma mark - 获取 minuteArr 数组
+- (NSArray *)getMinuteArr:(NSInteger)year month:(NSInteger)month day:(NSInteger)day hour:(NSInteger)hour {
+    NSInteger startMinute = 0;
+    NSInteger endMinute = 59;
+    if (year == self.minDate.br_year && month == self.minDate.br_month && day == self.minDate.br_day && hour == self.minDate.br_hour) {
+        startMinute = self.minDate.br_minute;
+    }
+    if (year == self.maxDate.br_year && month == self.maxDate.br_month && day == self.maxDate.br_day && hour == self.maxDate.br_hour) {
+        endMinute = self.maxDate.br_minute;
+    }
+    NSMutableArray *tempArr = [[NSMutableArray alloc]init];
+    for (NSInteger i = startMinute; i <= endMinute; i += self.minuteInterval) {
+        [tempArr addObject:[self getMDHMSNumber:i]];
+    }
+    if (self.isDescending) {
+        NSArray *reversedArr = [[tempArr reverseObjectEnumerator] allObjects];
+        tempArr = [reversedArr mutableCopy];
+    }
+    // 判断是否需要添加【自定义字符串】
+    if (self.lastRowContent || self.firstRowContent) {
+        switch (self.pickerMode) {
+            case BRDatePickerModeMS:
+            {
+                if (self.lastRowContent) {
+                    [tempArr addObject:self.lastRowContent];
+                }
+                if (self.firstRowContent) {
+                    [tempArr insertObject:self.firstRowContent atIndex:0];
+                }
+            }
+                break;
+                
+            default:
+                break;
+        }
+    }
+    
+    return [tempArr copy];
+}
+
+#pragma mark - 获取 secondArr 数组
+- (NSArray *)getSecondArr:(NSInteger)year month:(NSInteger)month day:(NSInteger)day hour:(NSInteger)hour minute:(NSInteger)minute {
+    NSInteger startSecond = 0;
+    NSInteger endSecond = 59;
+    if (year == self.minDate.br_year && month == self.minDate.br_month && day == self.minDate.br_day && hour == self.minDate.br_hour && minute == self.minDate.br_minute) {
+        startSecond = self.minDate.br_second;
+    }
+    if (year == self.maxDate.br_year && month == self.maxDate.br_month && day == self.maxDate.br_day && hour == self.maxDate.br_hour && minute == self.maxDate.br_minute) {
+        endSecond = self.maxDate.br_second;
+    }
+    NSMutableArray *tempArr = [[NSMutableArray alloc]init];
+    for (NSInteger i = startSecond; i <= endSecond; i += self.secondInterval) {
+        [tempArr addObject:[self getMDHMSNumber:i]];
+    }
+    if (self.isDescending) {
+        return [[tempArr reverseObjectEnumerator] allObjects];
+    }
+    
+    return [tempArr copy];
+}
+
+#pragma mark - 获取 monthWeekArr 数组
+- (NSArray *)getMonthWeekArr:(NSInteger)year month:(NSInteger)month {
+    NSInteger startWeek = 1;
+    NSInteger endWeek = [NSDate br_getWeeksOfMonthInYear:year month:month];
+    if (year == self.minDate.br_year && month == self.minDate.br_month) {
+        startWeek = self.minDate.br_monthWeek;
+    }
+    if (year == self.maxDate.br_year && month == self.maxDate.br_month) {
+        endWeek = self.maxDate.br_monthWeek;
+    }
+    NSMutableArray *tempArr = [[NSMutableArray alloc]init];
+    for (NSInteger i = startWeek; i <= endWeek; i++) {
+        [tempArr addObject:[self getMDHMSNumber:i]];
+    }
+    if (self.isDescending) {
+        return [[tempArr reverseObjectEnumerator] allObjects];
+    }
+    
+    return [tempArr copy];
+}
+
+#pragma mark - 获取 yearWeekArr 数组
+- (NSArray *)getYearWeekArr:(NSInteger)year {
+    NSInteger startWeek = 1;
+    NSInteger endWeek = [NSDate br_getWeeksOfYearInYear:year];
+    if (year == self.minDate.br_year) {
+        startWeek = self.minDate.br_yearWeek;
+    }
+    if (year == self.maxDate.br_year) {
+        endWeek = self.maxDate.br_yearWeek;
+    }
+    NSMutableArray *tempArr = [[NSMutableArray alloc]init];
+    for (NSInteger i = startWeek; i <= endWeek; i++) {
+        [tempArr addObject:[self getMDHMSNumber:i]];
+    }
+    if (self.isDescending) {
+        return [[tempArr reverseObjectEnumerator] allObjects];
+    }
+    
+    return [tempArr copy];
+}
+
+#pragma mark - 获取 quarterArr 数组
+- (NSArray *)getQuarterArr:(NSInteger)year {
+    NSInteger startQuarter = 1;
+    NSInteger endQuarter = [NSDate br_getQuartersInYear:year];
+    if (year == self.minDate.br_year) {
+        startQuarter = self.minDate.br_quarter;
+    }
+    if (year == self.maxDate.br_year) {
+        endQuarter = self.maxDate.br_quarter;
+    }
+    NSMutableArray *tempArr = [[NSMutableArray alloc]init];
+    for (NSInteger i = startQuarter; i <= endQuarter; i++) {
+        [tempArr addObject:[self getMDHMSNumber:i]];
+    }
+    if (self.isDescending) {
+        return [[tempArr reverseObjectEnumerator] allObjects];
+    }
+    
+    return [tempArr copy];
+}
+
+#pragma mark - 添加 pickerView
+- (void)setupPickerView:(UIView *)pickerView toView:(UIView *)view {
+    if (view) {
+        // 立即刷新容器视图 view 的布局(防止 view 使用自动布局时,选择器视图无法正常显示)
+        [view setNeedsLayout];
+        [view layoutIfNeeded];
+        
+        self.frame = view.bounds;
+        CGFloat pickerHeaderViewHeight = self.pickerHeaderView ? self.pickerHeaderView.bounds.size.height : 0;
+        CGFloat pickerFooterViewHeight = self.pickerFooterView ? self.pickerFooterView.bounds.size.height : 0;
+        pickerView.frame = CGRectMake(0, pickerHeaderViewHeight, view.bounds.size.width, view.bounds.size.height - pickerHeaderViewHeight - pickerFooterViewHeight);
+        [self addSubview:pickerView];
+    } else {
+        // iOS16:重新设置 pickerView 高度(解决懒加载设置frame不生效问题)
+        CGFloat pickerHeaderViewHeight = self.pickerHeaderView ? self.pickerHeaderView.bounds.size.height : 0;
+        pickerView.frame = CGRectMake(0, self.pickerStyle.titleBarHeight + pickerHeaderViewHeight, self.keyView.bounds.size.width, self.pickerStyle.pickerHeight);
+
+        [self.alertView addSubview:pickerView];
+    }
+}
+
+#pragma mark - 获取日期单位
+- (NSArray *)setupPickerUnitLabel:(UIPickerView *)pickerView unitArr:(NSArray *)unitArr {
+    NSMutableArray *tempArr = [[NSMutableArray alloc]init];
+    for (NSInteger i = 0; i < pickerView.numberOfComponents; i++) {
+        // label宽度
+        CGFloat labelWidth = pickerView.bounds.size.width / pickerView.numberOfComponents;
+        // 单位label
+        UILabel *unitLabel = [[UILabel alloc]init];
+        unitLabel.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin;
+        unitLabel.backgroundColor = [UIColor clearColor];
+        if (self.pickerMode != BRDatePickerModeYMDHMS) {
+            unitLabel.textAlignment = NSTextAlignmentCenter;
+        }
+        unitLabel.font = self.pickerStyle.dateUnitTextFont;
+        unitLabel.textColor = self.pickerStyle.dateUnitTextColor;
+        // 字体自适应属性
+        unitLabel.adjustsFontSizeToFitWidth = YES;
+        // 自适应最小字体缩放比例
+        unitLabel.minimumScaleFactor = 0.5f;
+        unitLabel.text = (unitArr.count > 0 && i < unitArr.count) ? unitArr[i] : nil;
+        [unitLabel sizeToFit];
+        
+        CGFloat centerX = i * labelWidth + labelWidth / 2.0 + self.pickerStyle.dateUnitOffsetX;
+        CGFloat centerY = pickerView.frame.size.height / 2.0 + self.pickerStyle.dateUnitOffsetY;
+        NSArray *deltaArr = nil;
+        // 1.调整各日期单位的水平偏移差值(默认调整)
+        if (self.pickerMode == BRDatePickerModeYMDHMS) {
+            deltaArr = @[@30, @22, @27, @33, @38, @23];
+        } else if (self.pickerMode == BRDatePickerModeYMDHM) {
+            deltaArr = @[@30, @22, @27, @33, @38];
+        } else if (self.pickerMode == BRDatePickerModeYMDH) {
+            deltaArr = @[@30, @22, @27, @33];
+        } else if (self.pickerMode == BRDatePickerModeMDHM) {
+            deltaArr = @[@22, @27, @33, @38];
+        } else if (self.pickerMode == BRDatePickerModeYMD) {
+            deltaArr = @[@32, @23, @27];
+        } else if (self.pickerMode == BRDatePickerModeYM) {
+            deltaArr = @[@32, @23];
+        } else if (self.pickerMode == BRDatePickerModeY) {
+            deltaArr = @[@32];
+        } else if (self.pickerMode == BRDatePickerModeMD) {
+            deltaArr = @[@22, @27];
+        } else if (self.pickerMode == BRDatePickerModeHMS) {
+            deltaArr = @[@23, @25, @30];
+        } else if (self.pickerMode == BRDatePickerModeHM) {
+            deltaArr = @[@23, @27];
+        } else if (self.pickerMode == BRDatePickerModeMS) {
+            deltaArr = @[@25, @30];
+        } else if (self.pickerMode == BRDatePickerModeYQ) {
+            deltaArr = @[@32, @32];
+        } else if (self.pickerMode == BRDatePickerModeYMW) {
+            deltaArr = @[@32, @22, @27];
+        } else if (self.pickerMode == BRDatePickerModeYW) {
+            deltaArr = @[@32, @25];
+        }
+        // 2.调整各日期单位的水平偏移差值(自定义调整)
+        if (self.pickerStyle.dateUnitDeltaX.count > 0) {
+            deltaArr = self.pickerStyle.dateUnitDeltaX;
+        }
+        if (deltaArr && i < deltaArr.count) {
+            centerX += [deltaArr[i] integerValue];
+        }
+        
+        unitLabel.center = CGPointMake(centerX, centerY);
+        
+        [tempArr addObject:unitLabel];
+        
+        [pickerView addSubview:unitLabel];
+    }
+    
+    return [tempArr copy];
+}
+
+- (NSString *)getYearNumber:(NSInteger)year {
+    NSString *yearString = [NSString stringWithFormat:@"%@", @(year)];
+    if (self.isNumberFullName) {
+        yearString = [NSString stringWithFormat:@"%04d", [yearString intValue]];
+    }
+    return yearString;
+}
+
+- (NSString *)getMDHMSNumber:(NSInteger)number {
+    NSString *string = [NSString stringWithFormat:@"%@", @(number)];
+    if (self.isNumberFullName) {
+        string = [NSString stringWithFormat:@"%02d", [string intValue]];
+    }
+    return string;
+}
+
+- (NSString *)getYearText:(NSArray *)yearArr row:(NSInteger)row {
+    NSInteger index = 0;
+    if (row >= 0) {
+        index = MIN(row, yearArr.count - 1);
+    }
+    NSString *yearString = [yearArr objectAtIndex:index];
+    if ((self.lastRowContent && [yearString isEqualToString:self.lastRowContent]) || (self.firstRowContent && [yearString isEqualToString:self.firstRowContent])) {
+        return yearString;
+    }
+    NSString *yearUnit = self.showUnitType == BRShowUnitTypeAll ? [self getYearUnit] : @"";
+    return [NSString stringWithFormat:@"%@%@", yearString, yearUnit];
+}
+
+- (NSString *)getMonthText:(NSArray *)monthArr row:(NSInteger)row {
+    NSInteger index = 0;
+    if (row >= 0) {
+        index = MIN(row, monthArr.count - 1);
+    }
+    NSString *monthString = [monthArr objectAtIndex:index];
+    // 首行/末行是自定义字符串,直接返回
+    if ((self.firstRowContent && [monthString isEqualToString:self.firstRowContent]) || (self.lastRowContent && [monthString isEqualToString:self.lastRowContent])) {
+        return monthString;
+    }
+    
+    // 自定义月份数据源
+    if (self.monthNames && self.monthNames.count > 0) {
+        NSInteger index = [monthString integerValue] - 1;
+        monthString = (index >= 0 && index < self.monthNames.count) ? self.monthNames[index] : @"";
+    } else {
+        if (![self.pickerStyle.language hasPrefix:@"zh"] && (self.pickerMode == BRDatePickerModeYMD || self.pickerMode == BRDatePickerModeYM || self.pickerMode == BRDatePickerModeYMW)) {
+            // 非中文环境:月份使用系统的月份名称
+            NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
+            dateFormatter.locale = [[NSLocale alloc]initWithLocaleIdentifier:self.pickerStyle.language];
+            // monthSymbols: @[@"January", @"February", @"March", @"April", @"May", @"June", @"July", @"August", @"September", @"October", @"November", @"December"];
+            // shortMonthSymbols: @[@"Jan", @"Feb", @"Mar", @"Apr", @"May", @"Jun", @"Jul", @"Aug", @"Sep", @"Oct", @"Nov", @"Dec"];
+            NSArray *monthNames = self.isShortMonthName ? dateFormatter.shortMonthSymbols : dateFormatter.monthSymbols;
+            NSInteger index = [monthString integerValue] - 1;
+            monthString = (index >= 0 && index < monthNames.count) ? monthNames[index] : @"";
+        } else {
+            // 中文环境:月份显示数字
+            NSString *monthUnit = self.showUnitType == BRShowUnitTypeAll ? [self getMonthUnit] : @"";
+            monthString = [NSString stringWithFormat:@"%@%@", monthString, monthUnit];
+        }
+    }
+    
+    return monthString;
+}
+
+- (NSString *)getDayText:(NSArray *)dayArr row:(NSInteger)row mSelectDate:(NSDate *)mSelectDate {
+    NSInteger index = 0;
+    if (row >= 0) {
+        index = MIN(row, dayArr.count - 1);
+    }
+    NSString *dayString = [dayArr objectAtIndex:index];
+    if (self.isShowToday && mSelectDate.br_year == [NSDate date].br_year && mSelectDate.br_month == [NSDate date].br_month && [dayString integerValue] == [NSDate date].br_day) {
+        return [NSBundle br_localizedStringForKey:@"今天" language:self.pickerStyle.language];
+    }
+    NSString *dayUnit = self.showUnitType == BRShowUnitTypeAll ? [self getDayUnit] : @"";
+    dayString = [NSString stringWithFormat:@"%@%@", dayString, dayUnit];
+    if (self.isShowWeek) {
+        NSDate *date = [NSDate br_setYear:mSelectDate.br_year month:mSelectDate.br_month day:[dayString integerValue]];
+        NSString *weekdayString = [NSBundle br_localizedStringForKey:[date br_weekdayString] language:self.pickerStyle.language];
+        dayString = [NSString stringWithFormat:@"%@%@", dayString, weekdayString];
+    }
+    return dayString;
+}
+
+- (NSString *)getHourText:(NSArray *)hourArr row:(NSInteger)row {
+    NSInteger index = 0;
+    if (row >= 0) {
+        index = MIN(row, hourArr.count - 1);
+    }
+    NSString *hourString = [hourArr objectAtIndex:index];
+    if ((self.lastRowContent && [hourString isEqualToString:self.lastRowContent]) || (self.firstRowContent && [hourString isEqualToString:self.firstRowContent])) {
+        return hourString;
+    }
+    NSString *hourUnit = self.showUnitType == BRShowUnitTypeAll ? [self getHourUnit] : @"";
+    return [NSString stringWithFormat:@"%@%@", hourString, hourUnit];
+}
+
+- (NSString *)getMinuteText:(NSArray *)minuteArr row:(NSInteger)row {
+    NSInteger index = 0;
+    if (row >= 0) {
+        index = MIN(row, minuteArr.count - 1);
+    }
+    NSString *minuteString = [minuteArr objectAtIndex:index];
+    NSString *minuteUnit = self.showUnitType == BRShowUnitTypeAll ? [self getMinuteUnit] : @"";
+    return [NSString stringWithFormat:@"%@%@", minuteString, minuteUnit];
+}
+
+- (NSString *)getSecondText:(NSArray *)secondArr row:(NSInteger)row {
+    NSInteger index = 0;
+    if (row >= 0) {
+        index = MIN(row, secondArr.count - 1);
+    }
+    NSString *secondString = [secondArr objectAtIndex:index];
+    NSString *secondUnit = self.showUnitType == BRShowUnitTypeAll ? [self getSecondUnit] : @"";
+    return [NSString stringWithFormat:@"%@%@", secondString, secondUnit];
+}
+
+- (NSString *)getWeekText:(NSArray *)weekArr row:(NSInteger)row {
+    NSInteger index = 0;
+    if (row >= 0) {
+        index = MIN(row, weekArr.count - 1);
+    }
+    NSString *weekString = [weekArr objectAtIndex:index];
+    if ((self.lastRowContent && [weekString isEqualToString:self.lastRowContent]) || (self.firstRowContent && [weekString isEqualToString:self.firstRowContent])) {
+        return weekString;
+    }
+    NSString *weekUnit = self.showUnitType == BRShowUnitTypeAll ? [self getWeekUnit] : @"";
+    return [NSString stringWithFormat:@"%@%@", weekString, weekUnit];
+}
+
+- (NSString *)getQuarterText:(NSArray *)quarterArr row:(NSInteger)row {
+    NSInteger index = 0;
+    if (row >= 0) {
+        index = MIN(row, quarterArr.count - 1);
+    }
+    NSString *quarterString = [quarterArr objectAtIndex:index];
+    if ((self.lastRowContent && [quarterString isEqualToString:self.lastRowContent]) || (self.firstRowContent && [quarterString isEqualToString:self.firstRowContent])) {
+        return quarterString;
+    }
+    NSString *quarterUnit = self.showUnitType == BRShowUnitTypeAll ? [self getQuarterUnit] : @"";
+    return [NSString stringWithFormat:@"%@%@", quarterString, quarterUnit];
+}
+
+- (NSString *)getAMText {
+    return [NSBundle br_localizedStringForKey:@"上午" language:self.pickerStyle.language];
+}
+
+- (NSString *)getPMText {
+    return [NSBundle br_localizedStringForKey:@"下午" language:self.pickerStyle.language];
+}
+
+- (NSString *)getYearUnit {
+    if (self.customUnit) {
+        return self.customUnit[@"year"] ? : @"";
+    }
+    if (![self.pickerStyle.language hasPrefix:@"zh"]) {
+        return @"";
+    }
+    return [NSBundle br_localizedStringForKey:@"年" language:self.pickerStyle.language];
+}
+
+- (NSString *)getMonthUnit {
+    if (self.customUnit) {
+        return self.customUnit[@"month"] ? : @"";
+    }
+    if (![self.pickerStyle.language hasPrefix:@"zh"]) {
+        return @"";
+    }
+    return [NSBundle br_localizedStringForKey:@"月" language:self.pickerStyle.language];
+}
+
+- (NSString *)getDayUnit {
+    if (self.customUnit) {
+        return self.customUnit[@"day"] ? : @"";
+    }
+    if (![self.pickerStyle.language hasPrefix:@"zh"]) {
+        return @"";
+    }
+    return [NSBundle br_localizedStringForKey:@"日" language:self.pickerStyle.language];
+}
+
+- (NSString *)getHourUnit {
+    if (self.pickerMode == BRDatePickerModeYMDH && self.isShowAMAndPM) {
+        return @"";
+    }
+    if (self.customUnit) {
+        return self.customUnit[@"hour"] ? : @"";
+    }
+    if (![self.pickerStyle.language hasPrefix:@"zh"]) {
+        return @"";
+    }
+    return [NSBundle br_localizedStringForKey:@"时" language:self.pickerStyle.language];
+}
+
+- (NSString *)getMinuteUnit {
+    if (self.customUnit) {
+        return self.customUnit[@"minute"] ? : @"";
+    }
+    if (![self.pickerStyle.language hasPrefix:@"zh"]) {
+        return @"";
+    }
+    return [NSBundle br_localizedStringForKey:@"分" language:self.pickerStyle.language];
+}
+
+- (NSString *)getSecondUnit {
+    if (self.customUnit) {
+        return self.customUnit[@"second"] ? : @"";
+    }
+    if (![self.pickerStyle.language hasPrefix:@"zh"]) {
+        return @"";
+    }
+    return [NSBundle br_localizedStringForKey:@"秒" language:self.pickerStyle.language];
+}
+
+- (NSString *)getWeekUnit {
+    if (self.customUnit) {
+        return self.customUnit[@"week"] ? : @"";
+    }
+    if (![self.pickerStyle.language hasPrefix:@"zh"]) {
+        return @"";
+    }
+    return [NSBundle br_localizedStringForKey:@"周" language:self.pickerStyle.language];
+}
+
+- (NSString *)getQuarterUnit {
+    if (self.customUnit) {
+        return self.customUnit[@"quarter"] ? : @"";
+    }
+    if (![self.pickerStyle.language hasPrefix:@"zh"]) {
+        return @"";
+    }
+    return [NSBundle br_localizedStringForKey:@"季度" language:self.pickerStyle.language];
+}
+
+- (NSInteger)getIndexWithArray:(NSArray *)array object:(NSString *)obj {
+    if (!array || array.count == 0 || !obj) {
+        return 0;
+    }
+    if ([array containsObject:obj]) {
+        return [array indexOfObject:obj];
+    }
+    return 0;
+}
+
+@end

+ 287 - 0
Pods/BRPickerView/BRPickerView/DatePicker/BRDatePickerView.h

@@ -0,0 +1,287 @@
+//
+//  BRDatePickerView.h
+//  BRPickerViewDemo
+//
+//  Created by renbo on 2017/8/11.
+//  Copyright © 2017 irenb. All rights reserved.
+//
+//  最新代码下载地址:https://github.com/agiapp/BRPickerView
+
+#import "BRPickerAlertView.h"
+#import "NSDate+BRPickerView.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+/// 日期选择器格式
+typedef NS_ENUM(NSInteger, BRDatePickerMode) {
+    // ----- 以下4种是系统样式(兼容国际化日期格式) -----
+    /** 【yyyy-MM-dd】UIDatePickerModeDate(美式日期:MM-dd-yyyy;英式日期:dd-MM-yyyy)*/
+    BRDatePickerModeDate,
+    /** 【yyyy-MM-dd HH:mm】 UIDatePickerModeDateAndTime */
+    BRDatePickerModeDateAndTime,
+    /** 【HH:mm】UIDatePickerModeTime */
+    BRDatePickerModeTime,
+    /** 【HH:mm】UIDatePickerModeCountDownTimer */
+    BRDatePickerModeCountDownTimer,
+    
+    // ----- 以下14种是自定义样式 -----
+    /** 【yyyy-MM-dd HH:mm:ss】年月日时分秒 */
+    BRDatePickerModeYMDHMS,
+    /** 【yyyy-MM-dd HH:mm】年月日时分 */
+    BRDatePickerModeYMDHM,
+    /** 【yyyy-MM-dd HH】年月日时 */
+    BRDatePickerModeYMDH,
+    /** 【MM-dd HH:mm】月日时分 */
+    BRDatePickerModeMDHM,
+    /** 【yyyy-MM-dd】年月日(兼容国际化日期:dd-MM-yyyy)*/
+    BRDatePickerModeYMD,
+    /** 【yyyy-MM】年月(兼容国际化日期:MM-yyyy)*/
+    BRDatePickerModeYM,
+    /** 【yyyy】年 */
+    BRDatePickerModeY,
+    /** 【MM-dd】月日 */
+    BRDatePickerModeMD,
+    /** 【HH:mm:ss】时分秒 */
+    BRDatePickerModeHMS,
+    /** 【HH:mm】时分 */
+    BRDatePickerModeHM,
+    /** 【mm:ss】分秒 */
+    BRDatePickerModeMS,
+    
+    /** 【yyyy-qq】年季度 */
+    BRDatePickerModeYQ,
+    /** 【yyyy-MM-ww】年月周 */
+    BRDatePickerModeYMW,
+    /** 【yyyy-ww】年周 */
+    BRDatePickerModeYW
+};
+
+/// 日期单位显示的位置
+typedef NS_ENUM(NSInteger, BRShowUnitType) {
+    /** 日期单位显示全部行(默认)*/
+    BRShowUnitTypeAll,
+    /** 日期单位仅显示中间行 */
+    BRShowUnitTypeOnlyCenter,
+    /** 日期单位不显示(隐藏日期单位)*/
+    BRShowUnitTypeNone
+};
+
+typedef void (^BRDateResultBlock)(NSDate * _Nullable selectDate, NSString * _Nullable selectValue);
+
+typedef void (^BRDateResultRangeBlock)(NSDate * _Nullable selectStartDate, NSDate * _Nullable selectEndDate, NSString * _Nullable selectValue);
+
+@interface BRDatePickerView : BRPickerAlertView
+
+/**
+ //////////////////////////////////////////////////////////////////////////
+ ///
+ ///   【用法一】
+ ///    特点:灵活,扩展性强(推荐使用!)
+ ///
+ ////////////////////////////////////////////////////////////////////////*/
+
+/** 日期选择器显示类型 */
+@property (nonatomic, assign) BRDatePickerMode pickerMode;
+
+/** 设置选中的日期(推荐使用 selectDate) */
+@property (nullable, nonatomic, strong) NSDate *selectDate;
+@property (nullable, nonatomic, copy) NSString *selectValue;
+
+/** 最小日期(可使用 NSDate+BRPickerView 分类中对应的方法进行创建)*/
+@property (nullable, nonatomic, strong) NSDate *minDate;
+/** 最大日期(可使用 NSDate+BRPickerView 分类中对应的方法进行创建)*/
+@property (nullable, nonatomic, strong) NSDate *maxDate;
+
+/** 是否自动选择,即滚动选择器后就执行结果回调,默认为 NO */
+@property (nonatomic, assign) BOOL isAutoSelect;
+
+/** 选择结果的回调 */
+@property (nullable, nonatomic, copy) BRDateResultBlock resultBlock;
+/** 选择结果范围的回调:for `BRDatePickerModeYQ`、`BRDatePickerModeYMW`、`BRDatePickerModeYW`, ignored otherwise. */
+@property (nullable, nonatomic, copy) BRDateResultRangeBlock resultRangeBlock;
+
+/** 滚动选择时触发的回调 */
+@property (nullable, nonatomic, copy) BRDateResultBlock changeBlock;
+/** 滚动选择范围时触发的回调:for `BRDatePickerModeYQ`、`BRDatePickerModeYMW`、`BRDatePickerModeYW`, ignored otherwise. */
+@property (nullable, nonatomic, copy) BRDateResultRangeBlock changeRangeBlock;
+
+/** 判断选择器是否处于滚动中。可以用于解决快速滑动选择器,在滚动结束前秒选确定按钮,出现显示不对的问题。*/
+@property (nonatomic, readonly, assign, getter=isRolling) BOOL rolling;
+
+/** 日期单位显示类型 */
+@property (nonatomic, assign) BRShowUnitType showUnitType;
+
+/** 是否显示【星期】,默认为 NO */
+@property (nonatomic, assign, getter=isShowWeek) BOOL showWeek;
+
+/** 是否显示【今天】,默认为 NO */
+@property (nonatomic, assign, getter=isShowToday) BOOL showToday;
+
+/** 是否添加【至今】,默认为 NO */
+@property (nonatomic, assign, getter=isAddToNow) BOOL addToNow;
+
+/** 首行添加 自定义字符串,配合 selectValue 可设置默认选中 */
+@property (nullable, nonatomic, copy) NSString *firstRowContent;
+
+/** 末行添加 自定义字符串(如:至今),配合 selectValue 可设置默认选中 */
+@property (nullable, nonatomic, copy) NSString *lastRowContent;
+
+/** 滚轮上日期数据排序是否降序,默认为 NO(升序)*/
+@property (nonatomic, assign, getter=isDescending) BOOL descending;
+
+/** 选择器上数字是否带有前导零,默认为 NO(如:无前导零:2020-1-1;有前导零:2020-01-01)*/
+@property (nonatomic, assign, getter=isNumberFullName) BOOL numberFullName;
+
+/** 是否为12小时制,默认为NO */
+@property (nonatomic, assign, getter=isTwelveHourMode) BOOL twelveHourMode;
+
+/** 设置分的时间间隔,默认为1(范围:1 ~ 30)*/
+@property (nonatomic, assign) NSInteger minuteInterval;
+
+/** 设置秒的时间间隔,默认为1(范围:1 ~ 30)*/
+@property (nonatomic, assign) NSInteger secondInterval;
+
+/** 设置倒计时的时长,默认为0(范围:0 ~ 24*60*60-1,单位为秒) for `BRDatePickerModeCountDownTimer`, ignored otherwise. */
+@property (nonatomic, assign) NSTimeInterval countDownDuration;
+
+/**
+ *  自定义月份数据源
+ *  如:@[@"1月", @"2月",..., @"12月"]、 @[@"一月", @"二月",..., @"十二月"]、 @[@"Jan", @"Feb",..., @"Dec"] 等
+ */
+@property (nonatomic, copy) NSArray <NSString *> *monthNames;
+
+/**
+ *  设置国际化日期(非中文环境下)月份是否显示简称,默认为 NO。for `BRDatePickerModeYMD` and `BRDatePickerModeYM`, ignored otherwise.
+ *  如:January 的简称为:Jan
+ */
+@property (nonatomic, assign, getter=isShortMonthName) BOOL shortMonthName;
+
+/**
+ *  自定义日期单位
+ *  字典格式:@{@"year": @"年", @"month": @"月", @"day": @"日", @"hour": @"时", @"minute": @"分", @"second": @"秒"}
+ */
+@property (nonatomic, copy) NSDictionary *customUnit;
+
+/** 显示上午和下午,默认为 NO. for `BRDatePickerModeYMDH`, ignored otherwise. */
+@property (nonatomic, assign, getter=isShowAMAndPM) BOOL showAMAndPM;
+
+/** 
+ *  设置时区,默认为当前时区
+ *  如:timeZone = [NSTimeZone timeZoneWithName:@"America/New_York"]; // 如:设置时区为 美国纽约
+ *  特别提示:如果有设置自定义时区,需要把有使用 NSDate+BRPickerView 分类中方法的代码(如:设置minDate、maxDate等) 放在设置时区代码的后面,目的是同步时区设置到 NSDate+BRPickerView 分类中
+ */
+@property (nullable, nonatomic, copy) NSTimeZone *timeZone;
+
+/** 
+ *  设置日历对象,可以指定日历的算法。default is [NSCalendar currentCalendar]. setting nil returns to default. for `UIDatePicker`, ignored otherwise.
+ *  如:calendar = [[NSCalendar alloc]initWithCalendarIdentifier:NSCalendarIdentifierChinese]; // 设置中国农历(阴历)日期
+ */
+@property (nullable, nonatomic, copy) NSCalendar *calendar;
+
+/** 指定不允许选择的日期 */
+@property (nullable, nonatomic, copy) NSArray <NSDate *> *nonSelectableDates;
+
+/** 不允许选择日期的回调 */
+@property (nullable, nonatomic, copy) BRDateResultBlock nonSelectableBlock;
+
+/// 初始化日期选择器
+/// @param pickerMode  日期选择器显示类型
+- (instancetype)initWithPickerMode:(BRDatePickerMode)pickerMode;
+
+/// 弹出选择器视图
+- (void)show;
+
+/// 关闭选择器视图
+- (void)dismiss;
+
+
+
+
+//================================================= 华丽的分割线 =================================================
+
+
+
+
+/**
+ //////////////////////////////////////////////////////////////////////////
+ ///
+ ///   【用法二】:快捷使用,直接选择下面其中的一个方法进行使用
+ ///    特点:快捷,方便
+ ///
+ ////////////////////////////////////////////////////////////////////////*/
+
+/**
+ *  1.显示日期选择器
+ *
+ *  @param mode             日期显示类型
+ *  @param title            选择器标题
+ *  @param selectValue      默认选中的日期(默认选中当前日期)
+ *  @param resultBlock      选择结果的回调
+ *
+ */
++ (void)showDatePickerWithMode:(BRDatePickerMode)mode
+                         title:(nullable NSString *)title
+                   selectValue:(nullable NSString *)selectValue
+                   resultBlock:(nullable BRDateResultBlock)resultBlock;
+
+/**
+ *  2.显示日期选择器
+ *
+ *  @param mode             日期显示类型
+ *  @param title            选择器标题
+ *  @param selectValue      默认选中的日期(默认选中当前日期)
+ *  @param isAutoSelect     是否自动选择,即滚动选择器后就执行结果回调,默认为 NO
+ *  @param resultBlock      选择结果的回调
+ *
+ */
++ (void)showDatePickerWithMode:(BRDatePickerMode)mode
+                         title:(nullable NSString *)title
+                   selectValue:(nullable NSString *)selectValue
+                  isAutoSelect:(BOOL)isAutoSelect
+                   resultBlock:(nullable BRDateResultBlock)resultBlock;
+
+/**
+ *  3.显示日期选择器
+ *
+ *  @param mode             日期显示类型
+ *  @param title            选择器标题
+ *  @param selectValue      默认选中的日期(默认选中当前日期)
+ *  @param minDate          最小日期(可使用 NSDate+BRPickerView 分类中对应的方法进行创建)
+ *  @param maxDate          最大日期(可使用 NSDate+BRPickerView 分类中对应的方法进行创建)
+ *  @param isAutoSelect     是否自动选择,即滚动选择器后就执行结果回调,默认为 NO
+ *  @param resultBlock      选择结果的回调
+ *
+ */
++ (void)showDatePickerWithMode:(BRDatePickerMode)mode
+                         title:(nullable NSString *)title
+                   selectValue:(nullable NSString *)selectValue
+                       minDate:(nullable NSDate *)minDate
+                       maxDate:(nullable NSDate *)maxDate
+                  isAutoSelect:(BOOL)isAutoSelect
+                   resultBlock:(nullable BRDateResultBlock)resultBlock;
+
+/**
+ * 4.显示日期选择器
+ *
+ * @param mode             日期显示类型
+ * @param title            选择器标题
+ * @param selectValue      默认选中的日期(默认选中当前日期)
+ * @param minDate          最小日期(可使用 NSDate+BRPickerView 分类中对应的方法进行创建)
+ * @param maxDate          最大日期(可使用 NSDate+BRPickerView 分类中对应的方法进行创建)
+ * @param isAutoSelect     是否自动选择,即滚动选择器后就执行结果回调,默认为 NO
+ * @param resultBlock      选择结果的回调
+ * @param resultRangeBlock 范围选择结果的回调
+ *
+ */
++ (void)showDatePickerWithMode:(BRDatePickerMode)mode
+                         title:(nullable NSString *)title
+                   selectValue:(nullable NSString *)selectValue
+                       minDate:(nullable NSDate *)minDate
+                       maxDate:(nullable NSDate *)maxDate
+                  isAutoSelect:(BOOL)isAutoSelect
+                   resultBlock:(nullable BRDateResultBlock)resultBlock
+              resultRangeBlock:(nullable BRDateResultRangeBlock)resultRangeBlock;
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 2078 - 0
Pods/BRPickerView/BRPickerView/DatePicker/BRDatePickerView.m

@@ -0,0 +1,2078 @@
+//
+//  BRDatePickerView.m
+//  BRPickerViewDemo
+//
+//  Created by renbo on 2017/8/11.
+//  Copyright © 2017 irenb. All rights reserved.
+//
+//  最新代码下载地址:https://github.com/agiapp/BRPickerView
+
+#import "BRDatePickerView.h"
+#import "NSBundle+BRPickerView.h"
+#import "BRDatePickerView+BR.h"
+
+/// 日期选择器的类型
+typedef NS_ENUM(NSInteger, BRDatePickerStyle) {
+    BRDatePickerStyleSystem,   // 系统样式:使用 UIDatePicker
+    BRDatePickerStyleCustom    // 自定义样式:使用 UIPickerView
+};
+
+@interface BRDatePickerView ()<UIPickerViewDataSource, UIPickerViewDelegate>
+{
+    UIDatePickerMode _datePickerMode;
+    UIView *_containerView;
+    BOOL _isAdjustSelectRow; // 设置minDate时,调整日期联动的选择(解决日期选择器联动不正确的问题)
+}
+/** 日期选择器1 */
+@property (nonatomic, strong) UIDatePicker *datePicker;
+/** 日期选择器2 */
+@property (nonatomic, strong) UIPickerView *pickerView;
+
+/// 日期存储数组
+@property(nonatomic, copy) NSArray *yearArr;
+@property(nonatomic, copy) NSArray *monthArr;
+@property(nonatomic, copy) NSArray *dayArr;
+@property(nonatomic, copy) NSArray *hourArr;
+@property(nonatomic, copy) NSArray *minuteArr;
+@property(nonatomic, copy) NSArray *secondArr;
+
+/// 月周、年周、季度数组
+@property(nonatomic, copy) NSArray *monthWeekArr;
+@property(nonatomic, copy) NSArray *yearWeekArr;
+@property(nonatomic, copy) NSArray *quarterArr;
+
+/// 记录 年、月、日、时、分、秒 当前选择的位置
+@property(nonatomic, assign) NSInteger yearIndex;
+@property(nonatomic, assign) NSInteger monthIndex;
+@property(nonatomic, assign) NSInteger dayIndex;
+@property(nonatomic, assign) NSInteger hourIndex;
+@property(nonatomic, assign) NSInteger minuteIndex;
+@property(nonatomic, assign) NSInteger secondIndex;
+
+/// 月周、年周、季度 当前选择的位置
+@property(nonatomic, assign) NSInteger monthWeekIndex;
+@property(nonatomic, assign) NSInteger yearWeekIndex;
+@property(nonatomic, assign) NSInteger quarterIndex;
+
+// 记录滚动中的位置
+@property(nonatomic, assign) NSInteger rollingComponent;
+@property(nonatomic, assign) NSInteger rollingRow;
+
+// 记录选择的值
+@property (nonatomic, strong) NSDate *mSelectDate;
+@property (nonatomic, copy) NSString *mSelectValue;
+
+/** 日期选择器的类型 */
+@property (nonatomic, assign) BRDatePickerStyle style;
+/** 日期的格式 */
+@property (nonatomic, copy) NSString *dateFormatter;
+/** 单位数组 */
+@property (nonatomic, copy) NSArray *unitArr;
+/** 单位label数组 */
+@property (nonatomic, copy) NSArray <UILabel *> *unitLabelArr;
+
+@end
+
+@implementation BRDatePickerView
+
+#pragma mark - 1.显示日期选择器
++ (void)showDatePickerWithMode:(BRDatePickerMode)mode
+                         title:(NSString *)title
+                   selectValue:(NSString *)selectValue
+                   resultBlock:(BRDateResultBlock)resultBlock {
+    [self showDatePickerWithMode:mode title:title selectValue:selectValue minDate:nil maxDate:nil isAutoSelect:NO resultBlock:resultBlock];
+}
+
+#pragma mark - 2.显示日期选择器
++ (void)showDatePickerWithMode:(BRDatePickerMode)mode
+                         title:(NSString *)title
+                   selectValue:(NSString *)selectValue
+                  isAutoSelect:(BOOL)isAutoSelect
+                   resultBlock:(BRDateResultBlock)resultBlock {
+    [self showDatePickerWithMode:mode title:title selectValue:selectValue minDate:nil maxDate:nil isAutoSelect:isAutoSelect resultBlock:resultBlock];
+}
+
+#pragma mark - 3.显示日期选择器
++ (void)showDatePickerWithMode:(BRDatePickerMode)mode
+                         title:(NSString *)title
+                   selectValue:(NSString *)selectValue
+                       minDate:(NSDate *)minDate
+                       maxDate:(NSDate *)maxDate
+                  isAutoSelect:(BOOL)isAutoSelect
+                   resultBlock:(BRDateResultBlock)resultBlock {
+    [self showDatePickerWithMode:mode title:title selectValue:selectValue minDate:minDate maxDate:maxDate isAutoSelect:isAutoSelect resultBlock:resultBlock resultRangeBlock:nil];
+}
+
+#pragma mark - 4.显示日期选择器
++ (void)showDatePickerWithMode:(BRDatePickerMode)mode
+                         title:(NSString *)title
+                   selectValue:(NSString *)selectValue
+                       minDate:(NSDate *)minDate
+                       maxDate:(NSDate *)maxDate
+                  isAutoSelect:(BOOL)isAutoSelect
+                   resultBlock:(BRDateResultBlock)resultBlock
+                   resultRangeBlock:(BRDateResultRangeBlock)resultRangeBlock {
+    // 创建日期选择器
+    BRDatePickerView *datePickerView = [[BRDatePickerView alloc]init];
+    datePickerView.pickerMode = mode;
+    datePickerView.title = title;
+    datePickerView.selectValue = selectValue;
+    datePickerView.minDate = minDate;
+    datePickerView.maxDate = maxDate;
+    datePickerView.isAutoSelect = isAutoSelect;
+    datePickerView.resultBlock = resultBlock;
+    datePickerView.resultRangeBlock = resultRangeBlock;
+    // 显示
+    [datePickerView show];
+}
+
+#pragma mark - 初始化日期选择器
+- (instancetype)initWithPickerMode:(BRDatePickerMode)pickerMode {
+    if (self = [super init]) {
+        self.pickerMode = pickerMode;
+    }
+    return self;
+}
+
+#pragma mark - 处理选择器数据
+- (void)handlerPickerData {
+    // 1.最小日期限制
+    self.minDate = [self handlerMinDate:self.minDate];
+    // 2.最大日期限制
+    self.maxDate = [self handlerMaxDate:self.maxDate];
+    
+    BOOL minMoreThanMax = [self br_compareDate:self.minDate targetDate:self.maxDate dateFormat:self.dateFormatter] == NSOrderedDescending;
+    if (minMoreThanMax) {
+        BRErrorLog(@"最小日期不能大于最大日期!");
+        // 如果最小日期大于了最大日期,就忽略两个值
+        self.minDate = [NSDate distantPast]; // 0000-12-30 00:00:00 +0000
+        self.maxDate = [NSDate distantFuture]; // 4001-01-01 00:00:00 +0000
+    }
+    
+    // 3.默认选中的日期
+    self.mSelectDate = [self handlerSelectDate:self.selectDate dateFormat:self.dateFormatter];
+    
+    // 4.设置选择器日期数据
+    if (self.style == BRDatePickerStyleCustom) {
+        [self setupDateArray];
+    }
+    
+    if (self.selectValue && ([self.selectValue isEqualToString:self.lastRowContent] || [self.selectValue isEqualToString:self.firstRowContent])) {
+        self.mSelectDate = self.addToNow ? [NSDate date] : nil;
+    } else {
+        if (self.pickerMode == BRDatePickerModeYMDH && self.isShowAMAndPM) {
+            self.hourIndex = (self.mSelectDate.br_hour < 12 ? 0 : 1);
+            self.mSelectValue = [NSString stringWithFormat:@"%04d-%02d-%02d %@", (int)self.mSelectDate.br_year, (int)self.mSelectDate.br_month, (int)self.mSelectDate.br_day, [self getHourString]];
+        } else {
+            self.mSelectValue = [self br_stringFromDate:self.mSelectDate dateFormat:self.dateFormatter];
+        }
+    }
+}
+
+#pragma mark - 设置默认日期数据源
+- (void)setupDateArray {
+    if (self.selectValue && ([self.selectValue isEqualToString:self.lastRowContent] || [self.selectValue isEqualToString:self.firstRowContent])) {
+        switch (self.pickerMode) {
+            case BRDatePickerModeYMDHMS:
+            case BRDatePickerModeYMDHM:
+            case BRDatePickerModeYMDH:
+            case BRDatePickerModeYMD:
+            case BRDatePickerModeYM:
+            case BRDatePickerModeY:
+            {
+                self.yearArr = [self getYearArr];
+                self.monthArr = nil;
+                self.dayArr = nil;
+                self.hourArr = nil;
+                self.minuteArr = nil;
+                self.secondArr = nil;
+                self.monthWeekArr = nil;
+                self.yearWeekArr = nil;
+                self.quarterArr = nil;
+            }
+                break;
+            case BRDatePickerModeMDHM:
+            case BRDatePickerModeMD:
+            {
+                self.yearArr = [self getYearArr];
+                self.monthArr = [self getMonthArr:self.mSelectDate.br_year];
+                self.dayArr = nil;
+                self.hourArr = nil;
+                self.minuteArr = nil;
+                self.secondArr = nil;
+                self.monthWeekArr = nil;
+                self.yearWeekArr = nil;
+                self.quarterArr = nil;
+            }
+                break;
+            case BRDatePickerModeHMS:
+            case BRDatePickerModeHM:
+            {
+                self.yearArr = [self getYearArr];
+                self.monthArr = [self getMonthArr:self.mSelectDate.br_year];
+                self.dayArr = [self getDayArr:self.mSelectDate.br_year month:self.mSelectDate.br_month];
+                self.hourArr = [self getHourArr:self.mSelectDate.br_year month:self.mSelectDate.br_month day:self.mSelectDate.br_day];
+                self.minuteArr = nil;
+                self.secondArr = nil;
+                self.monthWeekArr = nil;
+                self.yearWeekArr = nil;
+                self.quarterArr = nil;
+            }
+                break;
+            case BRDatePickerModeMS:
+            {
+                self.yearArr = [self getYearArr];
+                self.monthArr = [self getMonthArr:self.mSelectDate.br_year];
+                self.dayArr = [self getDayArr:self.mSelectDate.br_year month:self.mSelectDate.br_month];
+                self.hourArr = [self getHourArr:self.mSelectDate.br_year month:self.mSelectDate.br_month day:self.mSelectDate.br_day];
+                self.minuteArr = [self getMinuteArr:self.mSelectDate.br_year month:self.mSelectDate.br_month day:self.mSelectDate.br_day hour:self.mSelectDate.br_hour];
+                self.secondArr = nil;
+                self.monthWeekArr = nil;
+                self.yearWeekArr = nil;
+                self.quarterArr = nil;
+            }
+                break;
+            case BRDatePickerModeYMW:
+            {
+                self.yearArr = [self getYearArr];
+                self.monthArr = [self getMonthArr:self.mSelectDate.br_year];
+                self.monthWeekArr = [self getMonthWeekArr:self.mSelectDate.br_year month:self.mSelectDate.br_month];
+                self.yearWeekArr = nil;
+                self.quarterArr = nil;
+                self.dayArr = nil;
+                self.hourArr = nil;
+                self.minuteArr = nil;
+                self.secondArr = nil;
+            }
+                break;
+            case BRDatePickerModeYW:
+            {
+                self.yearArr = [self getYearArr];
+                self.monthArr = nil;
+                self.monthWeekArr = nil;
+                self.yearWeekArr = [self getYearWeekArr:self.mSelectDate.br_year];
+                self.quarterArr = nil;
+                self.dayArr = nil;
+                self.hourArr = nil;
+                self.minuteArr = nil;
+                self.secondArr = nil;
+            }
+                break;
+            case BRDatePickerModeYQ:
+            {
+                self.yearArr = [self getYearArr];
+                self.monthArr = nil;
+                self.monthWeekArr = nil;
+                self.yearWeekArr = nil;
+                self.quarterArr = [self getQuarterArr:self.mSelectDate.br_year];;
+                self.dayArr = nil;
+                self.hourArr = nil;
+                self.minuteArr = nil;
+                self.secondArr = nil;
+            }
+                break;
+                
+            default:
+                break;
+        }
+    } else {
+        self.yearArr = [self getYearArr];
+        self.monthArr = [self getMonthArr:self.mSelectDate.br_year];
+        self.dayArr = [self getDayArr:self.mSelectDate.br_year month:self.mSelectDate.br_month];
+        self.hourArr = [self getHourArr:self.mSelectDate.br_year month:self.mSelectDate.br_month day:self.mSelectDate.br_day];
+        self.minuteArr = [self getMinuteArr:self.mSelectDate.br_year month:self.mSelectDate.br_month day:self.mSelectDate.br_day hour:self.mSelectDate.br_hour];
+        self.secondArr = [self getSecondArr:self.mSelectDate.br_year month:self.mSelectDate.br_month day:self.mSelectDate.br_day hour:self.mSelectDate.br_hour minute:self.mSelectDate.br_minute];
+        
+        self.monthWeekArr = [self getMonthWeekArr:self.mSelectDate.br_year month:self.mSelectDate.br_month];
+        self.yearWeekArr = [self getYearWeekArr:self.mSelectDate.br_year];
+        self.quarterArr = [self getQuarterArr:self.mSelectDate.br_year];
+    }
+}
+
+- (void)setupDateFormatter:(BRDatePickerMode)mode {
+    switch (mode) {
+        case BRDatePickerModeDate:
+        {
+            self.dateFormatter = @"yyyy-MM-dd";
+            self.style = BRDatePickerStyleSystem;
+            _datePickerMode = UIDatePickerModeDate;
+        }
+            break;
+        case BRDatePickerModeDateAndTime:
+        {
+            self.dateFormatter = @"yyyy-MM-dd HH:mm";
+            self.style = BRDatePickerStyleSystem;
+            _datePickerMode = UIDatePickerModeDateAndTime;
+        }
+            break;
+        case BRDatePickerModeTime:
+        {
+            self.dateFormatter = @"HH:mm";
+            self.style = BRDatePickerStyleSystem;
+            _datePickerMode = UIDatePickerModeTime;
+        }
+            break;
+        case BRDatePickerModeCountDownTimer:
+        {
+            self.dateFormatter = @"HH:mm";
+            self.style = BRDatePickerStyleSystem;
+            _datePickerMode = UIDatePickerModeCountDownTimer;
+        }
+            break;
+            
+        case BRDatePickerModeYMDHMS:
+        {
+            self.dateFormatter = @"yyyy-MM-dd HH:mm:ss";
+            self.style = BRDatePickerStyleCustom;
+            self.unitArr = @[[self getYearUnit], [self getMonthUnit], [self getDayUnit], [self getHourUnit], [self getMinuteUnit], [self getSecondUnit]];
+        }
+            break;
+        case BRDatePickerModeYMDHM:
+        {
+            self.dateFormatter = @"yyyy-MM-dd HH:mm";
+            self.style = BRDatePickerStyleCustom;
+            self.unitArr = @[[self getYearUnit], [self getMonthUnit], [self getDayUnit], [self getHourUnit], [self getMinuteUnit]];
+        }
+            break;
+        case BRDatePickerModeYMDH:
+        {
+            self.dateFormatter = @"yyyy-MM-dd HH";
+            self.style = BRDatePickerStyleCustom;
+            self.unitArr = @[[self getYearUnit], [self getMonthUnit], [self getDayUnit], self.pickerMode == BRDatePickerModeYMDH && self.isShowAMAndPM ? @"" : [self getHourUnit]];
+        }
+            break;
+        case BRDatePickerModeMDHM:
+        {
+            self.dateFormatter = @"MM-dd HH:mm";
+            self.style = BRDatePickerStyleCustom;
+            self.unitArr = @[[self getMonthUnit], [self getDayUnit], [self getHourUnit], [self getMinuteUnit]];
+        }
+            break;
+        case BRDatePickerModeYMD:
+        {
+            self.dateFormatter = @"yyyy-MM-dd";
+            self.style = BRDatePickerStyleCustom;
+            self.unitArr = @[[self getYearUnit], [self getMonthUnit], [self getDayUnit]];
+        }
+            break;
+        case BRDatePickerModeYM:
+        {
+            self.dateFormatter = @"yyyy-MM";
+            self.style = BRDatePickerStyleCustom;
+            self.unitArr = @[[self getYearUnit], [self getMonthUnit]];
+        }
+            break;
+        case BRDatePickerModeY:
+        {
+            self.dateFormatter = @"yyyy";
+            self.style = BRDatePickerStyleCustom;
+            self.unitArr = @[[self getYearUnit]];
+        }
+            break;
+        case BRDatePickerModeMD:
+        {
+            self.dateFormatter = @"MM-dd";
+            self.style = BRDatePickerStyleCustom;
+            self.unitArr = @[[self getMonthUnit], [self getDayUnit]];
+        }
+            break;
+        case BRDatePickerModeHMS:
+        {
+            self.dateFormatter = @"HH:mm:ss";
+            self.style = BRDatePickerStyleCustom;
+            self.unitArr = @[[self getHourUnit], [self getMinuteUnit], [self getSecondUnit]];
+        }
+            break;
+        case BRDatePickerModeHM:
+        {
+            self.dateFormatter = @"HH:mm";
+            self.style = BRDatePickerStyleCustom;
+            self.unitArr = @[[self getHourUnit], [self getMinuteUnit]];
+        }
+            break;
+        case BRDatePickerModeMS:
+        {
+            self.dateFormatter = @"mm:ss";
+            self.style = BRDatePickerStyleCustom;
+            self.unitArr = @[[self getMinuteUnit], [self getSecondUnit]];
+        }
+            break;
+        case BRDatePickerModeYMW:
+        {
+            self.dateFormatter = @"yyyy-MM-WW";
+            self.style = BRDatePickerStyleCustom;
+            self.unitArr = @[[self getYearUnit], [self getMonthUnit], [self getWeekUnit]];
+        }
+            break;
+        case BRDatePickerModeYW:
+        {
+            self.dateFormatter = @"yyyy-ww";
+            self.style = BRDatePickerStyleCustom;
+            self.unitArr = @[[self getYearUnit], [self getWeekUnit]];
+        }
+            break;
+        case BRDatePickerModeYQ:
+        {
+            self.dateFormatter = @"yyyy-qq";
+            self.style = BRDatePickerStyleCustom;
+            self.unitArr = @[[self getYearUnit], [self getQuarterUnit]];
+        }
+            break;
+            
+        default:
+            break;
+    }
+}
+
+#pragma mark - 更新日期数据源数组
+- (void)reloadDateArrayWithUpdateMonth:(BOOL)updateMonth
+                             updateDay:(BOOL)updateDay
+                            updateHour:(BOOL)updateHour
+                          updateMinute:(BOOL)updateMinute
+                          updateSecond:(BOOL)updateSecond {
+    [self reloadDateArrayWithUpdateMonth:updateMonth updateDay:updateDay updateHour:updateHour updateMinute:updateMinute updateSecond:updateSecond updateWeekOfMonth:NO updateWeekOfYear:NO updateQuarter:NO];
+}
+
+- (void)reloadDateArrayWithUpdateMonth:(BOOL)updateMonth
+                             updateDay:(BOOL)updateDay
+                            updateHour:(BOOL)updateHour
+                          updateMinute:(BOOL)updateMinute
+                          updateSecond:(BOOL)updateSecond
+                     updateWeekOfMonth:(BOOL)updateWeekOfMonth
+                      updateWeekOfYear:(BOOL)updateWeekOfYear
+                         updateQuarter:(BOOL)updateQuarter {
+    _isAdjustSelectRow = NO;
+    // 1.更新 monthArr
+    if (self.yearArr.count == 0) {
+        return;
+    }
+    NSString *yearString = [self getYearString];
+    if ((self.lastRowContent && [yearString isEqualToString:self.lastRowContent]) || (self.firstRowContent && [yearString isEqualToString:self.firstRowContent])) {
+        self.monthArr = nil;
+        self.dayArr = nil;
+        self.hourArr = nil;
+        self.minuteArr = nil;
+        self.secondArr = nil;
+        self.monthWeekArr = nil;
+        self.yearWeekArr = nil;
+        self.quarterArr = nil;
+        
+        return;
+    }
+    if (updateMonth) {
+        NSString *lastSelectMonth = [self getMDHMSNumber:self.mSelectDate.br_month];
+        self.monthArr = [self getMonthArr:[yearString integerValue]];
+        if (self.mSelectDate) {
+            if ([self.monthArr containsObject:lastSelectMonth]) {
+                NSInteger monthIndex = [self.monthArr indexOfObject:lastSelectMonth];
+                if (monthIndex != self.monthIndex) {
+                    _isAdjustSelectRow = YES;
+                    self.monthIndex = monthIndex;
+                }
+            } else {
+                _isAdjustSelectRow = YES;
+                self.monthIndex = ([lastSelectMonth intValue] < [self.monthArr.firstObject intValue]) ? 0 : (self.monthArr.count - 1);
+            }
+        }
+    }
+    
+    // 1/1.更新 yearWeekArr
+    if (updateWeekOfYear) {
+        NSString *lastSelectWeekOfYear = [self getMDHMSNumber:self.mSelectDate.br_yearWeek];
+        self.yearWeekArr = [self getYearWeekArr:[yearString integerValue]];
+        if (self.mSelectDate) {
+            if ([self.yearWeekArr containsObject:lastSelectWeekOfYear]) {
+                NSInteger yearWeekIndex = [self.yearWeekArr indexOfObject:lastSelectWeekOfYear];
+                if (yearWeekIndex != self.yearWeekIndex) {
+                    _isAdjustSelectRow = YES;
+                    self.monthIndex = yearWeekIndex;
+                }
+            } else {
+                _isAdjustSelectRow = YES;
+                self.yearWeekIndex = ([lastSelectWeekOfYear intValue] < [self.yearWeekArr.firstObject intValue]) ? 0 : (self.yearWeekArr.count - 1);
+            }
+        }
+    }
+    
+    // 1/1.更新 quarterArr
+    if (updateQuarter) {
+        NSString *lastSelectQuarter = [self getMDHMSNumber:self.mSelectDate.br_quarter];
+        self.quarterArr = [self getQuarterArr:[yearString integerValue]];
+        if (self.mSelectDate) {
+            if ([self.quarterArr containsObject:lastSelectQuarter]) {
+                NSInteger quarterIndex = [self.quarterArr indexOfObject:lastSelectQuarter];
+                if (quarterIndex != self.quarterIndex) {
+                    _isAdjustSelectRow = YES;
+                    self.quarterIndex = quarterIndex;
+                }
+            } else {
+                _isAdjustSelectRow = YES;
+                self.quarterIndex = ([lastSelectQuarter intValue] < [self.quarterArr.firstObject intValue]) ? 0 : (self.quarterArr.count - 1);
+            }
+        }
+    }
+    
+    // 2.更新 dayArr
+    if (self.monthArr.count == 0) {
+        return;
+    }
+    NSString *monthString = [self getMonthString];
+    if ((self.lastRowContent && [monthString isEqualToString:self.lastRowContent]) || (self.firstRowContent && [monthString isEqualToString:self.firstRowContent])) {
+        self.dayArr = nil;
+        self.hourArr = nil;
+        self.minuteArr = nil;
+        self.secondArr = nil;
+        self.monthWeekArr = nil;
+        
+        return;
+    }
+    if (updateDay) {
+        NSString *lastSelectDay = [self getMDHMSNumber:self.mSelectDate.br_day];
+        self.dayArr = [self getDayArr:[yearString integerValue] month:[monthString integerValue]];
+        if (self.mSelectDate) {
+            if ([self.dayArr containsObject:lastSelectDay]) {
+                NSInteger dayIndex = [self.dayArr indexOfObject:lastSelectDay];
+                if (dayIndex != self.dayIndex) {
+                    _isAdjustSelectRow = YES;
+                    self.dayIndex = dayIndex;
+                }
+            } else {
+                _isAdjustSelectRow = YES;
+                self.dayIndex = ([lastSelectDay intValue] < [self.dayArr.firstObject intValue]) ? 0 : (self.dayArr.count - 1);
+            }
+        }
+    }
+    
+    // 2/1.更新 monthWeekArr
+    if (updateWeekOfMonth) {
+        NSString *lastWeekOfMonth = [self getMDHMSNumber:self.mSelectDate.br_monthWeek];
+        self.monthWeekArr = [self getMonthWeekArr:[yearString integerValue] month:[monthString integerValue]];
+        if (self.mSelectDate) {
+            if ([self.monthWeekArr containsObject:lastWeekOfMonth]) {
+                NSInteger monthWeekIndex = [self.monthWeekArr indexOfObject:lastWeekOfMonth];
+                if (monthWeekIndex != self.monthWeekIndex) {
+                    _isAdjustSelectRow = YES;
+                    self.monthWeekIndex = monthWeekIndex;
+                }
+            } else {
+                _isAdjustSelectRow = YES;
+                self.monthWeekIndex = ([lastWeekOfMonth intValue] < [self.monthWeekArr.firstObject intValue]) ? 0 : (self.monthWeekArr.count - 1);
+            }
+        }
+    }
+    
+    // 3.更新 hourArr
+    if (self.dayArr.count == 0) {
+        return;
+    }
+    NSInteger day = [[self getDayString] integerValue];
+    if (updateHour) {
+        NSString *lastSelectHour = [self getMDHMSNumber:self.mSelectDate.br_hour];
+        self.hourArr = [self getHourArr:[yearString integerValue] month:[monthString integerValue] day:day];
+        if (self.mSelectDate) {
+            if ([self.hourArr containsObject:lastSelectHour]) {
+                NSInteger hourIndex = [self.hourArr indexOfObject:lastSelectHour];
+                if (hourIndex != self.hourIndex) {
+                    _isAdjustSelectRow = YES;
+                    self.hourIndex = hourIndex;
+                }
+            } else {
+                _isAdjustSelectRow = YES;
+                self.hourIndex = ([lastSelectHour intValue] < [self.hourArr.firstObject intValue]) ? 0 : (self.hourArr.count - 1);
+            }
+        }
+    }
+    
+    // 4.更新 minuteArr
+    if (self.hourArr.count == 0) {
+        return;
+    }
+    NSString *hourString = [self getHourString];
+    if ((self.lastRowContent && [hourString isEqualToString:self.lastRowContent]) || (self.firstRowContent && [hourString isEqualToString:self.firstRowContent])) {
+        self.minuteArr = nil;
+        self.secondArr = nil;
+        
+        return;
+    }
+    if (updateMinute) {
+        NSString *lastSelectMinute = [self getMDHMSNumber:self.mSelectDate.br_minute];
+        self.minuteArr = [self getMinuteArr:[yearString integerValue] month:[monthString integerValue] day:day hour:[hourString integerValue]];
+        if (self.mSelectDate) {
+            if ([self.minuteArr containsObject:lastSelectMinute]) {
+                NSInteger minuteIndex = [self.minuteArr indexOfObject:lastSelectMinute];
+                if (minuteIndex != self.minuteIndex) {
+                    _isAdjustSelectRow = YES;
+                    self.minuteIndex = minuteIndex;
+                }
+            } else {
+                _isAdjustSelectRow = YES;
+                self.minuteIndex = ([lastSelectMinute intValue] < [self.minuteArr.firstObject intValue]) ? 0 : (self.minuteArr.count - 1);
+            }
+        }
+    }
+    
+    // 5.更新 secondArr
+    if (self.minuteArr.count == 0) {
+        return;
+    }
+    NSString *minuteString = [self getMinuteString];
+    if ((self.lastRowContent && [minuteString isEqualToString:self.lastRowContent]) || (self.firstRowContent && [minuteString isEqualToString:self.firstRowContent])) {
+        self.secondArr = nil;
+        return;
+    }
+    if (updateSecond) {
+        NSString *lastSelectSecond = [self getMDHMSNumber:self.mSelectDate.br_second];
+        self.secondArr = [self getSecondArr:[yearString integerValue] month:[monthString integerValue] day:day hour:[hourString integerValue] minute:[minuteString integerValue]];
+        if (self.mSelectDate) {
+            if ([self.secondArr containsObject:lastSelectSecond]) {
+                NSInteger secondIndex = [self.secondArr indexOfObject:lastSelectSecond];
+                if (secondIndex != self.secondIndex) {
+                    _isAdjustSelectRow = YES;
+                    self.secondIndex = secondIndex;
+                }
+            } else {
+                _isAdjustSelectRow = YES;
+                self.secondIndex = ([lastSelectSecond intValue] < [self.secondArr.firstObject intValue]) ? 0 : (self.secondArr.count - 1);
+            }
+        }
+    }
+}
+
+#pragma mark - 滚动到指定日期的位置(更新选择的索引)
+- (void)scrollToSelectDate:(NSDate *)selectDate animated:(BOOL)animated {
+    self.yearIndex = [self getIndexWithArray:self.yearArr object:[self getYearNumber:selectDate.br_year]];
+    self.monthIndex = [self getIndexWithArray:self.monthArr object:[self getMDHMSNumber:selectDate.br_month]];
+    self.dayIndex = [self getIndexWithArray:self.dayArr object:[self getMDHMSNumber:selectDate.br_day]];
+    if (self.pickerMode == BRDatePickerModeYMDH && self.isShowAMAndPM) {
+        self.hourIndex = selectDate.br_hour < 12 ? 0 : 1;
+    } else {
+        NSInteger hour = selectDate.br_hour;
+        // 如果是12小时制,hour的最小值为1;hour的最大值为12
+        if (self.isTwelveHourMode) {
+            if (hour < 1) {
+                hour = 1;
+            } else if (hour > 12) {
+                hour = hour - 12;
+            }
+        }
+        self.hourIndex = [self getIndexWithArray:self.hourArr object:[self getMDHMSNumber:hour]];
+    }
+    self.minuteIndex = [self getIndexWithArray:self.minuteArr object:[self getMDHMSNumber:selectDate.br_minute]];
+    self.secondIndex = [self getIndexWithArray:self.secondArr object:[self getMDHMSNumber:selectDate.br_second]];
+    
+    NSArray *indexArr = nil;
+    if (self.pickerMode == BRDatePickerModeYMDHMS) {
+        indexArr = @[@(self.yearIndex), @(self.monthIndex), @(self.dayIndex), @(self.hourIndex), @(self.minuteIndex), @(self.secondIndex)];
+    } else if (self.pickerMode == BRDatePickerModeYMDHM) {
+        indexArr = @[@(self.yearIndex), @(self.monthIndex), @(self.dayIndex), @(self.hourIndex), @(self.minuteIndex)];
+    } else if (self.pickerMode == BRDatePickerModeYMDH) {
+        indexArr = @[@(self.yearIndex), @(self.monthIndex), @(self.dayIndex), @(self.hourIndex)];
+    } else if (self.pickerMode == BRDatePickerModeMDHM) {
+        indexArr = @[@(self.monthIndex), @(self.dayIndex), @(self.hourIndex), @(self.minuteIndex)];
+    } else if (self.pickerMode == BRDatePickerModeYMD) {
+        if ([self.pickerStyle.language hasPrefix:@"zh"]) {
+            indexArr = @[@(self.yearIndex), @(self.monthIndex), @(self.dayIndex)];
+        } else {
+            indexArr = @[@(self.dayIndex), @(self.monthIndex), @(self.yearIndex)];
+        }
+    } else if (self.pickerMode == BRDatePickerModeYM) {
+        if ([self.pickerStyle.language hasPrefix:@"zh"]) {
+            indexArr = @[@(self.yearIndex), @(self.monthIndex)];
+        } else {
+            indexArr = @[@(self.monthIndex), @(self.yearIndex)];
+        }
+    } else if (self.pickerMode == BRDatePickerModeY) {
+        indexArr = @[@(self.yearIndex)];
+    } else if (self.pickerMode == BRDatePickerModeMD) {
+        indexArr = @[@(self.monthIndex), @(self.dayIndex)];
+    } else if (self.pickerMode == BRDatePickerModeHMS) {
+        indexArr = @[@(self.hourIndex), @(self.minuteIndex), @(self.secondIndex)];
+    } else if (self.pickerMode == BRDatePickerModeHM) {
+        indexArr = @[@(self.hourIndex), @(self.minuteIndex)];
+    } else if (self.pickerMode == BRDatePickerModeMS) {
+        indexArr = @[@(self.minuteIndex), @(self.secondIndex)];
+    } else if (self.pickerMode == BRDatePickerModeYMW) {
+        indexArr = @[@(self.yearIndex), @(self.monthIndex), @(self.monthWeekIndex)];
+    } else if (self.pickerMode == BRDatePickerModeYW) {
+        indexArr = @[@(self.yearIndex), @(self.yearWeekIndex)];
+    } else if (self.pickerMode == BRDatePickerModeYQ) {
+        indexArr = @[@(self.yearIndex), @(self.quarterIndex)];
+    }
+    if (!indexArr) return;
+    for (NSInteger i = 0; i < indexArr.count; i++) {
+        [self.pickerView selectRow:[indexArr[i] integerValue] inComponent:i animated:animated];
+    }
+}
+
+#pragma mark - 滚动到【自定义字符串】的位置
+- (void)scrollToCustomString:(BOOL)animated {
+    switch (self.pickerMode) {
+        case BRDatePickerModeYMDHMS:
+        case BRDatePickerModeYMDHM:
+        case BRDatePickerModeYMDH:
+        case BRDatePickerModeYMD:
+        case BRDatePickerModeYM:
+        case BRDatePickerModeY:
+        case BRDatePickerModeYMW:
+        case BRDatePickerModeYW:
+        case BRDatePickerModeYQ:
+        {
+            NSInteger yearIndex = ([self.selectValue isEqualToString:self.lastRowContent] && self.yearArr.count > 0) ? self.yearArr.count - 1 : 0;
+            NSInteger component = 0;
+            if ((self.pickerMode == BRDatePickerModeYMD || self.pickerMode == BRDatePickerModeYMW) && ![self.pickerStyle.language hasPrefix:@"zh"]) {
+                component = 2;
+            } else if ((self.pickerMode == BRDatePickerModeYM || self.pickerMode == BRDatePickerModeYQ) && ![self.pickerStyle.language hasPrefix:@"zh"]) {
+                component = 1;
+            }
+            [self.pickerView selectRow:yearIndex inComponent:component animated:animated];
+        }
+            break;
+        case BRDatePickerModeMDHM:
+        case BRDatePickerModeMD:
+        {
+            NSInteger monthIndex = ([self.selectValue isEqualToString:self.lastRowContent] && self.monthArr.count > 0) ? self.monthArr.count - 1 : 0;
+            [self.pickerView selectRow:monthIndex inComponent:0 animated:animated];
+        }
+            break;
+        case BRDatePickerModeHMS:
+        case BRDatePickerModeHM:
+        {
+            NSInteger hourIndex = ([self.selectValue isEqualToString:self.lastRowContent] && self.hourArr.count > 0) ? self.hourArr.count - 1 : 0;
+            [self.pickerView selectRow:hourIndex inComponent:0 animated:animated];
+        }
+            break;
+        case BRDatePickerModeMS:
+        {
+            NSInteger minuteIndex = ([self.selectValue isEqualToString:self.lastRowContent] && self.minuteArr.count > 0) ? self.minuteArr.count - 1 : 0;
+            [self.pickerView selectRow:minuteIndex inComponent:0 animated:animated];
+        }
+            break;
+            
+        default:
+            break;
+    }
+}
+
+#pragma mark - 日期选择器1
+- (UIDatePicker *)datePicker {
+    if (!_datePicker) {
+        CGFloat pickerHeaderViewHeight = self.pickerHeaderView ? self.pickerHeaderView.bounds.size.height : 0;
+        _datePicker = [[UIDatePicker alloc]initWithFrame:CGRectMake(0, self.pickerStyle.titleBarHeight + pickerHeaderViewHeight, self.keyView.bounds.size.width, self.pickerStyle.pickerHeight)];
+        _datePicker.backgroundColor = self.pickerStyle.pickerColor;
+        _datePicker.autoresizingMask = UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth;
+        // 滚动改变值的响应事件
+        [_datePicker addTarget:self action:@selector(didSelectValueChanged:) forControlEvents:UIControlEventValueChanged];
+    }
+    return _datePicker;
+}
+
+#pragma mark - 日期选择器2
+- (UIPickerView *)pickerView {
+    if (!_pickerView) {
+        CGFloat pickerHeaderViewHeight = self.pickerHeaderView ? self.pickerHeaderView.bounds.size.height : 0;
+        _pickerView = [[UIPickerView alloc]initWithFrame:CGRectMake(0, self.pickerStyle.titleBarHeight + pickerHeaderViewHeight, self.keyView.bounds.size.width, self.pickerStyle.pickerHeight)];
+        _pickerView.backgroundColor = self.pickerStyle.pickerColor;
+        _pickerView.autoresizingMask = UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth;
+        _pickerView.dataSource = self;
+        _pickerView.delegate = self;
+    }
+    return _pickerView;
+}
+
+#pragma mark - UIPickerViewDataSource
+// 1.返回组件数量
+- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView {
+    if (self.pickerMode == BRDatePickerModeYMDHMS) {
+        return 6;
+    } else if (self.pickerMode == BRDatePickerModeYMDHM) {
+        return 5;
+    } else if (self.pickerMode == BRDatePickerModeYMDH) {
+        return 4;
+    } else if (self.pickerMode == BRDatePickerModeMDHM) {
+        return 4;
+    } else if (self.pickerMode == BRDatePickerModeYMD) {
+        return 3;
+    } else if (self.pickerMode == BRDatePickerModeYM) {
+        return 2;
+    } else if (self.pickerMode == BRDatePickerModeY) {
+        return 1;
+    } else if (self.pickerMode == BRDatePickerModeMD) {
+        return 2;
+    } else if (self.pickerMode == BRDatePickerModeHMS) {
+        return 3;
+    } else if (self.pickerMode == BRDatePickerModeHM) {
+        return 2;
+    } else if (self.pickerMode == BRDatePickerModeMS) {
+        return 2;
+    } else if (self.pickerMode == BRDatePickerModeYMW) {
+        return 3;
+    } else if (self.pickerMode == BRDatePickerModeYW) {
+        return 2;
+    } else if (self.pickerMode == BRDatePickerModeYQ) {
+        return 2;
+    }
+    return 0;
+}
+
+// 2.返回每个组件的行数
+- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component {
+    NSArray *rowsArr = [NSArray array];
+    if (self.pickerMode == BRDatePickerModeYMDHMS) {
+        rowsArr = @[@(self.yearArr.count), @(self.monthArr.count), @(self.dayArr.count), @(self.hourArr.count), @(self.minuteArr.count), @(self.secondArr.count)];
+    } else if (self.pickerMode == BRDatePickerModeYMDHM) {
+        rowsArr = @[@(self.yearArr.count), @(self.monthArr.count), @(self.dayArr.count), @(self.hourArr.count), @(self.minuteArr.count)];
+    } else if (self.pickerMode == BRDatePickerModeYMDH) {
+        rowsArr = @[@(self.yearArr.count), @(self.monthArr.count), @(self.dayArr.count), @(self.hourArr.count)];
+    } else if (self.pickerMode == BRDatePickerModeMDHM) {
+        rowsArr = @[@(self.monthArr.count), @(self.dayArr.count), @(self.hourArr.count), @(self.minuteArr.count)];
+    } else if (self.pickerMode == BRDatePickerModeYMD) {
+        if ([self.pickerStyle.language hasPrefix:@"zh"]) {
+            rowsArr = @[@(self.yearArr.count), @(self.monthArr.count), @(self.dayArr.count)];
+        } else {
+            rowsArr = @[@(self.dayArr.count), @(self.monthArr.count), @(self.yearArr.count)];
+        }
+    } else if (self.pickerMode == BRDatePickerModeYM) {
+        if ([self.pickerStyle.language hasPrefix:@"zh"]) {
+            rowsArr = @[@(self.yearArr.count), @(self.monthArr.count)];
+        } else {
+            rowsArr = @[@(self.monthArr.count), @(self.yearArr.count)];
+        }
+    } else if (self.pickerMode == BRDatePickerModeY) {
+        rowsArr = @[@(self.yearArr.count)];
+    } else if (self.pickerMode == BRDatePickerModeMD) {
+        rowsArr = @[@(self.monthArr.count), @(self.dayArr.count)];
+    } else if (self.pickerMode == BRDatePickerModeHMS) {
+        rowsArr = @[@(self.hourArr.count), @(self.minuteArr.count), @(self.secondArr.count)];
+    } else if (self.pickerMode == BRDatePickerModeHM) {
+        rowsArr = @[@(self.hourArr.count), @(self.minuteArr.count)];
+    } else if (self.pickerMode == BRDatePickerModeMS) {
+        rowsArr = @[@(self.minuteArr.count), @(self.secondArr.count)];
+    } else if (self.pickerMode == BRDatePickerModeYMW) {
+        rowsArr = @[@(self.yearArr.count), @(self.monthArr.count), @(self.monthWeekArr.count)];
+    } else if (self.pickerMode == BRDatePickerModeYW) {
+        rowsArr = @[@(self.yearArr.count), @(self.yearWeekArr.count)];
+    } else if (self.pickerMode == BRDatePickerModeYQ) {
+        rowsArr = @[@(self.yearArr.count), @(self.quarterArr.count)];
+    }
+    if (component >= 0 && component < rowsArr.count) {
+        return [rowsArr[component] integerValue];
+    }
+    return 0;
+}
+
+#pragma mark - UIPickerViewDelegate
+// 3. 设置 pickerView 的显示内容
+- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(nullable UIView *)view {
+    // 1.自定义 row 的内容视图
+    UILabel *label = (UILabel *)view;
+    if (!label) {
+        label = [[UILabel alloc]init];
+        label.backgroundColor = [UIColor clearColor];
+        label.textAlignment = NSTextAlignmentCenter;
+        label.font = self.pickerStyle.pickerTextFont;
+        label.textColor = self.pickerStyle.pickerTextColor;
+        label.numberOfLines = self.pickerStyle.maxTextLines;
+        // 字体自适应属性
+        label.adjustsFontSizeToFitWidth = YES;
+        // 自适应最小字体缩放比例
+        label.minimumScaleFactor = 0.5f;
+    }
+    label.text = [self pickerView:pickerView titleForRow:row forComponent:component];
+    
+    // 优化末列文本显示:处理时间类型为 BRDatePickerModeYMDHMS 时,最后一列的「秒」溢出屏幕外显示不全的情况
+    if (self.pickerMode == BRDatePickerModeYMDHMS && component == pickerView.numberOfComponents - 1) {
+        NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
+        paragraphStyle.alignment = NSTextAlignmentCenter; // 文本居中对齐
+        paragraphStyle.tailIndent = self.showUnitType == BRShowUnitTypeOnlyCenter ? -40 : -25; // 右侧缩进25点(负值表示从右边界向左缩进)
+        paragraphStyle.lineBreakMode = NSLineBreakByTruncatingTail; // 显示不下时,右侧显示省略号
+        NSDictionary *attributes = @{ NSParagraphStyleAttributeName: paragraphStyle, NSFontAttributeName: self.pickerStyle.pickerTextFont };
+        NSAttributedString *attributedText = [[NSAttributedString alloc] initWithString:label.text attributes:attributes];
+        label.attributedText = attributedText;
+    }
+    
+    // 2.设置选择器中间选中行的样式
+    [self.pickerStyle setupPickerSelectRowStyle:pickerView titleForRow:row forComponent:component];
+    
+    // 3.记录选择器滚动过程中选中的列和行
+    [self handlePickerViewRollingStatus:pickerView component:component];
+
+    return label;
+}
+
+#pragma mark - 处理选择器滚动状态
+- (void)handlePickerViewRollingStatus:(UIPickerView *)pickerView component:(NSInteger)component {
+    // 获取选择器组件滚动中选中的行
+    NSInteger selectRow = [pickerView selectedRowInComponent:component];
+    if (selectRow >= 0) {
+        self.rollingComponent = component;
+        // 根据滚动方向动态计算 rollingRow
+        NSInteger lastRow = self.rollingRow;
+        // 调整偏移量:当用户快速滚动并点击确定按钮时,可能导致选择不准确。这里简单的实现向前/向后多滚动一行(也可以根据滚动速度来调整偏移量)
+        NSInteger offset = 1;
+        if (lastRow >= 0) {
+            // 向上滚动
+            if (selectRow > lastRow) {
+                self.rollingRow = selectRow + offset;
+            } else if (selectRow < lastRow) {
+                // 向下滚动
+                self.rollingRow = selectRow - offset;
+            } else {
+                // 保持当前位置
+                self.rollingRow = selectRow;
+            }
+        } else {
+            // 首次滚动,默认向上滚动
+            self.rollingRow = selectRow + offset;
+        }
+    }
+}
+
+// 返回每行的标题
+- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component {
+    NSString *titleString = @"";
+    if (self.pickerMode == BRDatePickerModeYMDHMS) {
+        if (component == 0) {
+            titleString = [self getYearText:self.yearArr row:row];
+        } else if (component == 1) {
+            titleString = [self getMonthText:self.monthArr row:row];
+        } else if (component == 2) {
+            titleString = [self getDayText:self.dayArr row:row mSelectDate:self.mSelectDate];
+        } else if (component == 3) {
+            titleString = [self getHourText:self.hourArr row:row];
+        } else if (component == 4) {
+            titleString = [self getMinuteText:self.minuteArr row:row];
+        } else if (component == 5) {
+            titleString = [self getSecondText:self.secondArr row:row];
+        }
+    } else if (self.pickerMode == BRDatePickerModeYMDHM) {
+        if (component == 0) {
+            titleString = [self getYearText:self.yearArr row:row];
+        } else if (component == 1) {
+            titleString = [self getMonthText:self.monthArr row:row];
+        } else if (component == 2) {
+            titleString = [self getDayText:self.dayArr row:row mSelectDate:self.mSelectDate];
+        } else if (component == 3) {
+            titleString = [self getHourText:self.hourArr row:row];
+        } else if (component == 4) {
+            titleString = [self getMinuteText:self.minuteArr row:row];
+        }
+    } else if (self.pickerMode == BRDatePickerModeYMDH) {
+        if (component == 0) {
+            titleString = [self getYearText:self.yearArr row:row];;
+        } else if (component == 1) {
+            titleString = [self getMonthText:self.monthArr row:row];
+        } else if (component == 2) {
+            titleString = [self getDayText:self.dayArr row:row mSelectDate:self.mSelectDate];
+        } else if (component == 3) {
+            titleString = [self getHourText:self.hourArr row:row];
+        }
+    } else if (self.pickerMode == BRDatePickerModeMDHM) {
+        if (component == 0) {
+            titleString = [self getMonthText:self.monthArr row:row];
+        } else if (component == 1) {
+            titleString = [self getDayText:self.dayArr row:row mSelectDate:self.mSelectDate];
+        } else if (component == 2) {
+            titleString = [self getHourText:self.hourArr row:row];
+        } else if (component == 3) {
+            titleString = [self getMinuteText:self.minuteArr row:row];
+        }
+    } else if (self.pickerMode == BRDatePickerModeYMD) {
+        if (component == 0) {
+            titleString = [self.pickerStyle.language hasPrefix:@"zh"] ? [self getYearText:self.yearArr row:row] : [self getDayText:self.dayArr row:row mSelectDate:self.mSelectDate];
+        } else if (component == 1) {
+            titleString = [self getMonthText:self.monthArr row:row];
+        } else if (component == 2) {
+            titleString = [self.pickerStyle.language hasPrefix:@"zh"] ? [self getDayText:self.dayArr row:row mSelectDate:self.mSelectDate] : [self getYearText:self.yearArr row:row];
+        }
+    } else if (self.pickerMode == BRDatePickerModeYM) {
+        if (component == 0) {
+            titleString = [self.pickerStyle.language hasPrefix:@"zh"] ? [self getYearText:self.yearArr row:row] : [self getMonthText:self.monthArr row:row];
+        } else if (component == 1) {
+            titleString = [self.pickerStyle.language hasPrefix:@"zh"] ? [self getMonthText:self.monthArr row:row] : [self getYearText:self.yearArr row:row];
+        }
+    } else if (self.pickerMode == BRDatePickerModeY) {
+        if (component == 0) {
+            titleString = [self getYearText:self.yearArr row:row];
+        }
+    } else if (self.pickerMode == BRDatePickerModeMD) {
+        if (component == 0) {
+            titleString = [self getMonthText:self.monthArr row:row];
+        } else if (component == 1) {
+            titleString = [self getDayText:self.dayArr row:row mSelectDate:self.mSelectDate];
+        }
+    } else if (self.pickerMode == BRDatePickerModeHMS) {
+        if (component == 0) {
+            titleString = [self getHourText:self.hourArr row:row];
+        } else if (component == 1) {
+            titleString = [self getMinuteText:self.minuteArr row:row];
+        } else if (component == 2) {
+            titleString = [self getSecondText:self.secondArr row:row];
+        }
+    } else if (self.pickerMode == BRDatePickerModeHM) {
+        if (component == 0) {
+            titleString = [self getHourText:self.hourArr row:row];
+        } else if (component == 1) {
+            titleString = [self getMinuteText:self.minuteArr row:row];
+        }
+    } else if (self.pickerMode == BRDatePickerModeMS) {
+        if (component == 0) {
+            titleString = [self getMinuteText:self.minuteArr row:row];
+        } else if (component == 1) {
+            titleString = [self getSecondText:self.secondArr row:row];
+        }
+    } else if (self.pickerMode == BRDatePickerModeYMW) {
+        if (component == 0) {
+            titleString = [self getYearText:self.yearArr row:row];
+        } else if (component == 1) {
+            titleString = [self getMonthText:self.monthArr row:row];
+        } else if (component == 2) {
+            titleString = [self getWeekText:self.monthWeekArr row:row];
+        }
+    } else if (self.pickerMode == BRDatePickerModeYW) {
+        if (component == 0) {
+            titleString = [self getYearText:self.yearArr row:row];
+        } else if (component == 1) {
+            titleString = [self getWeekText:self.yearWeekArr row:row];
+        }
+    } else if (self.pickerMode == BRDatePickerModeYQ) {
+        if (component == 0) {
+            titleString = [self getYearText:self.yearArr row:row];
+        } else if (component == 1) {
+            titleString = [self getQuarterText:self.quarterArr row:row];
+        }
+    }
+    
+    return titleString;
+}
+
+// 获取选择器是否滚动中状态
+- (BOOL)getRollingStatus:(UIView *)view {
+    if ([view isKindOfClass:[UIScrollView class]]) {
+        UIScrollView *scrollView = (UIScrollView *)view;
+        if (scrollView.dragging || scrollView.decelerating) {
+            // 如果 UIPickerView 正在拖拽或正在减速,返回YES
+            return YES;
+        }
+    }
+    
+    for (UIView *subView in view.subviews) {
+        if ([self getRollingStatus:subView]) {
+            return YES;
+        }
+    }
+    
+    return NO;
+}
+
+// 选择器是否正在滚动
+- (BOOL)isRolling {
+    if (self.style == BRDatePickerStyleSystem) {
+        return [self getRollingStatus:self.datePicker];
+    } else if (self.style == BRDatePickerStyleCustom) {
+        return [self getRollingStatus:self.pickerView];
+    }
+    return NO;
+}
+
+// 4.滚动 pickerView 完成,执行的回调方法
+- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {
+    NSString *lastSelectValue = self.mSelectValue;
+    NSDate *lastSelectDate = self.mSelectDate;
+    if (self.pickerMode == BRDatePickerModeYMDHMS) {
+        if (component == 0) {
+            self.yearIndex = row;
+            [self reloadDateArrayWithUpdateMonth:YES updateDay:YES updateHour:YES updateMinute:YES updateSecond:YES];
+            [self.pickerView reloadComponent:1];
+            [self.pickerView reloadComponent:2];
+            [self.pickerView reloadComponent:3];
+            [self.pickerView reloadComponent:4];
+            [self.pickerView reloadComponent:5];
+        } else if (component == 1) {
+            self.monthIndex = row;
+            [self reloadDateArrayWithUpdateMonth:NO updateDay:YES updateHour:YES updateMinute:YES updateSecond:YES];
+            [self.pickerView reloadComponent:2];
+            [self.pickerView reloadComponent:3];
+            [self.pickerView reloadComponent:4];
+            [self.pickerView reloadComponent:5];
+        } else if (component == 2) {
+            self.dayIndex = row;
+            [self reloadDateArrayWithUpdateMonth:NO updateDay:NO updateHour:YES updateMinute:YES updateSecond:YES];
+            [self.pickerView reloadComponent:3];
+            [self.pickerView reloadComponent:4];
+            [self.pickerView reloadComponent:5];
+        } else if (component == 3) {
+            self.hourIndex = row;
+            [self reloadDateArrayWithUpdateMonth:NO updateDay:NO updateHour:NO updateMinute:YES updateSecond:YES];
+            [self.pickerView reloadComponent:4];
+            [self.pickerView reloadComponent:5];
+        } else if (component == 4) {
+            self.minuteIndex = row;
+            [self reloadDateArrayWithUpdateMonth:NO updateDay:NO updateHour:NO updateMinute:NO updateSecond:YES];
+            [self.pickerView reloadComponent:5];
+        } else if (component == 5) {
+            self.secondIndex = row;
+        }
+        
+        NSString *yearString = [self getYearString];
+        if (![yearString isEqualToString:self.lastRowContent] && ![yearString isEqualToString:self.firstRowContent]) {
+            if (self.yearArr.count * self.monthArr.count * self.dayArr.count * self.hourArr.count * self.minuteArr.count * self.secondArr.count == 0) return;
+            int year = [[self getYearString] intValue];
+            int month = [[self getMonthString] intValue];
+            int day = [[self getDayString] intValue];
+            int hour = [[self getHourString] intValue];
+            int minute = [[self getMinuteString] intValue];
+            int second = [[self getSecondString] intValue];
+            self.mSelectDate = [NSDate br_setYear:year month:month day:day hour:hour minute:minute second:second];
+            self.mSelectValue = [NSString stringWithFormat:@"%04d-%02d-%02d %02d:%02d:%02d", year, month, day, hour, minute, second];
+        } else {
+            self.mSelectDate = self.addToNow ? [NSDate date] : nil;
+            if ([yearString isEqualToString:self.lastRowContent]) {
+                self.mSelectValue = self.lastRowContent;
+            } else if ([yearString isEqualToString:self.firstRowContent]) {
+                self.mSelectValue = self.firstRowContent;
+            }
+        }
+        
+    } else if (self.pickerMode == BRDatePickerModeYMDHM) {
+        if (component == 0) {
+            self.yearIndex = row;
+            [self reloadDateArrayWithUpdateMonth:YES updateDay:YES updateHour:YES updateMinute:YES updateSecond:NO];
+            [self.pickerView reloadComponent:1];
+            [self.pickerView reloadComponent:2];
+            [self.pickerView reloadComponent:3];
+            [self.pickerView reloadComponent:4];
+        } else if (component == 1) {
+            self.monthIndex = row;
+            [self reloadDateArrayWithUpdateMonth:NO updateDay:YES updateHour:YES updateMinute:YES updateSecond:NO];
+            [self.pickerView reloadComponent:2];
+            [self.pickerView reloadComponent:3];
+            [self.pickerView reloadComponent:4];
+        } else if (component == 2) {
+            self.dayIndex = row;
+            [self reloadDateArrayWithUpdateMonth:NO updateDay:NO updateHour:YES updateMinute:YES updateSecond:NO];
+            [self.pickerView reloadComponent:3];
+            [self.pickerView reloadComponent:4];
+        } else if (component == 3) {
+            self.hourIndex = row;
+            [self reloadDateArrayWithUpdateMonth:NO updateDay:NO updateHour:NO updateMinute:YES updateSecond:NO];
+            [self.pickerView reloadComponent:4];
+        } else if (component == 4) {
+            self.minuteIndex = row;
+        }
+        
+        NSString *yearString = [self getYearString];
+        if (![yearString isEqualToString:self.lastRowContent] && ![yearString isEqualToString:self.firstRowContent]) {
+            if (self.yearArr.count * self.monthArr.count * self.dayArr.count * self.hourArr.count * self.minuteArr.count == 0) return;
+            int year = [[self getYearString] intValue];
+            int month = [[self getMonthString] intValue];
+            int day = [[self getDayString] intValue];
+            int hour = [[self getHourString] intValue];
+            int minute = [[self getMinuteString] intValue];
+            self.mSelectDate = [NSDate br_setYear:year month:month day:day hour:hour minute:minute];
+            self.mSelectValue = [NSString stringWithFormat:@"%04d-%02d-%02d %02d:%02d", year, month, day, hour, minute];
+        } else {
+            self.mSelectDate = self.addToNow ? [NSDate date] : nil;
+            if ([yearString isEqualToString:self.lastRowContent]) {
+                self.mSelectValue = self.lastRowContent;
+            } else if ([yearString isEqualToString:self.firstRowContent]) {
+                self.mSelectValue = self.firstRowContent;
+            }
+        }
+        
+    } else if (self.pickerMode == BRDatePickerModeYMDH) {
+        if (component == 0) {
+            self.yearIndex = row;
+            [self reloadDateArrayWithUpdateMonth:YES updateDay:YES updateHour:YES updateMinute:NO updateSecond:NO];
+            [self.pickerView reloadComponent:1];
+            [self.pickerView reloadComponent:2];
+            [self.pickerView reloadComponent:3];
+        } else if (component == 1) {
+            self.monthIndex = row;
+            [self reloadDateArrayWithUpdateMonth:NO updateDay:YES updateHour:YES updateMinute:NO updateSecond:NO];
+            [self.pickerView reloadComponent:2];
+            [self.pickerView reloadComponent:3];
+        } else if (component == 2) {
+            self.dayIndex = row;
+            [self reloadDateArrayWithUpdateMonth:NO updateDay:NO updateHour:YES updateMinute:NO updateSecond:NO];
+            [self.pickerView reloadComponent:3];
+        } else if (component == 3) {
+            self.hourIndex = row;
+        }
+        
+        NSString *yearString = [self getYearString];
+        if (![yearString isEqualToString:self.lastRowContent] && ![yearString isEqualToString:self.firstRowContent]) {
+            if (self.yearArr.count * self.monthArr.count * self.dayArr.count * self.hourArr.count == 0) return;
+            int year = [[self getYearString] intValue];
+            int month = [[self getMonthString] intValue];
+            int day = [[self getDayString] intValue];
+            int hour = 0;
+            if (self.pickerMode == BRDatePickerModeYMDH && self.isShowAMAndPM) {
+                hour = (self.hourIndex == 0 ? 0 : 12);
+                self.mSelectValue = [NSString stringWithFormat:@"%04d-%02d-%02d %@", year, month, day, [self getHourString]];
+            } else {
+                hour = [[self getHourString] intValue];
+                self.mSelectValue = [NSString stringWithFormat:@"%04d-%02d-%02d %02d", year, month, day, hour];
+            }
+            self.mSelectDate = [NSDate br_setYear:year month:month day:day hour:hour];
+        } else {
+            self.mSelectDate = self.addToNow ? [NSDate date] : nil;
+            if ([yearString isEqualToString:self.lastRowContent]) {
+                self.mSelectValue = self.lastRowContent;
+            } else if ([yearString isEqualToString:self.firstRowContent]) {
+                self.mSelectValue = self.firstRowContent;
+            }
+        }
+        
+    } else if (self.pickerMode == BRDatePickerModeMDHM) {
+        if (component == 0) {
+            self.monthIndex = row;
+            [self reloadDateArrayWithUpdateMonth:NO updateDay:YES updateHour:YES updateMinute:YES updateSecond:NO];
+            [self.pickerView reloadComponent:1];
+            [self.pickerView reloadComponent:2];
+            [self.pickerView reloadComponent:3];
+        } else if (component == 1) {
+            self.dayIndex = row;
+            [self reloadDateArrayWithUpdateMonth:NO updateDay:NO updateHour:YES updateMinute:YES updateSecond:NO];
+            [self.pickerView reloadComponent:2];
+            [self.pickerView reloadComponent:3];
+        } else if (component == 2) {
+            self.hourIndex = row;
+            [self reloadDateArrayWithUpdateMonth:NO updateDay:NO updateHour:NO updateMinute:YES updateSecond:NO];
+            [self.pickerView reloadComponent:3];
+        } else if (component == 3) {
+            self.minuteIndex = row;
+        }
+        
+        NSString *monthString = [self getMonthString];
+        if (![monthString isEqualToString:self.lastRowContent] && ![monthString isEqualToString:self.firstRowContent]) {
+            if (self.yearArr.count * self.monthArr.count * self.dayArr.count * self.hourArr.count * self.minuteArr.count == 0) return;
+            int year = [[self getYearString] intValue];
+            int month = [[self getMonthString] intValue];
+            int day = [[self getDayString] intValue];
+            int hour = [[self getHourString] intValue];
+            int minute = [[self getMinuteString] intValue];
+            self.mSelectDate = [NSDate br_setYear:year month:month day:day hour:hour minute:minute];
+            self.mSelectValue = [NSString stringWithFormat:@"%02d-%02d %02d:%02d", month, day, hour, minute];
+        } else {
+            self.mSelectDate = self.addToNow ? [NSDate date] : nil;
+            if ([monthString isEqualToString:self.lastRowContent]) {
+                self.mSelectValue = self.lastRowContent;
+            } else if ([monthString isEqualToString:self.firstRowContent]) {
+                self.mSelectValue = self.firstRowContent;
+            }
+        }
+        
+    } else if (self.pickerMode == BRDatePickerModeYMD) {
+        if (component == 0) {
+            if ([self.pickerStyle.language hasPrefix:@"zh"]) {
+                self.yearIndex = row;
+                [self reloadDateArrayWithUpdateMonth:YES updateDay:YES updateHour:NO updateMinute:NO updateSecond:NO];
+                [self.pickerView reloadComponent:1];
+                [self.pickerView reloadComponent:2];
+            } else {
+                self.dayIndex = row;
+            }
+        } else if (component == 1) {
+            self.monthIndex = row;
+            [self reloadDateArrayWithUpdateMonth:NO updateDay:YES updateHour:NO updateMinute:NO updateSecond:NO];
+            if ([self.pickerStyle.language hasPrefix:@"zh"]) {
+                [self.pickerView reloadComponent:2];
+            } else {
+                [self.pickerView reloadComponent:0];
+            }
+        } else if (component == 2) {
+            if ([self.pickerStyle.language hasPrefix:@"zh"]) {
+                self.dayIndex = row;
+            } else {
+                self.yearIndex = row;
+                [self reloadDateArrayWithUpdateMonth:YES updateDay:YES updateHour:NO updateMinute:NO updateSecond:NO];
+                [self.pickerView reloadComponent:0];
+                [self.pickerView reloadComponent:1];
+            }
+        }
+        
+        NSString *yearString = [self getYearString];
+        if (![yearString isEqualToString:self.lastRowContent] && ![yearString isEqualToString:self.firstRowContent]) {
+            if (self.yearArr.count * self.monthArr.count * self.dayArr.count == 0) return;
+            int year = [[self getYearString] intValue];
+            int month = [[self getMonthString] intValue];
+            int day = [[self getDayString] intValue];
+            self.mSelectDate = [NSDate br_setYear:year month:month day:day];
+            self.mSelectValue = [NSString stringWithFormat:@"%04d-%02d-%02d", year, month, day];
+        } else {
+            self.mSelectDate = self.addToNow ? [NSDate date] : nil;
+            if ([yearString isEqualToString:self.lastRowContent]) {
+                self.mSelectValue = self.lastRowContent;
+            } else if ([yearString isEqualToString:self.firstRowContent]) {
+                self.mSelectValue = self.firstRowContent;
+            }
+        }
+        
+    } else if (self.pickerMode == BRDatePickerModeYM) {
+        if (component == 0) {
+            if ([self.pickerStyle.language hasPrefix:@"zh"]) {
+                self.yearIndex = row;
+                [self reloadDateArrayWithUpdateMonth:YES updateDay:NO updateHour:NO updateMinute:NO updateSecond:NO];
+                [self.pickerView reloadComponent:1];
+            } else {
+                self.monthIndex = row;
+            }
+        } else if (component == 1) {
+            if ([self.pickerStyle.language hasPrefix:@"zh"]) {
+                self.monthIndex = row;
+            } else {
+                self.yearIndex = row;
+                [self reloadDateArrayWithUpdateMonth:YES updateDay:NO updateHour:NO updateMinute:NO updateSecond:NO];
+                [self.pickerView reloadComponent:0];
+            }
+        }
+        
+        NSString *yearString = [self getYearString];
+        if (![yearString isEqualToString:self.lastRowContent] && ![yearString isEqualToString:self.firstRowContent]) {
+            if (self.yearArr.count * self.monthArr.count == 0) return;
+            int year = [[self getYearString] intValue];
+            int month = [[self getMonthString] intValue];
+            self.mSelectDate = [NSDate br_setYear:year month:month];
+            self.mSelectValue = [NSString stringWithFormat:@"%04d-%02d", year, month];
+        } else {
+            self.mSelectDate = self.addToNow ? [NSDate date] : nil;
+            if ([yearString isEqualToString:self.lastRowContent]) {
+                self.mSelectValue = self.lastRowContent;
+            } else if ([yearString isEqualToString:self.firstRowContent]) {
+                self.mSelectValue = self.firstRowContent;
+            }
+        }
+    } else if (self.pickerMode == BRDatePickerModeY) {
+        if (component == 0) {
+            self.yearIndex = row;
+        }
+        
+        NSString *yearString = [self getYearString];
+        if (![yearString isEqualToString:self.lastRowContent] && ![yearString isEqualToString:self.firstRowContent]) {
+            if (self.yearArr.count == 0) return;
+            int year = [[self getYearString] intValue];
+            self.mSelectDate = [NSDate br_setYear:year];
+            self.mSelectValue = [NSString stringWithFormat:@"%04d", year];
+        } else {
+            self.mSelectDate = self.addToNow ? [NSDate date] : nil;
+            if ([yearString isEqualToString:self.lastRowContent]) {
+                self.mSelectValue = self.lastRowContent;
+            } else if ([yearString isEqualToString:self.firstRowContent]) {
+                self.mSelectValue = self.firstRowContent;
+            }
+        }
+        
+    } else if (self.pickerMode == BRDatePickerModeMD) {
+        if (component == 0) {
+            self.monthIndex = row;
+            [self reloadDateArrayWithUpdateMonth:NO updateDay:YES updateHour:NO updateMinute:NO updateSecond:NO];
+            [self.pickerView reloadComponent:1];
+        } else if (component == 1) {
+            self.dayIndex = row;
+        }
+        
+        NSString *monthString = [self getMonthString];
+        if (![monthString isEqualToString:self.lastRowContent] && ![monthString isEqualToString:self.firstRowContent]) {
+            if (self.yearArr.count * self.monthArr.count * self.dayArr.count == 0) return;
+            int year = [[self getYearString] intValue];
+            int month = [[self getMonthString] intValue];
+            int day = [[self getDayString] intValue];
+            self.mSelectDate = [NSDate br_setYear:year month:month day:day];
+            self.mSelectValue = [NSString stringWithFormat:@"%02d-%02d", month, day];
+        } else {
+            self.mSelectDate = self.addToNow ? [NSDate date] : nil;
+            if ([monthString isEqualToString:self.lastRowContent]) {
+                self.mSelectValue = self.lastRowContent;
+            } else if ([monthString isEqualToString:self.firstRowContent]) {
+                self.mSelectValue = self.firstRowContent;
+            }
+        }
+        
+    } else if (self.pickerMode == BRDatePickerModeHMS) {
+        if (component == 0) {
+            self.hourIndex = row;
+            [self reloadDateArrayWithUpdateMonth:NO updateDay:NO updateHour:NO updateMinute:YES updateSecond:YES];
+            [self.pickerView reloadComponent:1];
+            [self.pickerView reloadComponent:2];
+        } else if (component == 1) {
+            self.minuteIndex = row;
+            [self reloadDateArrayWithUpdateMonth:NO updateDay:NO updateHour:NO updateMinute:NO updateSecond:YES];
+            [self.pickerView reloadComponent:2];
+        } else if (component == 2) {
+            self.secondIndex = row;
+        }
+        
+        NSString *hourString = [self getHourString];
+        if (![hourString isEqualToString:self.lastRowContent] && ![hourString isEqualToString:self.firstRowContent]) {
+            if (self.hourArr.count * self.minuteArr.count * self.secondArr.count == 0) return;
+            int hour = [[self getHourString] intValue];
+            int minute = [[self getMinuteString] intValue];
+            int second = [[self getSecondString] intValue];
+            self.mSelectDate = [NSDate br_setHour:hour minute:minute second:second];
+            self.mSelectValue = [NSString stringWithFormat:@"%02d:%02d:%02d", hour, minute, second];
+        } else {
+            self.mSelectDate = self.addToNow ? [NSDate date] : nil;
+            if ([hourString isEqualToString:self.lastRowContent]) {
+                self.mSelectValue = self.lastRowContent;
+            } else if ([hourString isEqualToString:self.firstRowContent]) {
+                self.mSelectValue = self.firstRowContent;
+            }
+        }
+        
+    } else if (self.pickerMode == BRDatePickerModeHM) {
+        if (component == 0) {
+            self.hourIndex = row;
+            [self reloadDateArrayWithUpdateMonth:NO updateDay:NO updateHour:NO updateMinute:YES updateSecond:NO];
+            [self.pickerView reloadComponent:1];
+        } else if (component == 1) {
+            self.minuteIndex = row;
+        }
+        
+        NSString *hourString = [self getHourString];
+        if (![hourString isEqualToString:self.lastRowContent] && ![hourString isEqualToString:self.firstRowContent]) {
+            if (self.hourArr.count * self.minuteArr.count == 0) return;
+            int hour = [[self getHourString] intValue];
+            int minute = [[self getMinuteString] intValue];
+            self.mSelectDate = [NSDate br_setHour:hour minute:minute];
+            self.mSelectValue = [NSString stringWithFormat:@"%02d:%02d", hour, minute];
+        } else {
+            self.mSelectDate = self.addToNow ? [NSDate date] : nil;
+            if ([hourString isEqualToString:self.lastRowContent]) {
+                self.mSelectValue = self.lastRowContent;
+            } else if ([hourString isEqualToString:self.firstRowContent]) {
+                self.mSelectValue = self.firstRowContent;
+            }
+        }
+    } else if (self.pickerMode == BRDatePickerModeMS) {
+        if (component == 0) {
+            self.minuteIndex = row;
+            [self reloadDateArrayWithUpdateMonth:NO updateDay:NO updateHour:NO updateMinute:NO updateSecond:YES];
+            [self.pickerView reloadComponent:1];
+        } else if (component == 1) {
+            self.secondIndex = row;
+        }
+        
+        NSString *minuteString = [self getMinuteString];
+        if (![minuteString isEqualToString:self.lastRowContent] && ![minuteString isEqualToString:self.firstRowContent]) {
+            if (self.minuteArr.count * self.secondArr.count == 0) return;
+            int minute = [[self getMinuteString] intValue];
+            int second = [[self getSecondString] intValue];
+            self.mSelectDate = [NSDate br_setMinute:minute second:second];
+            self.mSelectValue = [NSString stringWithFormat:@"%02d:%02d", minute, second];
+        } else {
+            self.mSelectDate = self.addToNow ? [NSDate date] : nil;
+            if ([minuteString isEqualToString:self.lastRowContent]) {
+                self.mSelectValue = self.lastRowContent;
+            } else if ([minuteString isEqualToString:self.firstRowContent]) {
+                self.mSelectValue = self.firstRowContent;
+            }
+        }
+    } else if (self.pickerMode == BRDatePickerModeYMW) {
+        if (component == 0) {
+            self.yearIndex = row;
+            [self reloadDateArrayWithUpdateMonth:YES updateDay:NO updateHour:NO updateMinute:NO updateSecond:NO updateWeekOfMonth:YES updateWeekOfYear:NO updateQuarter:NO];
+            [self.pickerView reloadComponent:1];
+            [self.pickerView reloadComponent:2];
+        } else if (component == 1) {
+            self.monthIndex = row;
+            [self reloadDateArrayWithUpdateMonth:NO updateDay:NO updateHour:NO updateMinute:NO updateSecond:NO updateWeekOfMonth:YES updateWeekOfYear:NO updateQuarter:NO];
+            [self.pickerView reloadComponent:2];
+        } else if (component == 2) {
+            self.monthWeekIndex = row;
+        }
+        
+        NSString *yearString = [self getYearString];
+        if (![yearString isEqualToString:self.lastRowContent] && ![yearString isEqualToString:self.firstRowContent]) {
+            if (self.yearArr.count * self.monthArr.count * self.monthWeekArr.count == 0) return;
+            int year = [[self getYearString] intValue];
+            int month = [[self getMonthString] intValue];
+            int week = [[self getMonthWeekString] intValue];
+            self.mSelectDate = [NSDate br_setYear:year month:month weekOfMonth:week];
+            self.mSelectValue = [NSString stringWithFormat:@"%04d-%02d-%02d", year, month, week];
+        } else {
+            self.mSelectDate = self.addToNow ? [NSDate date] : nil;
+            if ([yearString isEqualToString:self.lastRowContent]) {
+                self.mSelectValue = self.lastRowContent;
+            } else if ([yearString isEqualToString:self.firstRowContent]) {
+                self.mSelectValue = self.firstRowContent;
+            }
+        }
+    } else if (self.pickerMode == BRDatePickerModeYW) {
+        if (component == 0) {
+            self.yearIndex = row;
+            [self reloadDateArrayWithUpdateMonth:NO updateDay:NO updateHour:NO updateMinute:NO updateSecond:NO updateWeekOfMonth:NO updateWeekOfYear:YES updateQuarter:NO];
+            [self.pickerView reloadComponent:1];
+        } else if (component == 1) {
+            self.yearWeekIndex = row;
+        }
+        
+        NSString *yearString = [self getYearString];
+        if (![yearString isEqualToString:self.lastRowContent] && ![yearString isEqualToString:self.firstRowContent]) {
+            if (self.yearArr.count * self.monthArr.count * self.monthWeekArr.count == 0) return;
+            int year = [[self getYearString] intValue];
+            int week = [[self getYearWeekString] intValue];
+            self.mSelectDate = [NSDate br_setYear:year weekOfYear:week];
+            self.mSelectValue = [NSString stringWithFormat:@"%04d-%02d", year, week];
+        } else {
+            self.mSelectDate = self.addToNow ? [NSDate date] : nil;
+            if ([yearString isEqualToString:self.lastRowContent]) {
+                self.mSelectValue = self.lastRowContent;
+            } else if ([yearString isEqualToString:self.firstRowContent]) {
+                self.mSelectValue = self.firstRowContent;
+            }
+        }
+    } else if (self.pickerMode == BRDatePickerModeYQ) {
+        if (component == 0) {
+            self.yearIndex = row;
+            [self reloadDateArrayWithUpdateMonth:NO updateDay:NO updateHour:NO updateMinute:NO updateSecond:NO updateWeekOfMonth:NO updateWeekOfYear:NO updateQuarter:YES];
+            [self.pickerView reloadComponent:1];
+        } else if (component == 1) {
+            self.quarterIndex = row;
+        }
+        
+        NSString *yearString = [self getYearString];
+        if (![yearString isEqualToString:self.lastRowContent] && ![yearString isEqualToString:self.firstRowContent]) {
+            if (self.yearArr.count * self.monthArr.count * self.monthWeekArr.count == 0) return;
+            int year = [[self getYearString] intValue];
+            int quarter = [[self getQuarterString] intValue];
+            self.mSelectDate = [NSDate br_setYear:year quarter:quarter];
+            self.mSelectValue = [NSString stringWithFormat:@"%04d-%02d", year, quarter];
+        } else {
+            self.mSelectDate = self.addToNow ? [NSDate date] : nil;
+            if ([yearString isEqualToString:self.lastRowContent]) {
+                self.mSelectValue = self.lastRowContent;
+            } else if ([yearString isEqualToString:self.firstRowContent]) {
+                self.mSelectValue = self.firstRowContent;
+            }
+        }
+    }
+    
+    // 纠正选择日期(解决:由【自定义字符串】滚动到 其它日期时,或设置 minDate,日期联动不正确问题)
+    BOOL isLastRowContent = [lastSelectValue isEqualToString:self.lastRowContent] && ![self.mSelectValue isEqualToString:self.lastRowContent] && ![self.mSelectValue isEqualToString:self.firstRowContent];
+    BOOL isFirstRowContent = [lastSelectValue isEqualToString:self.firstRowContent] && ![self.mSelectValue isEqualToString:self.lastRowContent] && ![self.mSelectValue isEqualToString:self.firstRowContent];
+    if (isLastRowContent || isFirstRowContent || _isAdjustSelectRow) {
+        [self scrollToSelectDate:self.mSelectDate animated:NO];
+    }
+    
+    // 禁止选择日期:回滚到上次选择的日期
+    if (self.nonSelectableDates && self.nonSelectableDates.count > 0 && ![self.mSelectValue isEqualToString:self.lastRowContent] && ![self.mSelectValue isEqualToString:self.firstRowContent]) {
+        for (NSDate *date in self.nonSelectableDates) {
+            if ([self br_compareDate:date targetDate:self.mSelectDate dateFormat:self.dateFormatter] == NSOrderedSame) {
+                dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+                    // 如果当前的日期不可选择,就回滚到上次选择的日期
+                    [self scrollToSelectDate:lastSelectDate animated:YES];
+                });
+                // 不可选择日期的回调
+                if (self.nonSelectableBlock) {
+                    self.nonSelectableBlock(self.mSelectDate, self.mSelectValue);
+                }
+                self.mSelectDate = lastSelectDate;
+                self.mSelectValue = lastSelectValue;
+                break;
+            }
+        }
+    }
+    
+    // 滚动选择时执行 changeBlock 回调
+    if (self.changeBlock) {
+        self.changeBlock(self.mSelectDate, self.mSelectValue);
+    }
+    
+    // 滚动选择范围时执行 changeBlock 回调
+    if (self.changeRangeBlock) {
+        self.changeRangeBlock(self.getSelectRangeDate.firstObject, self.getSelectRangeDate.lastObject, self.mSelectValue);
+    }
+    
+    // 设置自动选择时,滚动选择时就执行 resultBlock
+    if (self.isAutoSelect) {
+        // 滚动完成后,执行block回调
+        if (self.resultBlock) {
+            self.resultBlock(self.mSelectDate, self.mSelectValue);
+        }
+        if (self.resultRangeBlock) {
+            self.resultRangeBlock(self.getSelectRangeDate.firstObject, self.getSelectRangeDate.lastObject, self.mSelectValue);
+        }
+    }
+}
+
+// 设置行高
+- (CGFloat)pickerView:(UIPickerView *)pickerView rowHeightForComponent:(NSInteger)component {
+    return self.pickerStyle.rowHeight;
+}
+
+// 设置列宽
+- (CGFloat)pickerView:(UIPickerView *)pickerView widthForComponent:(NSInteger)component {
+    NSInteger columnCount = [self numberOfComponentsInPickerView:pickerView];
+    CGFloat columnWidth = self.pickerView.bounds.size.width / columnCount;
+    if (self.pickerStyle.columnWidth > 0 && self.pickerStyle.columnWidth <= columnWidth) {
+        return self.pickerStyle.columnWidth;
+    }
+    return columnWidth;
+}
+
+#pragma mark - 日期选择器1 滚动后的响应事件
+- (void)didSelectValueChanged:(UIDatePicker *)sender {
+    // 读取日期:datePicker.date
+    self.mSelectDate = sender.date;
+    
+    if (_datePickerMode != UIDatePickerModeCountDownTimer) {
+        BOOL selectLessThanMin = [self br_compareDate:self.mSelectDate targetDate:self.minDate dateFormat:self.dateFormatter] == NSOrderedAscending;
+        BOOL selectMoreThanMax = [self br_compareDate:self.mSelectDate targetDate:self.maxDate dateFormat:self.dateFormatter] == NSOrderedDescending;
+        if (selectLessThanMin) {
+            self.mSelectDate = self.minDate;
+        }
+        if (selectMoreThanMax) {
+            self.mSelectDate = self.maxDate;
+        }
+    }
+    
+    [self.datePicker setDate:self.mSelectDate animated:YES];
+    
+    self.mSelectValue = [self br_stringFromDate:self.mSelectDate dateFormat:self.dateFormatter];
+    
+    // 滚动选择时执行 changeBlock 回调
+    if (self.changeBlock) {
+        self.changeBlock(self.mSelectDate, self.mSelectValue);
+    }
+    
+    // 滚动选择范围时执行 changeBlock 回调
+    if (self.changeRangeBlock) {
+        self.changeRangeBlock(self.getSelectRangeDate.firstObject, self.getSelectRangeDate.lastObject, self.mSelectValue);
+    }
+    
+    // 设置自动选择时,滚动选择时就执行 resultBlock
+    if (self.isAutoSelect) {
+        // 滚动完成后,执行block回调
+        if (self.resultBlock) {
+            self.resultBlock(self.mSelectDate, self.mSelectValue);
+        }
+        if (self.resultRangeBlock) {
+            self.resultRangeBlock(self.getSelectRangeDate.firstObject, self.getSelectRangeDate.lastObject, self.mSelectValue);
+        }
+    }
+}
+
+#pragma mark - 重写父类方法
+- (void)reloadData {
+    // 1.处理数据源
+    [self handlerPickerData];
+    if (self.style == BRDatePickerStyleSystem) {
+        // 2.刷新选择器(重新设置相关值)
+        self.datePicker.datePickerMode = _datePickerMode;
+        
+#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130400 // 编译时检查SDK版本,iOS SDK 13.4 以后版本的处理
+        if (@available(iOS 13.4, *)) {
+            CGRect rect = self.datePicker.frame;
+            // 适配 iOS14 以后 UIDatePicker 的显示样式
+            // 注意:设置 preferredDatePickerStyle 的样式后,需要重新设置 UIDatePicker 的 frame;因为设置该样式会导致 frame 发生变化,显示会有问题
+            self.datePicker.preferredDatePickerStyle = UIDatePickerStyleWheels;
+            // 重新设置 datePicker 的 frame
+            self.datePicker.frame = rect;
+        }
+#endif
+        
+        // 设置该 UIDatePicker 的国际化 Locale
+        self.datePicker.locale = [[NSLocale alloc]initWithLocaleIdentifier:self.pickerStyle.language];
+        if (self.timeZone) {
+            self.datePicker.timeZone = self.timeZone;
+        }
+        
+        self.datePicker.calendar = self.calendar;
+        
+        if (self.minDate) {
+            self.datePicker.minimumDate = self.minDate;
+        }
+        if (self.maxDate) {
+            self.datePicker.maximumDate = self.maxDate;
+        }
+        if (_datePickerMode == UIDatePickerModeCountDownTimer && self.countDownDuration > 0) {
+            self.datePicker.countDownDuration = self.countDownDuration;
+        }
+        if (self.minuteInterval > 1) {
+            self.datePicker.minuteInterval = self.minuteInterval;
+        }
+        
+        // 3.滚动到选择的日期
+        [self.datePicker setDate:self.mSelectDate animated:NO];
+    } else if (self.style == BRDatePickerStyleCustom) {
+        // 2.刷新选择器
+        [self.pickerView reloadAllComponents];
+        // 3.滚动到选择的日期
+        if (self.selectValue && ([self.selectValue isEqualToString:self.lastRowContent] || [self.selectValue isEqualToString:self.firstRowContent])) {
+            [self scrollToCustomString:NO];
+        } else {
+            [self scrollToSelectDate:self.mSelectDate animated:NO];
+        }
+    }
+}
+
+- (void)addPickerToView:(UIView *)view {
+    _containerView = view;
+    [self setupDateFormatter:self.pickerMode];
+    // 1.添加日期选择器
+    if (self.style == BRDatePickerStyleSystem) {
+        [self setupPickerView:self.datePicker toView:view];
+    } else if (self.style == BRDatePickerStyleCustom) {
+        [self setupPickerView:self.pickerView toView:view];
+        if (self.showUnitType == BRShowUnitTypeOnlyCenter) {
+            // 添加日期单位到选择器
+            [self addUnitLabel];
+        }
+    }
+    
+    // ③添加中间选择行的两条分割线
+    if (self.pickerStyle.clearPickerNewStyle) {
+        [self.pickerStyle addSeparatorLineView:self.pickerView];
+    }
+    
+    // 2.绑定数据
+    [self reloadData];
+    
+    __weak typeof(self) weakSelf = self;
+    // 点击确定按钮的回调:点击确定按钮后,执行这个block回调
+    self.doneBlock = ^{
+        if (weakSelf.isRolling) {
+            NSLog(@"选择器滚动还未结束");
+            // 问题:如果滚动选择器过快,然后在滚动过程中快速点击确定按钮,会导致 didSelectRow 代理方法还没有执行,出现没有选中的情况。
+            // 解决:这里手动处理一下,如果滚动还未结束,强制执行一次 didSelectRow 代理方法,选择当前滚动的行。
+            [weakSelf pickerView:weakSelf.pickerView didSelectRow:weakSelf.rollingRow inComponent:weakSelf.rollingComponent];
+        }
+        
+        // 执行选择结果回调
+        if (weakSelf.resultBlock) {
+            weakSelf.resultBlock(weakSelf.mSelectDate, weakSelf.mSelectValue);
+        }
+        if (weakSelf.resultRangeBlock) {
+            weakSelf.resultRangeBlock(weakSelf.getSelectRangeDate.firstObject, weakSelf.getSelectRangeDate.lastObject, weakSelf.mSelectValue);
+        }
+    };
+    
+    [super addPickerToView:view];
+}
+
+#pragma mark - 添加日期单位到选择器
+- (void)addUnitLabel {
+    if (self.unitLabelArr.count > 0) {
+        for (UILabel *unitLabel in self.unitLabelArr) {
+            [unitLabel removeFromSuperview];
+        }
+        self.unitLabelArr = nil;
+    }
+    self.unitLabelArr = [self setupPickerUnitLabel:self.pickerView unitArr:self.unitArr];
+}
+
+#pragma mark - 重写父类方法
+- (void)addSubViewToPicker:(UIView *)customView {
+    if (self.style == BRDatePickerStyleSystem) {
+        [self.datePicker addSubview:customView];
+    } else if (self.style == BRDatePickerStyleCustom) {
+        [self.pickerView addSubview:customView];
+    }
+}
+
+#pragma mark - 弹出选择器视图
+- (void)show {
+    [self addPickerToView:nil];
+}
+
+#pragma mark - 关闭选择器视图
+- (void)dismiss {
+    [self removePickerFromView:nil];
+}
+
+#pragma mark - setter 方法
+- (void)setPickerMode:(BRDatePickerMode)pickerMode {
+    _pickerMode = pickerMode;
+    // 非空,表示二次设置
+    if (_datePicker || _pickerView) {
+        BRDatePickerStyle lastStyle = self.style;
+        [self setupDateFormatter:pickerMode];
+        // 系统样式 切换到 自定义样式
+        if (lastStyle == BRDatePickerStyleSystem && self.style == BRDatePickerStyleCustom) {
+            [self.datePicker removeFromSuperview];
+            [self setupPickerView:self.pickerView toView:_containerView];
+        }
+        // 自定义样式 切换到 系统样式
+        if (lastStyle == BRDatePickerStyleCustom && self.style == BRDatePickerStyleSystem) {
+            [self.pickerView removeFromSuperview];
+            [self setupPickerView:self.datePicker toView:_containerView];
+        }
+        // 刷新选择器数据
+        [self reloadData];
+        if (self.style == BRDatePickerStyleCustom && self.showUnitType == BRShowUnitTypeOnlyCenter) {
+            // 添加日期单位到选择器
+            [self addUnitLabel];
+        }
+    }
+}
+
+- (void)setAddToNow:(BOOL)addToNow {
+    _addToNow = addToNow;
+    if (addToNow) {
+        _maxDate = [NSDate date];
+        _lastRowContent = [NSBundle br_localizedStringForKey:@"至今" language:self.pickerStyle.language];
+    }
+}
+
+- (void)setLastRowContent:(NSString *)lastRowContent {
+    if (!_addToNow) {
+        _lastRowContent = lastRowContent;
+    }
+}
+
+// 支持动态设置选择的值
+- (void)setSelectDate:(NSDate *)selectDate {
+    _selectDate = selectDate;
+    _mSelectDate = selectDate;
+    if (_datePicker || _pickerView) {
+        // 刷新选择器数据
+        [self reloadData];
+    }
+}
+
+- (void)setSelectValue:(NSString *)selectValue {
+    _selectValue = selectValue;
+    _mSelectValue = selectValue;
+    if (_datePicker || _pickerView) {
+        // 刷新选择器数据
+        [self reloadData];
+    }
+}
+
+- (void)setTimeZone:(NSTimeZone *)timeZone {
+    _timeZone = timeZone;
+    // 同步时区设置
+    [NSDate br_setTimeZone:timeZone];
+}
+
+#pragma mark - getter 方法
+- (NSArray *)yearArr {
+    if (!_yearArr) {
+        _yearArr = [NSArray array];
+    }
+    return _yearArr;
+}
+
+- (NSArray *)monthArr {
+    if (!_monthArr) {
+        _monthArr = [NSArray array];
+    }
+    return _monthArr;
+}
+
+- (NSArray *)dayArr {
+    if (!_dayArr) {
+        _dayArr = [NSArray array];
+    }
+    return _dayArr;
+}
+
+- (NSArray *)hourArr {
+    if (!_hourArr) {
+        _hourArr = [NSArray array];
+    }
+    return _hourArr;
+}
+
+- (NSArray *)minuteArr {
+    if (!_minuteArr) {
+        _minuteArr = [NSArray array];
+    }
+    return _minuteArr;
+}
+
+- (NSArray *)secondArr {
+    if (!_secondArr) {
+        _secondArr = [NSArray array];
+    }
+    return _secondArr;
+}
+
+- (NSInteger)minuteInterval {
+    if (_minuteInterval < 1 || _minuteInterval > 30) {
+        _minuteInterval = 1;
+    }
+    return _minuteInterval;
+}
+
+- (NSInteger)secondInterval {
+    if (_secondInterval < 1 || _secondInterval > 30) {
+        _secondInterval = 1;
+    }
+    return _secondInterval;
+}
+
+- (NSArray *)unitArr {
+    if (!_unitArr) {
+        _unitArr = [NSArray array];
+    }
+    return _unitArr;
+}
+
+- (NSArray<UILabel *> *)unitLabelArr {
+    if (!_unitLabelArr) {
+        _unitLabelArr = [NSArray array];
+    }
+    return _unitLabelArr;
+}
+
+- (NSArray<NSString *> *)monthNames {
+    if (!_monthNames) {
+        _monthNames = [NSArray array];
+    }
+    return _monthNames;
+}
+
+- (NSString *)getYearString {
+    NSInteger index = 0;
+    if (self.yearIndex >= 0 && self.yearIndex < self.yearArr.count) {
+        index = self.yearIndex;
+    }
+    return [self.yearArr objectAtIndex:index];
+}
+
+- (NSString *)getMonthString {
+    NSInteger index = 0;
+    if (self.monthIndex >= 0 && self.monthIndex < self.monthArr.count) {
+        index = self.monthIndex;
+    }
+    return [self.monthArr objectAtIndex:index];
+}
+
+- (NSString *)getDayString {
+    NSInteger index = 0;
+    if (self.dayIndex >= 0 && self.dayIndex < self.dayArr.count) {
+        index = self.dayIndex;
+    }
+    return [self.dayArr objectAtIndex:index];
+}
+
+- (NSString *)getHourString {
+    NSInteger index = 0;
+    if (self.hourIndex >= 0 && self.hourIndex < self.hourArr.count) {
+        index = self.hourIndex;
+    }
+    return [self.hourArr objectAtIndex:index];
+}
+
+- (NSString *)getMinuteString {
+    NSInteger index = 0;
+    if (self.minuteIndex >= 0 && self.minuteIndex < self.minuteArr.count) {
+        index = self.minuteIndex;
+    }
+    return [self.minuteArr objectAtIndex:index];
+}
+
+- (NSString *)getSecondString {
+    NSInteger index = 0;
+    if (self.secondIndex >= 0 && self.secondIndex < self.secondArr.count) {
+        index = self.secondIndex;
+    }
+    return [self.secondArr objectAtIndex:index];
+}
+
+- (NSString *)getMonthWeekString {
+    NSInteger index = 0;
+    if (self.monthWeekIndex >= 0 && self.monthWeekIndex < self.monthWeekArr.count) {
+        index = self.monthWeekIndex;
+    }
+    return [self.monthWeekArr objectAtIndex:index];
+}
+
+- (NSString *)getYearWeekString {
+    NSInteger index = 0;
+    if (self.yearWeekIndex >= 0 && self.yearWeekIndex < self.yearWeekArr.count) {
+        index = self.yearWeekIndex;
+    }
+    return [self.yearWeekArr objectAtIndex:index];
+}
+
+- (NSString *)getQuarterString {
+    NSInteger index = 0;
+    if (self.quarterIndex >= 0 && self.quarterIndex < self.quarterArr.count) {
+        index = self.quarterIndex;
+    }
+    return [self.quarterArr objectAtIndex:index];
+}
+
+#pragma mark - 获取选中日期范围
+- (NSArray<NSDate *> *)getSelectRangeDate {
+    NSDate *startDate, *endDate = nil;
+    switch (self.pickerMode) {
+        case BRDatePickerModeYMDHMS:
+        case BRDatePickerModeMS:
+        case BRDatePickerModeHMS:
+        {
+            endDate = self.mSelectDate;
+            startDate = self.mSelectDate;
+        }
+            break;
+        case BRDatePickerModeYMDHM:
+        case BRDatePickerModeMDHM:
+        case BRDatePickerModeHM:
+        case BRDatePickerModeDateAndTime:
+        case BRDatePickerModeTime:
+        {
+            NSDate *tempDate = [self br_dateFromString:self.mSelectValue dateFormat:self.dateFormatter];
+            startDate = tempDate;
+            endDate = [tempDate dateByAddingTimeInterval:59];
+        }
+            break;
+        case BRDatePickerModeYMDH:
+        {
+            NSDate *tempDate = [self br_dateFromString:self.mSelectValue dateFormat:self.dateFormatter];
+            startDate = tempDate;
+            endDate = [tempDate dateByAddingTimeInterval:60 * 59 + 59];
+        }
+            break;
+        case BRDatePickerModeMD:
+        case BRDatePickerModeYMD:
+        case BRDatePickerModeDate:
+        {
+            NSDate *tempDate = [self br_dateFromString:self.mSelectValue dateFormat:self.dateFormatter];
+            startDate = tempDate;
+            endDate = [[tempDate br_getNewDateToDays:1] dateByAddingTimeInterval:-1];
+        }
+            break;
+        case BRDatePickerModeYM:
+        {
+            NSDate *tempDate = [self br_dateFromString:self.mSelectValue dateFormat:self.dateFormatter];
+            startDate = tempDate;
+            endDate = [[tempDate br_getNewDateToMonths:1] dateByAddingTimeInterval:-1];
+        }
+            break;
+        case BRDatePickerModeY:
+        {
+            NSDate *tempDate = [self br_dateFromString:self.mSelectValue dateFormat:self.dateFormatter];
+            startDate = tempDate;
+            endDate = [[tempDate br_getNewDateToMonths:12] dateByAddingTimeInterval:-1];
+        }
+            break;
+        case BRDatePickerModeYMW:
+        case BRDatePickerModeYW:
+        {
+            NSDate *tempDate = [self br_dateFromString:self.mSelectValue dateFormat:self.dateFormatter];
+            endDate = [tempDate dateByAddingTimeInterval:-1];
+            startDate = [tempDate br_getNewDateToDays:-7];
+        }
+            break;
+        case BRDatePickerModeYQ:
+        {
+            startDate = [self br_dateFromString:self.mSelectValue dateFormat:self.dateFormatter];
+            endDate = [[startDate br_getNewDateToMonths:3] dateByAddingTimeInterval:-1];
+        }
+            break;
+            
+        default:
+            break;
+    }
+    
+    NSMutableArray *dataArr = [NSMutableArray array];
+    if (startDate)
+        [dataArr addObject:startDate];
+    if (endDate)
+        [dataArr addObject:endDate];
+    return dataArr;
+}
+
+@end

+ 121 - 0
Pods/BRPickerView/BRPickerView/DatePicker/NSDate+BRPickerView.h

@@ -0,0 +1,121 @@
+//
+//  NSDate+BRPickerView.h
+//  BRPickerViewDemo
+//
+//  Created by renbo on 2018/3/15.
+//  Copyright © 2018 irenb. All rights reserved.
+//
+//  最新代码下载地址:https://github.com/agiapp/BRPickerView
+
+#import <Foundation/Foundation.h>
+
+NS_ASSUME_NONNULL_BEGIN
+@interface NSDate (BRPickerView)
+
+/// ---------------- 设置【日历对象】和【时区】 ----------------
+/** 设置日历对象 */
++ (void)br_setCalendar:(NSCalendar *)calendar;
+/** 获取日历对象 */
++ (NSCalendar *)br_getCalendar;
+
+/** 设置时区 */
++ (void)br_setTimeZone:(NSTimeZone *)timeZone;
+/** 获取当前时区 */
++ (NSTimeZone *)br_getTimeZone;
+
+/// 获取指定date的详细信息
+@property (readonly) NSInteger br_year;         // 年
+@property (readonly) NSInteger br_month;        // 月
+@property (readonly) NSInteger br_day;          // 日
+@property (readonly) NSInteger br_hour;         // 时
+@property (readonly) NSInteger br_minute;       // 分
+@property (readonly) NSInteger br_second;       // 秒
+@property (readonly) NSInteger br_weekday;      // 星期
+@property (readonly) NSInteger br_monthWeek;    // 月周
+@property (readonly) NSInteger br_yearWeek;     // 年周
+@property (readonly) NSInteger br_quarter;      // 季度
+
+/** 获取中文星期字符串 */
+@property (nullable, nonatomic, readonly, copy) NSString *br_weekdayString;
+
+/// ---------------- 创建 date ----------------
+/** yyyy */
++ (nullable NSDate *)br_setYear:(NSInteger)year;
+
+/** yyyy-MM */
++ (nullable NSDate *)br_setYear:(NSInteger)year month:(NSInteger)month;
+
+/** yyyy-MM-dd */
++ (nullable NSDate *)br_setYear:(NSInteger)year month:(NSInteger)month day:(NSInteger)day;
+
+/** yyyy-MM-dd HH */
++ (nullable NSDate *)br_setYear:(NSInteger)year month:(NSInteger)month day:(NSInteger)day hour:(NSInteger)hour;
+
+/** yyyy-MM-dd HH:mm */
++ (nullable NSDate *)br_setYear:(NSInteger)year month:(NSInteger)month day:(NSInteger)day hour:(NSInteger)hour minute:(NSInteger)minute;
+
+/** yyyy-MM-dd HH:mm:ss */
++ (nullable NSDate *)br_setYear:(NSInteger)year month:(NSInteger)month day:(NSInteger)day hour:(NSInteger)hour minute:(NSInteger)minute second:(NSInteger)second;
+
+/** MM-dd HH:mm */
++ (nullable NSDate *)br_setMonth:(NSInteger)month day:(NSInteger)day hour:(NSInteger)hour minute:(NSInteger)minute;
+
+/** MM-dd */
++ (nullable NSDate *)br_setMonth:(NSInteger)month day:(NSInteger)day;
+
+/** HH:mm:ss */
++ (nullable NSDate *)br_setHour:(NSInteger)hour minute:(NSInteger)minute second:(NSInteger)second;
+
+/** HH:mm */
++ (nullable NSDate *)br_setHour:(NSInteger)hour minute:(NSInteger)minute;
+
+/** mm:ss */
++ (nullable NSDate *)br_setMinute:(NSInteger)minute second:(NSInteger)second;
+
+/** yyyy-MM-ww */
++ (nullable NSDate *)br_setYear:(NSInteger)year month:(NSInteger)month weekOfMonth:(NSInteger)weekOfMont;
+
+/** yyyy-ww */
++ (nullable NSDate *)br_setYear:(NSInteger)year weekOfYear:(NSInteger)weekOfYear;
+
+/** yyyy-qq */
++ (nullable NSDate *)br_setYear:(NSInteger)year quarter:(NSInteger)quarter;
+
+/** 设置12小时制时的hour值 */
+- (NSDate *)br_setTwelveHour:(NSInteger)hour;
+
+/** 获取某个月的天数(通过年月求每月天数)*/
++ (NSUInteger)br_getDaysInYear:(NSInteger)year month:(NSInteger)month;
+
+/** 获取某个月的周数(通过年月求该月周数)*/
++ (NSUInteger)br_getWeeksOfMonthInYear:(NSInteger)year month:(NSInteger)month;
+
+/** 获取某一年的周数(通过年求该年周数)*/
++ (NSUInteger)br_getWeeksOfYearInYear:(NSInteger)year;
+
+/** 获取某一年的季度数(通过年求该年季度数)*/
++ (NSUInteger)br_getQuartersInYear:(NSInteger)year;
+
+/**  获取 日期加上/减去某天数后的新日期 */
+- (nullable NSDate *)br_getNewDateToDays:(NSTimeInterval)days;
+
+/**  获取 日期加上/减去某个月数后的新日期 */
+- (nullable NSDate *)br_getNewDateToMonths:(NSTimeInterval)months;
+
+/** NSDate 转 NSString(使用系统默认 时区 和 语言)*/
++ (nullable NSString *)br_stringFromDate:(NSDate *)date dateFormat:(NSString *)dateFormat;
+/** NSDate 转 NSString */
++ (nullable NSString *)br_stringFromDate:(NSDate *)date
+                              dateFormat:(NSString *)dateFormat
+                                language:(nullable NSString *)language;
+
+/** NSString 转 NSDate(使用系统默认 时区 和 语言)*/
++ (nullable NSDate *)br_dateFromString:(NSString *)dateString dateFormat:(NSString *)dateFormat;
+/** NSString 转 NSDate */
++ (nullable NSDate *)br_dateFromString:(NSString *)dateString
+                            dateFormat:(NSString *)dateFormat
+                              language:(nullable NSString *)language;
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 398 - 0
Pods/BRPickerView/BRPickerView/DatePicker/NSDate+BRPickerView.m

@@ -0,0 +1,398 @@
+//
+//  NSDate+BRPickerView.m
+//  BRPickerViewDemo
+//
+//  Created by renbo on 2018/3/15.
+//  Copyright © 2018 irenb. All rights reserved.
+//
+//  最新代码下载地址:https://github.com/agiapp/BRPickerView
+
+#import "NSDate+BRPickerView.h"
+#import "BRPickerViewMacro.h"
+
+BRSYNTH_DUMMY_CLASS(NSDate_BRPickerView)
+
+static const NSCalendarUnit unitFlags = (NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitWeekOfYear | NSCalendarUnitWeekOfMonth |  NSCalendarUnitHour | NSCalendarUnitMinute | NSCalendarUnitSecond | NSCalendarUnitWeekday | NSCalendarUnitWeekdayOrdinal | NSCalendarUnitQuarter);
+
+@implementation NSDate (BRPickerView)
+
+/// 日历对象
+static NSCalendar *_sharedCalendar = nil;
+/// 时区
+static NSTimeZone *_timeZone = nil;
+
+/// ---------------- 设置【日历对象】和【时区】 ----------------
+#pragma mark - 设置日历对象
++ (void)br_setCalendar:(NSCalendar *)calendar {
+    _sharedCalendar = calendar;
+}
+
+#pragma mark - 获取日历对象
++ (NSCalendar *)br_getCalendar {
+    if (!_sharedCalendar) {
+        // 创建日历对象,指定日历的算法(公历/阳历)
+        _sharedCalendar = [[NSCalendar alloc]initWithCalendarIdentifier:NSCalendarIdentifierGregorian];
+    }
+    return _sharedCalendar;
+}
+
+#pragma mark - 设置时区
++ (void)br_setTimeZone:(NSTimeZone *)timeZone {
+    _timeZone = timeZone;
+    // 同步日历对象时区设置
+    [self br_getCalendar].timeZone = timeZone;
+}
+
+#pragma mark - 获取当前时区
++ (NSTimeZone *)br_getTimeZone {
+    if (!_timeZone) {
+        // 当前时区
+        NSTimeZone *localTimeZone = [NSTimeZone localTimeZone];
+        // 当前时区相对于GMT(零时区)的偏移秒数
+        NSInteger interval = [localTimeZone secondsFromGMTForDate:[NSDate date]];
+        // 当前时区(不使用夏时制):由偏移量获得对应的NSTimeZone对象
+        // 注意:一些夏令时时间 NSString 转 NSDate 时,默认会导致 NSDateFormatter 格式化失败,返回 null
+        _timeZone = [NSTimeZone timeZoneForSecondsFromGMT:interval];
+    }
+    return _timeZone;
+}
+
+#pragma mark - NSDate 转 NSDateComponents
++ (NSDateComponents *)br_componentsFromDate:(NSDate *)date {
+    // 通过日历类 NSCalendar 进行转换
+    NSCalendar *calendar = [self br_getCalendar];
+    // NSDateComponents 可以获得日期的详细信息,即日期的组成
+    return [calendar components:unitFlags fromDate:date];
+}
+
+#pragma mark - NSDateComponents 转 NSDate
++ (NSDate *)br_dateFromComponents:(NSDateComponents *)components {
+    // 通过日历类 NSCalendar 进行转换
+    NSCalendar *calendar = [self br_getCalendar];
+    return [calendar dateFromComponents:components];
+}
+
+#pragma mark - 获取指定日期的年份
+- (NSInteger)br_year {
+    return [NSDate br_componentsFromDate:self].year;
+}
+
+#pragma mark - 获取指定日期的月份
+- (NSInteger)br_month {
+    return [NSDate br_componentsFromDate:self].month;
+}
+
+#pragma mark - 获取指定日期的天
+- (NSInteger)br_day {
+    return [NSDate br_componentsFromDate:self].day;
+}
+
+#pragma mark - 获取指定日期的小时
+- (NSInteger)br_hour {
+    return [NSDate br_componentsFromDate:self].hour;
+}
+
+#pragma mark - 获取指定日期的分钟
+- (NSInteger)br_minute {
+    return [NSDate br_componentsFromDate:self].minute;
+}
+
+#pragma mark - 获取指定日期的秒
+- (NSInteger)br_second {
+    return [NSDate br_componentsFromDate:self].second;
+}
+
+#pragma mark - 获取指定日期的星期
+- (NSInteger)br_weekday {
+    return [NSDate br_componentsFromDate:self].weekday;
+}
+
+#pragma mark - 获取指定日期的月周
+- (NSInteger)br_monthWeek {
+    return [NSDate br_componentsFromDate:self].weekOfMonth;
+}
+
+#pragma mark - 获取指定日期的年周
+- (NSInteger)br_yearWeek {
+    return [NSDate br_componentsFromDate:self].weekOfYear;
+}
+
+#pragma mark - 获取指定日期的季度
+- (NSInteger)br_quarter {
+//    [NSDate br_componentsFromDate:self].quarter; // 取到的季度值总是0?
+    NSInteger quarter = 1;
+    NSInteger month = self.br_month;
+    if (month > 3) quarter = 2;
+    if (month > 6) quarter = 3;
+    if (month > 9) quarter = 4;
+    
+    return quarter;
+}
+
+#pragma mark - 获取指定日期的星期
+- (NSString *)br_weekdayString {
+    switch (self.br_weekday - 1) {
+        case 0:
+        {
+            return @"周日";
+        }
+            break;
+        case 1:
+        {
+            return @"周一";
+        }
+            break;
+        case 2:
+        {
+            return @"周二";
+        }
+            break;
+        case 3:
+        {
+            return @"周三";
+        }
+            break;
+        case 4:
+        {
+            return @"周四";
+        }
+            break;
+        case 5:
+        {
+            return @"周五";
+        }
+            break;
+        case 6:
+        {
+            return @"周六";
+        }
+            break;
+            
+        default:
+            break;
+    }
+    
+    return @"";
+}
+
+/// ---------------- 创建 date ----------------
+#pragma mark - 创建date(通过 NSCalendar 类来创建日期)
++ (NSDate *)br_setYear:(NSInteger)year month:(NSInteger)month day:(NSInteger)day hour:(NSInteger)hour minute:(NSInteger)minute second:(NSInteger)second {
+    return [self br_setYear:year month:month day:day hour:hour minute:minute second:second weekOfMonth:0 weekOfYear:0 quarter:0];
+}
+
++ (NSDate *)br_setYear:(NSInteger)year month:(NSInteger)month day:(NSInteger)day
+                  hour:(NSInteger)hour minute:(NSInteger)minute second:(NSInteger)second
+           weekOfMonth:(NSInteger)weekOfMonth weekOfYear:(NSInteger)weekOfYear quarter:(NSInteger)quarter {
+    NSDateComponents *components = [self br_componentsFromDate:[NSDate date]];
+    if (year > 0) {
+        // 初始化日期组件
+        components = [[NSDateComponents alloc]init];
+        components.year = year;
+    }
+    if (month > 0) {
+        components.month = month;
+    }
+    if (day > 0) {
+        components.day = day;
+    }
+    if (hour >= 0) {
+        components.hour = hour;
+    }
+    if (minute >= 0) {
+        components.minute = minute;
+    }
+    if (second >= 0) {
+        components.second = second;
+    }
+    if (weekOfMonth > 0) {
+        components.weekOfMonth = weekOfMonth;
+    }
+    if (weekOfYear > 0) {
+        components.weekOfYear = weekOfYear;
+    }
+    if (quarter > 0) {
+        components.quarter = quarter;
+    }
+    
+    return [self br_dateFromComponents:components];
+}
+
++ (NSDate *)br_setYear:(NSInteger)year month:(NSInteger)month day:(NSInteger)day hour:(NSInteger)hour minute:(NSInteger)minute {
+    return [self br_setYear:year month:month day:day hour:hour minute:minute second:0];
+}
+
++ (NSDate *)br_setYear:(NSInteger)year month:(NSInteger)month day:(NSInteger)day hour:(NSInteger)hour {
+    return [self br_setYear:year month:month day:day hour:hour minute:0 second:0];
+}
+
++ (NSDate *)br_setYear:(NSInteger)year month:(NSInteger)month day:(NSInteger)day {
+    return [self br_setYear:year month:month day:day hour:0 minute:0 second:0];
+}
+
++ (NSDate *)br_setYear:(NSInteger)year month:(NSInteger)month {
+    return [self br_setYear:year month:month day:0 hour:0 minute:0 second:0];
+}
+
++ (NSDate *)br_setYear:(NSInteger)year {
+    return [self br_setYear:year month:0 day:0 hour:0 minute:0 second:0];
+}
+
++ (NSDate *)br_setMonth:(NSInteger)month day:(NSInteger)day hour:(NSInteger)hour minute:(NSInteger)minute {
+    return [self br_setYear:0 month:month day:day hour:hour minute:minute second:0];
+}
+
++ (NSDate *)br_setMonth:(NSInteger)month day:(NSInteger)day {
+    return [self br_setYear:0 month:month day:day hour:0 minute:0 second:0];
+}
+
++ (NSDate *)br_setHour:(NSInteger)hour minute:(NSInteger)minute second:(NSInteger)second {
+    return [self br_setYear:0 month:0 day:0 hour:hour minute:minute second:second];
+}
+
++ (NSDate *)br_setHour:(NSInteger)hour minute:(NSInteger)minute {
+    return [self br_setYear:0 month:0 day:0 hour:hour minute:minute second:0];
+}
+
++ (NSDate *)br_setMinute:(NSInteger)minute second:(NSInteger)second {
+    return [self br_setYear:0 month:0 day:0 hour:0 minute:minute second:second];
+}
+
++ (NSDate *)br_setYear:(NSInteger)year month:(NSInteger)month weekOfMonth:(NSInteger)weekOfMonth {
+    return [self br_setYear:year month:month day:0 hour:0 minute:0 second:0 weekOfMonth:weekOfMonth weekOfYear:0 quarter:0];
+}
+
++ (NSDate *)br_setYear:(NSInteger)year weekOfYear:(NSInteger)weekOfYear {
+    return [self br_setYear:year month:0 day:0 hour:0 minute:0 second:0 weekOfMonth:0 weekOfYear:weekOfYear quarter:0];
+}
+
++ (NSDate *)br_setYear:(NSInteger)year quarter:(NSInteger)quarter {
+    return [self br_setYear:year month:0 day:0 hour:0 minute:0 second:0 weekOfMonth:0 weekOfYear:0 quarter:quarter];
+}
+
+- (NSDate *)br_setTwelveHour:(NSInteger)hour {
+    NSDateComponents *components = [NSDate br_componentsFromDate:self];
+    if (hour >= 0) {
+        components.hour = hour;
+    }
+    return [NSDate br_dateFromComponents:components];
+}
+
+#pragma mark - 获取某个月的天数(通过年月求每月天数)
++ (NSUInteger)br_getDaysInYear:(NSInteger)year month:(NSInteger)month {
+    BOOL isLeapYear = year % 4 == 0 ? (year % 100 == 0 ? (year % 400 == 0 ? YES : NO) : YES) : NO;
+    switch (month) {
+        case 1:
+        case 3:
+        case 5:
+        case 7:
+        case 8:
+        case 10:
+        case 12:
+        {
+            return 31;
+        }
+        case 4:
+        case 6:
+        case 9:
+        case 11:
+        {
+            return 30;
+        }
+        case 2:
+        {
+            if (isLeapYear) {
+                return 29;
+            } else {
+                return 28;
+            }
+        }
+        default:
+            break;
+    }
+    
+    return 0;
+}
+
+#pragma mark - 获取某个月的周数(通过年月求该月周数)
++ (NSUInteger)br_getWeeksOfMonthInYear:(NSInteger)year month:(NSInteger)month {
+    NSUInteger lastDayOfMonth = [self br_getDaysInYear:year month:month];
+    NSDate *endDate = [self br_setYear:year month:month day:lastDayOfMonth];
+    return endDate.br_monthWeek;
+}
+
+#pragma mark - 获取某一年的周数(通过年求该年周数)
++ (NSUInteger)br_getWeeksOfYearInYear:(NSInteger)year {
+    NSDate *endDate = [self br_setYear:year month:12 day:31];
+    NSInteger weeks = endDate.br_yearWeek;
+    if (weeks == 1) weeks = 52;
+    return weeks;
+}
+
+#pragma mark - 获取某一年的季度数(通过年求该年季度数)
++ (NSUInteger)br_getQuartersInYear:(NSInteger)year {
+    NSDate *endDate = [self br_setYear:year month:12 day:31];
+    return endDate.br_quarter;
+}
+
+#pragma mark - 获取 日期加上/减去某天数后的新日期
+- (NSDate *)br_getNewDateToDays:(NSTimeInterval)days {
+    // days 为正数时,表示几天之后的日期;负数表示几天之前的日期
+    return [self dateByAddingTimeInterval:60 * 60 * 24 * days];
+}
+
+#pragma mark - 获取 日期加上/减去某个月数后的新日期
+- (nullable NSDate *)br_getNewDateToMonths:(NSTimeInterval)months {
+    // months 为正数时,表示几个月之后的日期;负数表示几个月之前的日期
+    NSDateComponents *components = [[NSDateComponents alloc] init];
+    [components setMonth:months];
+    NSCalendar *calender = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian];
+    return [calender dateByAddingComponents:components toDate:self options:0];
+}
+
+#pragma mark - NSDate 转 NSString
++ (NSString *)br_stringFromDate:(NSDate *)date dateFormat:(NSString *)dateFormat {
+    return [self br_stringFromDate:date dateFormat:dateFormat language:nil];
+}
+#pragma mark - NSDate 转 NSString
++ (NSString *)br_stringFromDate:(NSDate *)date
+                     dateFormat:(NSString *)dateFormat
+                       language:(NSString *)language {
+    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
+    // 设置日期格式
+    dateFormatter.dateFormat = dateFormat;
+    // NSDateFormatter 设置时区 ,不设置默认为系统时区
+    dateFormatter.timeZone = [self br_getTimeZone];
+    if (!language) {
+        language = [NSLocale preferredLanguages].firstObject;
+    }
+    dateFormatter.locale = [[NSLocale alloc]initWithLocaleIdentifier:language];
+    NSString *dateString = [dateFormatter stringFromDate:date];
+
+    return dateString;
+}
+
+#pragma mark - NSString 转 NSDate
++ (NSDate *)br_dateFromString:(NSString *)dateString dateFormat:(NSString *)dateFormat {
+    return [self br_dateFromString:dateString dateFormat:dateFormat language:nil];
+}
+#pragma mark - NSString 转 NSDate
++ (NSDate *)br_dateFromString:(NSString *)dateString
+                   dateFormat:(NSString *)dateFormat
+                     language:(NSString *)language {
+    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
+    // 设置日期格式
+    dateFormatter.dateFormat = dateFormat;
+    if (!language) {
+        language = [NSLocale preferredLanguages].firstObject;
+    }
+    // 设置时区
+    dateFormatter.timeZone = [self br_getTimeZone];
+    dateFormatter.locale = [[NSLocale alloc]initWithLocaleIdentifier:language];
+    // 如果当前时间不存在,就获取距离最近的整点时间
+    dateFormatter.lenient = YES;
+    
+    return [dateFormatter dateFromString:dateString];
+}
+
+@end

+ 51 - 0
Pods/BRPickerView/BRPickerView/Deprecated/AddressPickerView/BRAddressModel.h

@@ -0,0 +1,51 @@
+//
+//  BRAddressModel.h
+//  BRPickerViewDemo
+//
+//  Created by renbo on 2017/8/11.
+//  Copyright © 2017 irenb. All rights reserved.
+//
+//  最新代码下载地址:https://github.com/agiapp/BRPickerView
+
+#import <Foundation/Foundation.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+/// 省
+@interface BRProvinceModel : NSObject
+/** 省对应的code或id */
+@property (nullable, nonatomic, copy) NSString *code;
+/** 省的名称 */
+@property (nullable, nonatomic, copy) NSString *name;
+/** 城市数组 */
+@property (nullable, nonatomic, copy) NSArray *citylist;
+/** 记录省选择的索引位置 */
+@property (nonatomic, assign) NSInteger index;
+
+@end
+
+/// 市
+@interface BRCityModel : NSObject
+/** 市对应的code或id */
+@property (nullable, nonatomic, copy) NSString *code;
+/** 市的名称 */
+@property (nullable, nonatomic, copy) NSString *name;
+/** 地区数组 */
+@property (nullable, nonatomic, copy) NSArray *arealist;
+/** 记录市选择的索引位置 */
+@property (nonatomic, assign) NSInteger index;
+
+@end
+
+/// 区
+@interface BRAreaModel : NSObject
+/** 区对应的code或id */
+@property (nullable, nonatomic, copy) NSString *code;
+/** 区的名称 */
+@property (nullable, nonatomic, copy) NSString *name;
+/** 记录区选择的索引位置 */
+@property (nonatomic, assign) NSInteger index;
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 24 - 0
Pods/BRPickerView/BRPickerView/Deprecated/AddressPickerView/BRAddressModel.m

@@ -0,0 +1,24 @@
+//
+//  BRAddressModel.m
+//  BRPickerViewDemo
+//
+//  Created by renbo on 2017/8/11.
+//  Copyright © 2017 irenb. All rights reserved.
+//
+//  最新代码下载地址:https://github.com/agiapp/BRPickerView
+
+#import "BRAddressModel.h"
+
+@implementation BRProvinceModel
+
+@end
+
+
+@implementation BRCityModel
+
+@end
+
+
+@implementation BRAreaModel
+
+@end

+ 15394 - 0
Pods/BRPickerView/BRPickerView/Deprecated/AddressPickerView/BRAddressPickerView.bundle/BRCity.json

@@ -0,0 +1,15394 @@
+[
+  {
+    "code" : "110000",
+    "name" : "北京市",
+    "cityList" : [
+      {
+        "code" : "110100",
+        "name" : "北京城区",
+        "areaList" : [
+          {
+            "code" : "110101",
+            "name" : "东城区"
+          },
+          {
+            "code" : "110102",
+            "name" : "西城区"
+          },
+          {
+            "code" : "110105",
+            "name" : "朝阳区"
+          },
+          {
+            "code" : "110106",
+            "name" : "丰台区"
+          },
+          {
+            "code" : "110107",
+            "name" : "石景山区"
+          },
+          {
+            "code" : "110108",
+            "name" : "海淀区"
+          },
+          {
+            "code" : "110109",
+            "name" : "门头沟区"
+          },
+          {
+            "code" : "110111",
+            "name" : "房山区"
+          },
+          {
+            "code" : "110112",
+            "name" : "通州区"
+          },
+          {
+            "code" : "110113",
+            "name" : "顺义区"
+          },
+          {
+            "code" : "110114",
+            "name" : "昌平区"
+          },
+          {
+            "code" : "110115",
+            "name" : "大兴区"
+          },
+          {
+            "code" : "110116",
+            "name" : "怀柔区"
+          },
+          {
+            "code" : "110117",
+            "name" : "平谷区"
+          },
+          {
+            "code" : "110118",
+            "name" : "密云区"
+          },
+          {
+            "code" : "110119",
+            "name" : "延庆区"
+          }
+        ]
+      }
+    ]
+  },
+  {
+    "code" : "120000",
+    "name" : "天津市",
+    "cityList" : [
+      {
+        "code" : "120100",
+        "name" : "天津城区",
+        "areaList" : [
+          {
+            "code" : "120101",
+            "name" : "和平区"
+          },
+          {
+            "code" : "120102",
+            "name" : "河东区"
+          },
+          {
+            "code" : "120103",
+            "name" : "河西区"
+          },
+          {
+            "code" : "120104",
+            "name" : "南开区"
+          },
+          {
+            "code" : "120105",
+            "name" : "河北区"
+          },
+          {
+            "code" : "120106",
+            "name" : "红桥区"
+          },
+          {
+            "code" : "120110",
+            "name" : "东丽区"
+          },
+          {
+            "code" : "120111",
+            "name" : "西青区"
+          },
+          {
+            "code" : "120112",
+            "name" : "津南区"
+          },
+          {
+            "code" : "120113",
+            "name" : "北辰区"
+          },
+          {
+            "code" : "120114",
+            "name" : "武清区"
+          },
+          {
+            "code" : "120115",
+            "name" : "宝坻区"
+          },
+          {
+            "code" : "120116",
+            "name" : "滨海新区"
+          },
+          {
+            "code" : "120117",
+            "name" : "宁河区"
+          },
+          {
+            "code" : "120118",
+            "name" : "静海区"
+          },
+          {
+            "code" : "120119",
+            "name" : "蓟州区"
+          }
+        ]
+      }
+    ]
+  },
+  {
+    "code" : "130000",
+    "name" : "河北省",
+    "cityList" : [
+      {
+        "code" : "130100",
+        "name" : "石家庄市",
+        "areaList" : [
+          {
+            "code" : "130102",
+            "name" : "长安区"
+          },
+          {
+            "code" : "130104",
+            "name" : "桥西区"
+          },
+          {
+            "code" : "130105",
+            "name" : "新华区"
+          },
+          {
+            "code" : "130107",
+            "name" : "井陉矿区"
+          },
+          {
+            "code" : "130108",
+            "name" : "裕华区"
+          },
+          {
+            "code" : "130109",
+            "name" : "藁城区"
+          },
+          {
+            "code" : "130110",
+            "name" : "鹿泉区"
+          },
+          {
+            "code" : "130111",
+            "name" : "栾城区"
+          },
+          {
+            "code" : "130121",
+            "name" : "井陉县"
+          },
+          {
+            "code" : "130123",
+            "name" : "正定县"
+          },
+          {
+            "code" : "130125",
+            "name" : "行唐县"
+          },
+          {
+            "code" : "130126",
+            "name" : "灵寿县"
+          },
+          {
+            "code" : "130127",
+            "name" : "高邑县"
+          },
+          {
+            "code" : "130128",
+            "name" : "深泽县"
+          },
+          {
+            "code" : "130129",
+            "name" : "赞皇县"
+          },
+          {
+            "code" : "130130",
+            "name" : "无极县"
+          },
+          {
+            "code" : "130131",
+            "name" : "平山县"
+          },
+          {
+            "code" : "130132",
+            "name" : "元氏县"
+          },
+          {
+            "code" : "130133",
+            "name" : "赵县"
+          },
+          {
+            "code" : "130181",
+            "name" : "辛集市"
+          },
+          {
+            "code" : "130183",
+            "name" : "晋州市"
+          },
+          {
+            "code" : "130184",
+            "name" : "新乐市"
+          }
+        ]
+      },
+      {
+        "code" : "130200",
+        "name" : "唐山市",
+        "areaList" : [
+          {
+            "code" : "130202",
+            "name" : "路南区"
+          },
+          {
+            "code" : "130203",
+            "name" : "路北区"
+          },
+          {
+            "code" : "130204",
+            "name" : "古冶区"
+          },
+          {
+            "code" : "130205",
+            "name" : "开平区"
+          },
+          {
+            "code" : "130207",
+            "name" : "丰南区"
+          },
+          {
+            "code" : "130208",
+            "name" : "丰润区"
+          },
+          {
+            "code" : "130209",
+            "name" : "曹妃甸区"
+          },
+          {
+            "code" : "130224",
+            "name" : "滦南县"
+          },
+          {
+            "code" : "130225",
+            "name" : "乐亭县"
+          },
+          {
+            "code" : "130227",
+            "name" : "迁西县"
+          },
+          {
+            "code" : "130229",
+            "name" : "玉田县"
+          },
+          {
+            "code" : "130281",
+            "name" : "遵化市"
+          },
+          {
+            "code" : "130283",
+            "name" : "迁安市"
+          },
+          {
+            "code" : "130284",
+            "name" : "滦州市"
+          }
+        ]
+      },
+      {
+        "code" : "130300",
+        "name" : "秦皇岛市",
+        "areaList" : [
+          {
+            "code" : "130302",
+            "name" : "海港区"
+          },
+          {
+            "code" : "130303",
+            "name" : "山海关区"
+          },
+          {
+            "code" : "130304",
+            "name" : "北戴河区"
+          },
+          {
+            "code" : "130306",
+            "name" : "抚宁区"
+          },
+          {
+            "code" : "130321",
+            "name" : "青龙满族自治县"
+          },
+          {
+            "code" : "130322",
+            "name" : "昌黎县"
+          },
+          {
+            "code" : "130324",
+            "name" : "卢龙县"
+          }
+        ]
+      },
+      {
+        "code" : "130400",
+        "name" : "邯郸市",
+        "areaList" : [
+          {
+            "code" : "130402",
+            "name" : "邯山区"
+          },
+          {
+            "code" : "130403",
+            "name" : "丛台区"
+          },
+          {
+            "code" : "130404",
+            "name" : "复兴区"
+          },
+          {
+            "code" : "130406",
+            "name" : "峰峰矿区"
+          },
+          {
+            "code" : "130407",
+            "name" : "肥乡区"
+          },
+          {
+            "code" : "130408",
+            "name" : "永年区"
+          },
+          {
+            "code" : "130423",
+            "name" : "临漳县"
+          },
+          {
+            "code" : "130424",
+            "name" : "成安县"
+          },
+          {
+            "code" : "130425",
+            "name" : "大名县"
+          },
+          {
+            "code" : "130426",
+            "name" : "涉县"
+          },
+          {
+            "code" : "130427",
+            "name" : "磁县"
+          },
+          {
+            "code" : "130430",
+            "name" : "邱县"
+          },
+          {
+            "code" : "130431",
+            "name" : "鸡泽县"
+          },
+          {
+            "code" : "130432",
+            "name" : "广平县"
+          },
+          {
+            "code" : "130433",
+            "name" : "馆陶县"
+          },
+          {
+            "code" : "130434",
+            "name" : "魏县"
+          },
+          {
+            "code" : "130435",
+            "name" : "曲周县"
+          },
+          {
+            "code" : "130481",
+            "name" : "武安市"
+          }
+        ]
+      },
+      {
+        "code" : "130500",
+        "name" : "邢台市",
+        "areaList" : [
+          {
+            "code" : "130502",
+            "name" : "襄都区"
+          },
+          {
+            "code" : "130503",
+            "name" : "信都区"
+          },
+          {
+            "code" : "130505",
+            "name" : "任泽区"
+          },
+          {
+            "code" : "130506",
+            "name" : "南和区"
+          },
+          {
+            "code" : "130522",
+            "name" : "临城县"
+          },
+          {
+            "code" : "130523",
+            "name" : "内丘县"
+          },
+          {
+            "code" : "130524",
+            "name" : "柏乡县"
+          },
+          {
+            "code" : "130525",
+            "name" : "隆尧县"
+          },
+          {
+            "code" : "130528",
+            "name" : "宁晋县"
+          },
+          {
+            "code" : "130529",
+            "name" : "巨鹿县"
+          },
+          {
+            "code" : "130530",
+            "name" : "新河县"
+          },
+          {
+            "code" : "130531",
+            "name" : "广宗县"
+          },
+          {
+            "code" : "130532",
+            "name" : "平乡县"
+          },
+          {
+            "code" : "130533",
+            "name" : "威县"
+          },
+          {
+            "code" : "130534",
+            "name" : "清河县"
+          },
+          {
+            "code" : "130535",
+            "name" : "临西县"
+          },
+          {
+            "code" : "130581",
+            "name" : "南宫市"
+          },
+          {
+            "code" : "130582",
+            "name" : "沙河市"
+          }
+        ]
+      },
+      {
+        "code" : "130600",
+        "name" : "保定市",
+        "areaList" : [
+          {
+            "code" : "130602",
+            "name" : "竞秀区"
+          },
+          {
+            "code" : "130606",
+            "name" : "莲池区"
+          },
+          {
+            "code" : "130607",
+            "name" : "满城区"
+          },
+          {
+            "code" : "130608",
+            "name" : "清苑区"
+          },
+          {
+            "code" : "130609",
+            "name" : "徐水区"
+          },
+          {
+            "code" : "130623",
+            "name" : "涞水县"
+          },
+          {
+            "code" : "130624",
+            "name" : "阜平县"
+          },
+          {
+            "code" : "130626",
+            "name" : "定兴县"
+          },
+          {
+            "code" : "130627",
+            "name" : "唐县"
+          },
+          {
+            "code" : "130628",
+            "name" : "高阳县"
+          },
+          {
+            "code" : "130629",
+            "name" : "容城县"
+          },
+          {
+            "code" : "130630",
+            "name" : "涞源县"
+          },
+          {
+            "code" : "130631",
+            "name" : "望都县"
+          },
+          {
+            "code" : "130632",
+            "name" : "安新县"
+          },
+          {
+            "code" : "130633",
+            "name" : "易县"
+          },
+          {
+            "code" : "130634",
+            "name" : "曲阳县"
+          },
+          {
+            "code" : "130635",
+            "name" : "蠡县"
+          },
+          {
+            "code" : "130636",
+            "name" : "顺平县"
+          },
+          {
+            "code" : "130637",
+            "name" : "博野县"
+          },
+          {
+            "code" : "130638",
+            "name" : "雄县"
+          },
+          {
+            "code" : "130681",
+            "name" : "涿州市"
+          },
+          {
+            "code" : "130682",
+            "name" : "定州市"
+          },
+          {
+            "code" : "130683",
+            "name" : "安国市"
+          },
+          {
+            "code" : "130684",
+            "name" : "高碑店市"
+          }
+        ]
+      },
+      {
+        "code" : "130700",
+        "name" : "张家口市",
+        "areaList" : [
+          {
+            "code" : "130702",
+            "name" : "桥东区"
+          },
+          {
+            "code" : "130703",
+            "name" : "桥西区"
+          },
+          {
+            "code" : "130705",
+            "name" : "宣化区"
+          },
+          {
+            "code" : "130706",
+            "name" : "下花园区"
+          },
+          {
+            "code" : "130708",
+            "name" : "万全区"
+          },
+          {
+            "code" : "130709",
+            "name" : "崇礼区"
+          },
+          {
+            "code" : "130722",
+            "name" : "张北县"
+          },
+          {
+            "code" : "130723",
+            "name" : "康保县"
+          },
+          {
+            "code" : "130724",
+            "name" : "沽源县"
+          },
+          {
+            "code" : "130725",
+            "name" : "尚义县"
+          },
+          {
+            "code" : "130726",
+            "name" : "蔚县"
+          },
+          {
+            "code" : "130727",
+            "name" : "阳原县"
+          },
+          {
+            "code" : "130728",
+            "name" : "怀安县"
+          },
+          {
+            "code" : "130730",
+            "name" : "怀来县"
+          },
+          {
+            "code" : "130731",
+            "name" : "涿鹿县"
+          },
+          {
+            "code" : "130732",
+            "name" : "赤城县"
+          }
+        ]
+      },
+      {
+        "code" : "130800",
+        "name" : "承德市",
+        "areaList" : [
+          {
+            "code" : "130802",
+            "name" : "双桥区"
+          },
+          {
+            "code" : "130803",
+            "name" : "双滦区"
+          },
+          {
+            "code" : "130804",
+            "name" : "鹰手营子矿区"
+          },
+          {
+            "code" : "130821",
+            "name" : "承德县"
+          },
+          {
+            "code" : "130822",
+            "name" : "兴隆县"
+          },
+          {
+            "code" : "130824",
+            "name" : "滦平县"
+          },
+          {
+            "code" : "130825",
+            "name" : "隆化县"
+          },
+          {
+            "code" : "130826",
+            "name" : "丰宁满族自治县"
+          },
+          {
+            "code" : "130827",
+            "name" : "宽城满族自治县"
+          },
+          {
+            "code" : "130828",
+            "name" : "围场满族蒙古族自治县"
+          },
+          {
+            "code" : "130881",
+            "name" : "平泉市"
+          }
+        ]
+      },
+      {
+        "code" : "130900",
+        "name" : "沧州市",
+        "areaList" : [
+          {
+            "code" : "130902",
+            "name" : "新华区"
+          },
+          {
+            "code" : "130903",
+            "name" : "运河区"
+          },
+          {
+            "code" : "130921",
+            "name" : "沧县"
+          },
+          {
+            "code" : "130922",
+            "name" : "青县"
+          },
+          {
+            "code" : "130923",
+            "name" : "东光县"
+          },
+          {
+            "code" : "130924",
+            "name" : "海兴县"
+          },
+          {
+            "code" : "130925",
+            "name" : "盐山县"
+          },
+          {
+            "code" : "130926",
+            "name" : "肃宁县"
+          },
+          {
+            "code" : "130927",
+            "name" : "南皮县"
+          },
+          {
+            "code" : "130928",
+            "name" : "吴桥县"
+          },
+          {
+            "code" : "130929",
+            "name" : "献县"
+          },
+          {
+            "code" : "130930",
+            "name" : "孟村回族自治县"
+          },
+          {
+            "code" : "130981",
+            "name" : "泊头市"
+          },
+          {
+            "code" : "130982",
+            "name" : "任丘市"
+          },
+          {
+            "code" : "130983",
+            "name" : "黄骅市"
+          },
+          {
+            "code" : "130984",
+            "name" : "河间市"
+          }
+        ]
+      },
+      {
+        "code" : "131000",
+        "name" : "廊坊市",
+        "areaList" : [
+          {
+            "code" : "131002",
+            "name" : "安次区"
+          },
+          {
+            "code" : "131003",
+            "name" : "广阳区"
+          },
+          {
+            "code" : "131022",
+            "name" : "固安县"
+          },
+          {
+            "code" : "131023",
+            "name" : "永清县"
+          },
+          {
+            "code" : "131024",
+            "name" : "香河县"
+          },
+          {
+            "code" : "131025",
+            "name" : "大城县"
+          },
+          {
+            "code" : "131026",
+            "name" : "文安县"
+          },
+          {
+            "code" : "131028",
+            "name" : "大厂回族自治县"
+          },
+          {
+            "code" : "131081",
+            "name" : "霸州市"
+          },
+          {
+            "code" : "131082",
+            "name" : "三河市"
+          }
+        ]
+      },
+      {
+        "code" : "131100",
+        "name" : "衡水市",
+        "areaList" : [
+          {
+            "code" : "131102",
+            "name" : "桃城区"
+          },
+          {
+            "code" : "131103",
+            "name" : "冀州区"
+          },
+          {
+            "code" : "131121",
+            "name" : "枣强县"
+          },
+          {
+            "code" : "131122",
+            "name" : "武邑县"
+          },
+          {
+            "code" : "131123",
+            "name" : "武强县"
+          },
+          {
+            "code" : "131124",
+            "name" : "饶阳县"
+          },
+          {
+            "code" : "131125",
+            "name" : "安平县"
+          },
+          {
+            "code" : "131126",
+            "name" : "故城县"
+          },
+          {
+            "code" : "131127",
+            "name" : "景县"
+          },
+          {
+            "code" : "131128",
+            "name" : "阜城县"
+          },
+          {
+            "code" : "131182",
+            "name" : "深州市"
+          }
+        ]
+      }
+    ]
+  },
+  {
+    "code" : "140000",
+    "name" : "山西省",
+    "cityList" : [
+      {
+        "code" : "140100",
+        "name" : "太原市",
+        "areaList" : [
+          {
+            "code" : "140105",
+            "name" : "小店区"
+          },
+          {
+            "code" : "140106",
+            "name" : "迎泽区"
+          },
+          {
+            "code" : "140107",
+            "name" : "杏花岭区"
+          },
+          {
+            "code" : "140108",
+            "name" : "尖草坪区"
+          },
+          {
+            "code" : "140109",
+            "name" : "万柏林区"
+          },
+          {
+            "code" : "140110",
+            "name" : "晋源区"
+          },
+          {
+            "code" : "140121",
+            "name" : "清徐县"
+          },
+          {
+            "code" : "140122",
+            "name" : "阳曲县"
+          },
+          {
+            "code" : "140123",
+            "name" : "娄烦县"
+          },
+          {
+            "code" : "140181",
+            "name" : "古交市"
+          }
+        ]
+      },
+      {
+        "code" : "140200",
+        "name" : "大同市",
+        "areaList" : [
+          {
+            "code" : "140212",
+            "name" : "新荣区"
+          },
+          {
+            "code" : "140213",
+            "name" : "平城区"
+          },
+          {
+            "code" : "140214",
+            "name" : "云冈区"
+          },
+          {
+            "code" : "140215",
+            "name" : "云州区"
+          },
+          {
+            "code" : "140221",
+            "name" : "阳高县"
+          },
+          {
+            "code" : "140222",
+            "name" : "天镇县"
+          },
+          {
+            "code" : "140223",
+            "name" : "广灵县"
+          },
+          {
+            "code" : "140224",
+            "name" : "灵丘县"
+          },
+          {
+            "code" : "140225",
+            "name" : "浑源县"
+          },
+          {
+            "code" : "140226",
+            "name" : "左云县"
+          }
+        ]
+      },
+      {
+        "code" : "140300",
+        "name" : "阳泉市",
+        "areaList" : [
+          {
+            "code" : "140302",
+            "name" : "城区"
+          },
+          {
+            "code" : "140303",
+            "name" : "矿区"
+          },
+          {
+            "code" : "140311",
+            "name" : "郊区"
+          },
+          {
+            "code" : "140321",
+            "name" : "平定县"
+          },
+          {
+            "code" : "140322",
+            "name" : "盂县"
+          }
+        ]
+      },
+      {
+        "code" : "140400",
+        "name" : "长治市",
+        "areaList" : [
+          {
+            "code" : "140403",
+            "name" : "潞州区"
+          },
+          {
+            "code" : "140404",
+            "name" : "上党区"
+          },
+          {
+            "code" : "140405",
+            "name" : "屯留区"
+          },
+          {
+            "code" : "140406",
+            "name" : "潞城区"
+          },
+          {
+            "code" : "140423",
+            "name" : "襄垣县"
+          },
+          {
+            "code" : "140425",
+            "name" : "平顺县"
+          },
+          {
+            "code" : "140426",
+            "name" : "黎城县"
+          },
+          {
+            "code" : "140427",
+            "name" : "壶关县"
+          },
+          {
+            "code" : "140428",
+            "name" : "长子县"
+          },
+          {
+            "code" : "140429",
+            "name" : "武乡县"
+          },
+          {
+            "code" : "140430",
+            "name" : "沁县"
+          },
+          {
+            "code" : "140431",
+            "name" : "沁源县"
+          }
+        ]
+      },
+      {
+        "code" : "140500",
+        "name" : "晋城市",
+        "areaList" : [
+          {
+            "code" : "140502",
+            "name" : "城区"
+          },
+          {
+            "code" : "140521",
+            "name" : "沁水县"
+          },
+          {
+            "code" : "140522",
+            "name" : "阳城县"
+          },
+          {
+            "code" : "140524",
+            "name" : "陵川县"
+          },
+          {
+            "code" : "140525",
+            "name" : "泽州县"
+          },
+          {
+            "code" : "140581",
+            "name" : "高平市"
+          }
+        ]
+      },
+      {
+        "code" : "140600",
+        "name" : "朔州市",
+        "areaList" : [
+          {
+            "code" : "140602",
+            "name" : "朔城区"
+          },
+          {
+            "code" : "140603",
+            "name" : "平鲁区"
+          },
+          {
+            "code" : "140621",
+            "name" : "山阴县"
+          },
+          {
+            "code" : "140622",
+            "name" : "应县"
+          },
+          {
+            "code" : "140623",
+            "name" : "右玉县"
+          },
+          {
+            "code" : "140681",
+            "name" : "怀仁市"
+          }
+        ]
+      },
+      {
+        "code" : "140700",
+        "name" : "晋中市",
+        "areaList" : [
+          {
+            "code" : "140702",
+            "name" : "榆次区"
+          },
+          {
+            "code" : "140703",
+            "name" : "太谷区"
+          },
+          {
+            "code" : "140721",
+            "name" : "榆社县"
+          },
+          {
+            "code" : "140722",
+            "name" : "左权县"
+          },
+          {
+            "code" : "140723",
+            "name" : "和顺县"
+          },
+          {
+            "code" : "140724",
+            "name" : "昔阳县"
+          },
+          {
+            "code" : "140725",
+            "name" : "寿阳县"
+          },
+          {
+            "code" : "140727",
+            "name" : "祁县"
+          },
+          {
+            "code" : "140728",
+            "name" : "平遥县"
+          },
+          {
+            "code" : "140729",
+            "name" : "灵石县"
+          },
+          {
+            "code" : "140781",
+            "name" : "介休市"
+          }
+        ]
+      },
+      {
+        "code" : "140800",
+        "name" : "运城市",
+        "areaList" : [
+          {
+            "code" : "140802",
+            "name" : "盐湖区"
+          },
+          {
+            "code" : "140821",
+            "name" : "临猗县"
+          },
+          {
+            "code" : "140822",
+            "name" : "万荣县"
+          },
+          {
+            "code" : "140823",
+            "name" : "闻喜县"
+          },
+          {
+            "code" : "140824",
+            "name" : "稷山县"
+          },
+          {
+            "code" : "140825",
+            "name" : "新绛县"
+          },
+          {
+            "code" : "140826",
+            "name" : "绛县"
+          },
+          {
+            "code" : "140827",
+            "name" : "垣曲县"
+          },
+          {
+            "code" : "140828",
+            "name" : "夏县"
+          },
+          {
+            "code" : "140829",
+            "name" : "平陆县"
+          },
+          {
+            "code" : "140830",
+            "name" : "芮城县"
+          },
+          {
+            "code" : "140881",
+            "name" : "永济市"
+          },
+          {
+            "code" : "140882",
+            "name" : "河津市"
+          }
+        ]
+      },
+      {
+        "code" : "140900",
+        "name" : "忻州市",
+        "areaList" : [
+          {
+            "code" : "140902",
+            "name" : "忻府区"
+          },
+          {
+            "code" : "140921",
+            "name" : "定襄县"
+          },
+          {
+            "code" : "140922",
+            "name" : "五台县"
+          },
+          {
+            "code" : "140923",
+            "name" : "代县"
+          },
+          {
+            "code" : "140924",
+            "name" : "繁峙县"
+          },
+          {
+            "code" : "140925",
+            "name" : "宁武县"
+          },
+          {
+            "code" : "140926",
+            "name" : "静乐县"
+          },
+          {
+            "code" : "140927",
+            "name" : "神池县"
+          },
+          {
+            "code" : "140928",
+            "name" : "五寨县"
+          },
+          {
+            "code" : "140929",
+            "name" : "岢岚县"
+          },
+          {
+            "code" : "140930",
+            "name" : "河曲县"
+          },
+          {
+            "code" : "140931",
+            "name" : "保德县"
+          },
+          {
+            "code" : "140932",
+            "name" : "偏关县"
+          },
+          {
+            "code" : "140981",
+            "name" : "原平市"
+          }
+        ]
+      },
+      {
+        "code" : "141000",
+        "name" : "临汾市",
+        "areaList" : [
+          {
+            "code" : "141002",
+            "name" : "尧都区"
+          },
+          {
+            "code" : "141021",
+            "name" : "曲沃县"
+          },
+          {
+            "code" : "141022",
+            "name" : "翼城县"
+          },
+          {
+            "code" : "141023",
+            "name" : "襄汾县"
+          },
+          {
+            "code" : "141024",
+            "name" : "洪洞县"
+          },
+          {
+            "code" : "141025",
+            "name" : "古县"
+          },
+          {
+            "code" : "141026",
+            "name" : "安泽县"
+          },
+          {
+            "code" : "141027",
+            "name" : "浮山县"
+          },
+          {
+            "code" : "141028",
+            "name" : "吉县"
+          },
+          {
+            "code" : "141029",
+            "name" : "乡宁县"
+          },
+          {
+            "code" : "141030",
+            "name" : "大宁县"
+          },
+          {
+            "code" : "141031",
+            "name" : "隰县"
+          },
+          {
+            "code" : "141032",
+            "name" : "永和县"
+          },
+          {
+            "code" : "141033",
+            "name" : "蒲县"
+          },
+          {
+            "code" : "141034",
+            "name" : "汾西县"
+          },
+          {
+            "code" : "141081",
+            "name" : "侯马市"
+          },
+          {
+            "code" : "141082",
+            "name" : "霍州市"
+          }
+        ]
+      },
+      {
+        "code" : "141100",
+        "name" : "吕梁市",
+        "areaList" : [
+          {
+            "code" : "141102",
+            "name" : "离石区"
+          },
+          {
+            "code" : "141121",
+            "name" : "文水县"
+          },
+          {
+            "code" : "141122",
+            "name" : "交城县"
+          },
+          {
+            "code" : "141123",
+            "name" : "兴县"
+          },
+          {
+            "code" : "141124",
+            "name" : "临县"
+          },
+          {
+            "code" : "141125",
+            "name" : "柳林县"
+          },
+          {
+            "code" : "141126",
+            "name" : "石楼县"
+          },
+          {
+            "code" : "141127",
+            "name" : "岚县"
+          },
+          {
+            "code" : "141128",
+            "name" : "方山县"
+          },
+          {
+            "code" : "141129",
+            "name" : "中阳县"
+          },
+          {
+            "code" : "141130",
+            "name" : "交口县"
+          },
+          {
+            "code" : "141181",
+            "name" : "孝义市"
+          },
+          {
+            "code" : "141182",
+            "name" : "汾阳市"
+          }
+        ]
+      }
+    ]
+  },
+  {
+    "code" : "150000",
+    "name" : "内蒙古自治区",
+    "cityList" : [
+      {
+        "code" : "150100",
+        "name" : "呼和浩特市",
+        "areaList" : [
+          {
+            "code" : "150102",
+            "name" : "新城区"
+          },
+          {
+            "code" : "150103",
+            "name" : "回民区"
+          },
+          {
+            "code" : "150104",
+            "name" : "玉泉区"
+          },
+          {
+            "code" : "150105",
+            "name" : "赛罕区"
+          },
+          {
+            "code" : "150121",
+            "name" : "土默特左旗"
+          },
+          {
+            "code" : "150122",
+            "name" : "托克托县"
+          },
+          {
+            "code" : "150123",
+            "name" : "和林格尔县"
+          },
+          {
+            "code" : "150124",
+            "name" : "清水河县"
+          },
+          {
+            "code" : "150125",
+            "name" : "武川县"
+          }
+        ]
+      },
+      {
+        "code" : "150200",
+        "name" : "包头市",
+        "areaList" : [
+          {
+            "code" : "150202",
+            "name" : "东河区"
+          },
+          {
+            "code" : "150203",
+            "name" : "昆都仑区"
+          },
+          {
+            "code" : "150204",
+            "name" : "青山区"
+          },
+          {
+            "code" : "150205",
+            "name" : "石拐区"
+          },
+          {
+            "code" : "150206",
+            "name" : "白云鄂博矿区"
+          },
+          {
+            "code" : "150207",
+            "name" : "九原区"
+          },
+          {
+            "code" : "150221",
+            "name" : "土默特右旗"
+          },
+          {
+            "code" : "150222",
+            "name" : "固阳县"
+          },
+          {
+            "code" : "150223",
+            "name" : "达尔罕茂明安联合旗"
+          }
+        ]
+      },
+      {
+        "code" : "150300",
+        "name" : "乌海市",
+        "areaList" : [
+          {
+            "code" : "150302",
+            "name" : "海勃湾区"
+          },
+          {
+            "code" : "150303",
+            "name" : "海南区"
+          },
+          {
+            "code" : "150304",
+            "name" : "乌达区"
+          }
+        ]
+      },
+      {
+        "code" : "150400",
+        "name" : "赤峰市",
+        "areaList" : [
+          {
+            "code" : "150402",
+            "name" : "红山区"
+          },
+          {
+            "code" : "150403",
+            "name" : "元宝山区"
+          },
+          {
+            "code" : "150404",
+            "name" : "松山区"
+          },
+          {
+            "code" : "150421",
+            "name" : "阿鲁科尔沁旗"
+          },
+          {
+            "code" : "150422",
+            "name" : "巴林左旗"
+          },
+          {
+            "code" : "150423",
+            "name" : "巴林右旗"
+          },
+          {
+            "code" : "150424",
+            "name" : "林西县"
+          },
+          {
+            "code" : "150425",
+            "name" : "克什克腾旗"
+          },
+          {
+            "code" : "150426",
+            "name" : "翁牛特旗"
+          },
+          {
+            "code" : "150428",
+            "name" : "喀喇沁旗"
+          },
+          {
+            "code" : "150429",
+            "name" : "宁城县"
+          },
+          {
+            "code" : "150430",
+            "name" : "敖汉旗"
+          }
+        ]
+      },
+      {
+        "code" : "150500",
+        "name" : "通辽市",
+        "areaList" : [
+          {
+            "code" : "150502",
+            "name" : "科尔沁区"
+          },
+          {
+            "code" : "150521",
+            "name" : "科尔沁左翼中旗"
+          },
+          {
+            "code" : "150522",
+            "name" : "科尔沁左翼后旗"
+          },
+          {
+            "code" : "150523",
+            "name" : "开鲁县"
+          },
+          {
+            "code" : "150524",
+            "name" : "库伦旗"
+          },
+          {
+            "code" : "150525",
+            "name" : "奈曼旗"
+          },
+          {
+            "code" : "150526",
+            "name" : "扎鲁特旗"
+          },
+          {
+            "code" : "150581",
+            "name" : "霍林郭勒市"
+          }
+        ]
+      },
+      {
+        "code" : "150600",
+        "name" : "鄂尔多斯市",
+        "areaList" : [
+          {
+            "code" : "150602",
+            "name" : "东胜区"
+          },
+          {
+            "code" : "150603",
+            "name" : "康巴什区"
+          },
+          {
+            "code" : "150621",
+            "name" : "达拉特旗"
+          },
+          {
+            "code" : "150622",
+            "name" : "准格尔旗"
+          },
+          {
+            "code" : "150623",
+            "name" : "鄂托克前旗"
+          },
+          {
+            "code" : "150624",
+            "name" : "鄂托克旗"
+          },
+          {
+            "code" : "150625",
+            "name" : "杭锦旗"
+          },
+          {
+            "code" : "150626",
+            "name" : "乌审旗"
+          },
+          {
+            "code" : "150627",
+            "name" : "伊金霍洛旗"
+          }
+        ]
+      },
+      {
+        "code" : "150700",
+        "name" : "呼伦贝尔市",
+        "areaList" : [
+          {
+            "code" : "150702",
+            "name" : "海拉尔区"
+          },
+          {
+            "code" : "150703",
+            "name" : "扎赉诺尔区"
+          },
+          {
+            "code" : "150721",
+            "name" : "阿荣旗"
+          },
+          {
+            "code" : "150722",
+            "name" : "莫力达瓦达斡尔族自治旗"
+          },
+          {
+            "code" : "150723",
+            "name" : "鄂伦春自治旗"
+          },
+          {
+            "code" : "150724",
+            "name" : "鄂温克族自治旗"
+          },
+          {
+            "code" : "150725",
+            "name" : "陈巴尔虎旗"
+          },
+          {
+            "code" : "150726",
+            "name" : "新巴尔虎左旗"
+          },
+          {
+            "code" : "150727",
+            "name" : "新巴尔虎右旗"
+          },
+          {
+            "code" : "150781",
+            "name" : "满洲里市"
+          },
+          {
+            "code" : "150782",
+            "name" : "牙克石市"
+          },
+          {
+            "code" : "150783",
+            "name" : "扎兰屯市"
+          },
+          {
+            "code" : "150784",
+            "name" : "额尔古纳市"
+          },
+          {
+            "code" : "150785",
+            "name" : "根河市"
+          }
+        ]
+      },
+      {
+        "code" : "150800",
+        "name" : "巴彦淖尔市",
+        "areaList" : [
+          {
+            "code" : "150802",
+            "name" : "临河区"
+          },
+          {
+            "code" : "150821",
+            "name" : "五原县"
+          },
+          {
+            "code" : "150822",
+            "name" : "磴口县"
+          },
+          {
+            "code" : "150823",
+            "name" : "乌拉特前旗"
+          },
+          {
+            "code" : "150824",
+            "name" : "乌拉特中旗"
+          },
+          {
+            "code" : "150825",
+            "name" : "乌拉特后旗"
+          },
+          {
+            "code" : "150826",
+            "name" : "杭锦后旗"
+          }
+        ]
+      },
+      {
+        "code" : "150900",
+        "name" : "乌兰察布市",
+        "areaList" : [
+          {
+            "code" : "150902",
+            "name" : "集宁区"
+          },
+          {
+            "code" : "150921",
+            "name" : "卓资县"
+          },
+          {
+            "code" : "150922",
+            "name" : "化德县"
+          },
+          {
+            "code" : "150923",
+            "name" : "商都县"
+          },
+          {
+            "code" : "150924",
+            "name" : "兴和县"
+          },
+          {
+            "code" : "150925",
+            "name" : "凉城县"
+          },
+          {
+            "code" : "150926",
+            "name" : "察哈尔右翼前旗"
+          },
+          {
+            "code" : "150927",
+            "name" : "察哈尔右翼中旗"
+          },
+          {
+            "code" : "150928",
+            "name" : "察哈尔右翼后旗"
+          },
+          {
+            "code" : "150929",
+            "name" : "四子王旗"
+          },
+          {
+            "code" : "150981",
+            "name" : "丰镇市"
+          }
+        ]
+      },
+      {
+        "code" : "152200",
+        "name" : "兴安盟",
+        "areaList" : [
+          {
+            "code" : "152201",
+            "name" : "乌兰浩特市"
+          },
+          {
+            "code" : "152202",
+            "name" : "阿尔山市"
+          },
+          {
+            "code" : "152221",
+            "name" : "科尔沁右翼前旗"
+          },
+          {
+            "code" : "152222",
+            "name" : "科尔沁右翼中旗"
+          },
+          {
+            "code" : "152223",
+            "name" : "扎赉特旗"
+          },
+          {
+            "code" : "152224",
+            "name" : "突泉县"
+          }
+        ]
+      },
+      {
+        "code" : "152500",
+        "name" : "锡林郭勒盟",
+        "areaList" : [
+          {
+            "code" : "152501",
+            "name" : "二连浩特市"
+          },
+          {
+            "code" : "152502",
+            "name" : "锡林浩特市"
+          },
+          {
+            "code" : "152522",
+            "name" : "阿巴嘎旗"
+          },
+          {
+            "code" : "152523",
+            "name" : "苏尼特左旗"
+          },
+          {
+            "code" : "152524",
+            "name" : "苏尼特右旗"
+          },
+          {
+            "code" : "152525",
+            "name" : "东乌珠穆沁旗"
+          },
+          {
+            "code" : "152526",
+            "name" : "西乌珠穆沁旗"
+          },
+          {
+            "code" : "152527",
+            "name" : "太仆寺旗"
+          },
+          {
+            "code" : "152528",
+            "name" : "镶黄旗"
+          },
+          {
+            "code" : "152529",
+            "name" : "正镶白旗"
+          },
+          {
+            "code" : "152530",
+            "name" : "正蓝旗"
+          },
+          {
+            "code" : "152531",
+            "name" : "多伦县"
+          }
+        ]
+      },
+      {
+        "code" : "152900",
+        "name" : "阿拉善盟",
+        "areaList" : [
+          {
+            "code" : "152921",
+            "name" : "阿拉善左旗"
+          },
+          {
+            "code" : "152922",
+            "name" : "阿拉善右旗"
+          },
+          {
+            "code" : "152923",
+            "name" : "额济纳旗"
+          }
+        ]
+      }
+    ]
+  },
+  {
+    "code" : "210000",
+    "name" : "辽宁省",
+    "cityList" : [
+      {
+        "code" : "210100",
+        "name" : "沈阳市",
+        "areaList" : [
+          {
+            "code" : "210102",
+            "name" : "和平区"
+          },
+          {
+            "code" : "210103",
+            "name" : "沈河区"
+          },
+          {
+            "code" : "210104",
+            "name" : "大东区"
+          },
+          {
+            "code" : "210105",
+            "name" : "皇姑区"
+          },
+          {
+            "code" : "210106",
+            "name" : "铁西区"
+          },
+          {
+            "code" : "210111",
+            "name" : "苏家屯区"
+          },
+          {
+            "code" : "210112",
+            "name" : "浑南区"
+          },
+          {
+            "code" : "210113",
+            "name" : "沈北新区"
+          },
+          {
+            "code" : "210114",
+            "name" : "于洪区"
+          },
+          {
+            "code" : "210115",
+            "name" : "辽中区"
+          },
+          {
+            "code" : "210123",
+            "name" : "康平县"
+          },
+          {
+            "code" : "210124",
+            "name" : "法库县"
+          },
+          {
+            "code" : "210181",
+            "name" : "新民市"
+          }
+        ]
+      },
+      {
+        "code" : "210200",
+        "name" : "大连市",
+        "areaList" : [
+          {
+            "code" : "210202",
+            "name" : "中山区"
+          },
+          {
+            "code" : "210203",
+            "name" : "西岗区"
+          },
+          {
+            "code" : "210204",
+            "name" : "沙河口区"
+          },
+          {
+            "code" : "210211",
+            "name" : "甘井子区"
+          },
+          {
+            "code" : "210212",
+            "name" : "旅顺口区"
+          },
+          {
+            "code" : "210213",
+            "name" : "金州区"
+          },
+          {
+            "code" : "210214",
+            "name" : "普兰店区"
+          },
+          {
+            "code" : "210224",
+            "name" : "长海县"
+          },
+          {
+            "code" : "210281",
+            "name" : "瓦房店市"
+          },
+          {
+            "code" : "210283",
+            "name" : "庄河市"
+          }
+        ]
+      },
+      {
+        "code" : "210300",
+        "name" : "鞍山市",
+        "areaList" : [
+          {
+            "code" : "210302",
+            "name" : "铁东区"
+          },
+          {
+            "code" : "210303",
+            "name" : "铁西区"
+          },
+          {
+            "code" : "210304",
+            "name" : "立山区"
+          },
+          {
+            "code" : "210311",
+            "name" : "千山区"
+          },
+          {
+            "code" : "210321",
+            "name" : "台安县"
+          },
+          {
+            "code" : "210323",
+            "name" : "岫岩满族自治县"
+          },
+          {
+            "code" : "210381",
+            "name" : "海城市"
+          }
+        ]
+      },
+      {
+        "code" : "210400",
+        "name" : "抚顺市",
+        "areaList" : [
+          {
+            "code" : "210402",
+            "name" : "新抚区"
+          },
+          {
+            "code" : "210403",
+            "name" : "东洲区"
+          },
+          {
+            "code" : "210404",
+            "name" : "望花区"
+          },
+          {
+            "code" : "210411",
+            "name" : "顺城区"
+          },
+          {
+            "code" : "210421",
+            "name" : "抚顺县"
+          },
+          {
+            "code" : "210422",
+            "name" : "新宾满族自治县"
+          },
+          {
+            "code" : "210423",
+            "name" : "清原满族自治县"
+          }
+        ]
+      },
+      {
+        "code" : "210500",
+        "name" : "本溪市",
+        "areaList" : [
+          {
+            "code" : "210502",
+            "name" : "平山区"
+          },
+          {
+            "code" : "210503",
+            "name" : "溪湖区"
+          },
+          {
+            "code" : "210504",
+            "name" : "明山区"
+          },
+          {
+            "code" : "210505",
+            "name" : "南芬区"
+          },
+          {
+            "code" : "210521",
+            "name" : "本溪满族自治县"
+          },
+          {
+            "code" : "210522",
+            "name" : "桓仁满族自治县"
+          }
+        ]
+      },
+      {
+        "code" : "210600",
+        "name" : "丹东市",
+        "areaList" : [
+          {
+            "code" : "210602",
+            "name" : "元宝区"
+          },
+          {
+            "code" : "210603",
+            "name" : "振兴区"
+          },
+          {
+            "code" : "210604",
+            "name" : "振安区"
+          },
+          {
+            "code" : "210624",
+            "name" : "宽甸满族自治县"
+          },
+          {
+            "code" : "210681",
+            "name" : "东港市"
+          },
+          {
+            "code" : "210682",
+            "name" : "凤城市"
+          }
+        ]
+      },
+      {
+        "code" : "210700",
+        "name" : "锦州市",
+        "areaList" : [
+          {
+            "code" : "210702",
+            "name" : "古塔区"
+          },
+          {
+            "code" : "210703",
+            "name" : "凌河区"
+          },
+          {
+            "code" : "210711",
+            "name" : "太和区"
+          },
+          {
+            "code" : "210726",
+            "name" : "黑山县"
+          },
+          {
+            "code" : "210727",
+            "name" : "义县"
+          },
+          {
+            "code" : "210781",
+            "name" : "凌海市"
+          },
+          {
+            "code" : "210782",
+            "name" : "北镇市"
+          }
+        ]
+      },
+      {
+        "code" : "210800",
+        "name" : "营口市",
+        "areaList" : [
+          {
+            "code" : "210802",
+            "name" : "站前区"
+          },
+          {
+            "code" : "210803",
+            "name" : "西市区"
+          },
+          {
+            "code" : "210804",
+            "name" : "鲅鱼圈区"
+          },
+          {
+            "code" : "210811",
+            "name" : "老边区"
+          },
+          {
+            "code" : "210881",
+            "name" : "盖州市"
+          },
+          {
+            "code" : "210882",
+            "name" : "大石桥市"
+          }
+        ]
+      },
+      {
+        "code" : "210900",
+        "name" : "阜新市",
+        "areaList" : [
+          {
+            "code" : "210902",
+            "name" : "海州区"
+          },
+          {
+            "code" : "210903",
+            "name" : "新邱区"
+          },
+          {
+            "code" : "210904",
+            "name" : "太平区"
+          },
+          {
+            "code" : "210905",
+            "name" : "清河门区"
+          },
+          {
+            "code" : "210911",
+            "name" : "细河区"
+          },
+          {
+            "code" : "210921",
+            "name" : "阜新蒙古族自治县"
+          },
+          {
+            "code" : "210922",
+            "name" : "彰武县"
+          }
+        ]
+      },
+      {
+        "code" : "211000",
+        "name" : "辽阳市",
+        "areaList" : [
+          {
+            "code" : "211002",
+            "name" : "白塔区"
+          },
+          {
+            "code" : "211003",
+            "name" : "文圣区"
+          },
+          {
+            "code" : "211004",
+            "name" : "宏伟区"
+          },
+          {
+            "code" : "211005",
+            "name" : "弓长岭区"
+          },
+          {
+            "code" : "211011",
+            "name" : "太子河区"
+          },
+          {
+            "code" : "211021",
+            "name" : "辽阳县"
+          },
+          {
+            "code" : "211081",
+            "name" : "灯塔市"
+          }
+        ]
+      },
+      {
+        "code" : "211100",
+        "name" : "盘锦市",
+        "areaList" : [
+          {
+            "code" : "211102",
+            "name" : "双台子区"
+          },
+          {
+            "code" : "211103",
+            "name" : "兴隆台区"
+          },
+          {
+            "code" : "211104",
+            "name" : "大洼区"
+          },
+          {
+            "code" : "211122",
+            "name" : "盘山县"
+          }
+        ]
+      },
+      {
+        "code" : "211200",
+        "name" : "铁岭市",
+        "areaList" : [
+          {
+            "code" : "211202",
+            "name" : "银州区"
+          },
+          {
+            "code" : "211204",
+            "name" : "清河区"
+          },
+          {
+            "code" : "211221",
+            "name" : "铁岭县"
+          },
+          {
+            "code" : "211223",
+            "name" : "西丰县"
+          },
+          {
+            "code" : "211224",
+            "name" : "昌图县"
+          },
+          {
+            "code" : "211281",
+            "name" : "调兵山市"
+          },
+          {
+            "code" : "211282",
+            "name" : "开原市"
+          }
+        ]
+      },
+      {
+        "code" : "211300",
+        "name" : "朝阳市",
+        "areaList" : [
+          {
+            "code" : "211302",
+            "name" : "双塔区"
+          },
+          {
+            "code" : "211303",
+            "name" : "龙城区"
+          },
+          {
+            "code" : "211321",
+            "name" : "朝阳县"
+          },
+          {
+            "code" : "211322",
+            "name" : "建平县"
+          },
+          {
+            "code" : "211324",
+            "name" : "喀喇沁左翼蒙古族自治县"
+          },
+          {
+            "code" : "211381",
+            "name" : "北票市"
+          },
+          {
+            "code" : "211382",
+            "name" : "凌源市"
+          }
+        ]
+      },
+      {
+        "code" : "211400",
+        "name" : "葫芦岛市",
+        "areaList" : [
+          {
+            "code" : "211402",
+            "name" : "连山区"
+          },
+          {
+            "code" : "211403",
+            "name" : "龙港区"
+          },
+          {
+            "code" : "211404",
+            "name" : "南票区"
+          },
+          {
+            "code" : "211421",
+            "name" : "绥中县"
+          },
+          {
+            "code" : "211422",
+            "name" : "建昌县"
+          },
+          {
+            "code" : "211481",
+            "name" : "兴城市"
+          }
+        ]
+      }
+    ]
+  },
+  {
+    "code" : "220000",
+    "name" : "吉林省",
+    "cityList" : [
+      {
+        "code" : "220100",
+        "name" : "长春市",
+        "areaList" : [
+          {
+            "code" : "220102",
+            "name" : "南关区"
+          },
+          {
+            "code" : "220103",
+            "name" : "宽城区"
+          },
+          {
+            "code" : "220104",
+            "name" : "朝阳区"
+          },
+          {
+            "code" : "220105",
+            "name" : "二道区"
+          },
+          {
+            "code" : "220106",
+            "name" : "绿园区"
+          },
+          {
+            "code" : "220112",
+            "name" : "双阳区"
+          },
+          {
+            "code" : "220113",
+            "name" : "九台区"
+          },
+          {
+            "code" : "220122",
+            "name" : "农安县"
+          },
+          {
+            "code" : "220182",
+            "name" : "榆树市"
+          },
+          {
+            "code" : "220183",
+            "name" : "德惠市"
+          },
+          {
+            "code" : "220184",
+            "name" : "公主岭市"
+          }
+        ]
+      },
+      {
+        "code" : "220200",
+        "name" : "吉林市",
+        "areaList" : [
+          {
+            "code" : "220202",
+            "name" : "昌邑区"
+          },
+          {
+            "code" : "220203",
+            "name" : "龙潭区"
+          },
+          {
+            "code" : "220204",
+            "name" : "船营区"
+          },
+          {
+            "code" : "220211",
+            "name" : "丰满区"
+          },
+          {
+            "code" : "220221",
+            "name" : "永吉县"
+          },
+          {
+            "code" : "220281",
+            "name" : "蛟河市"
+          },
+          {
+            "code" : "220282",
+            "name" : "桦甸市"
+          },
+          {
+            "code" : "220283",
+            "name" : "舒兰市"
+          },
+          {
+            "code" : "220284",
+            "name" : "磐石市"
+          }
+        ]
+      },
+      {
+        "code" : "220300",
+        "name" : "四平市",
+        "areaList" : [
+          {
+            "code" : "220302",
+            "name" : "铁西区"
+          },
+          {
+            "code" : "220303",
+            "name" : "铁东区"
+          },
+          {
+            "code" : "220322",
+            "name" : "梨树县"
+          },
+          {
+            "code" : "220323",
+            "name" : "伊通满族自治县"
+          },
+          {
+            "code" : "220382",
+            "name" : "双辽市"
+          }
+        ]
+      },
+      {
+        "code" : "220400",
+        "name" : "辽源市",
+        "areaList" : [
+          {
+            "code" : "220402",
+            "name" : "龙山区"
+          },
+          {
+            "code" : "220403",
+            "name" : "西安区"
+          },
+          {
+            "code" : "220421",
+            "name" : "东丰县"
+          },
+          {
+            "code" : "220422",
+            "name" : "东辽县"
+          }
+        ]
+      },
+      {
+        "code" : "220500",
+        "name" : "通化市",
+        "areaList" : [
+          {
+            "code" : "220502",
+            "name" : "东昌区"
+          },
+          {
+            "code" : "220503",
+            "name" : "二道江区"
+          },
+          {
+            "code" : "220521",
+            "name" : "通化县"
+          },
+          {
+            "code" : "220523",
+            "name" : "辉南县"
+          },
+          {
+            "code" : "220524",
+            "name" : "柳河县"
+          },
+          {
+            "code" : "220581",
+            "name" : "梅河口市"
+          },
+          {
+            "code" : "220582",
+            "name" : "集安市"
+          }
+        ]
+      },
+      {
+        "code" : "220600",
+        "name" : "白山市",
+        "areaList" : [
+          {
+            "code" : "220602",
+            "name" : "浑江区"
+          },
+          {
+            "code" : "220605",
+            "name" : "江源区"
+          },
+          {
+            "code" : "220621",
+            "name" : "抚松县"
+          },
+          {
+            "code" : "220622",
+            "name" : "靖宇县"
+          },
+          {
+            "code" : "220623",
+            "name" : "长白朝鲜族自治县"
+          },
+          {
+            "code" : "220681",
+            "name" : "临江市"
+          }
+        ]
+      },
+      {
+        "code" : "220700",
+        "name" : "松原市",
+        "areaList" : [
+          {
+            "code" : "220702",
+            "name" : "宁江区"
+          },
+          {
+            "code" : "220721",
+            "name" : "前郭尔罗斯蒙古族自治县"
+          },
+          {
+            "code" : "220722",
+            "name" : "长岭县"
+          },
+          {
+            "code" : "220723",
+            "name" : "乾安县"
+          },
+          {
+            "code" : "220781",
+            "name" : "扶余市"
+          }
+        ]
+      },
+      {
+        "code" : "220800",
+        "name" : "白城市",
+        "areaList" : [
+          {
+            "code" : "220802",
+            "name" : "洮北区"
+          },
+          {
+            "code" : "220821",
+            "name" : "镇赉县"
+          },
+          {
+            "code" : "220822",
+            "name" : "通榆县"
+          },
+          {
+            "code" : "220881",
+            "name" : "洮南市"
+          },
+          {
+            "code" : "220882",
+            "name" : "大安市"
+          }
+        ]
+      },
+      {
+        "code" : "222400",
+        "name" : "延边朝鲜族自治州",
+        "areaList" : [
+          {
+            "code" : "222401",
+            "name" : "延吉市"
+          },
+          {
+            "code" : "222402",
+            "name" : "图们市"
+          },
+          {
+            "code" : "222403",
+            "name" : "敦化市"
+          },
+          {
+            "code" : "222404",
+            "name" : "珲春市"
+          },
+          {
+            "code" : "222405",
+            "name" : "龙井市"
+          },
+          {
+            "code" : "222406",
+            "name" : "和龙市"
+          },
+          {
+            "code" : "222424",
+            "name" : "汪清县"
+          },
+          {
+            "code" : "222426",
+            "name" : "安图县"
+          }
+        ]
+      }
+    ]
+  },
+  {
+    "code" : "230000",
+    "name" : "黑龙江省",
+    "cityList" : [
+      {
+        "code" : "230100",
+        "name" : "哈尔滨市",
+        "areaList" : [
+          {
+            "code" : "230102",
+            "name" : "道里区"
+          },
+          {
+            "code" : "230103",
+            "name" : "南岗区"
+          },
+          {
+            "code" : "230104",
+            "name" : "道外区"
+          },
+          {
+            "code" : "230108",
+            "name" : "平房区"
+          },
+          {
+            "code" : "230109",
+            "name" : "松北区"
+          },
+          {
+            "code" : "230110",
+            "name" : "香坊区"
+          },
+          {
+            "code" : "230111",
+            "name" : "呼兰区"
+          },
+          {
+            "code" : "230112",
+            "name" : "阿城区"
+          },
+          {
+            "code" : "230113",
+            "name" : "双城区"
+          },
+          {
+            "code" : "230123",
+            "name" : "依兰县"
+          },
+          {
+            "code" : "230124",
+            "name" : "方正县"
+          },
+          {
+            "code" : "230125",
+            "name" : "宾县"
+          },
+          {
+            "code" : "230126",
+            "name" : "巴彦县"
+          },
+          {
+            "code" : "230127",
+            "name" : "木兰县"
+          },
+          {
+            "code" : "230128",
+            "name" : "通河县"
+          },
+          {
+            "code" : "230129",
+            "name" : "延寿县"
+          },
+          {
+            "code" : "230183",
+            "name" : "尚志市"
+          },
+          {
+            "code" : "230184",
+            "name" : "五常市"
+          }
+        ]
+      },
+      {
+        "code" : "230200",
+        "name" : "齐齐哈尔市",
+        "areaList" : [
+          {
+            "code" : "230202",
+            "name" : "龙沙区"
+          },
+          {
+            "code" : "230203",
+            "name" : "建华区"
+          },
+          {
+            "code" : "230204",
+            "name" : "铁锋区"
+          },
+          {
+            "code" : "230205",
+            "name" : "昂昂溪区"
+          },
+          {
+            "code" : "230206",
+            "name" : "富拉尔基区"
+          },
+          {
+            "code" : "230207",
+            "name" : "碾子山区"
+          },
+          {
+            "code" : "230208",
+            "name" : "梅里斯达斡尔族区"
+          },
+          {
+            "code" : "230221",
+            "name" : "龙江县"
+          },
+          {
+            "code" : "230223",
+            "name" : "依安县"
+          },
+          {
+            "code" : "230224",
+            "name" : "泰来县"
+          },
+          {
+            "code" : "230225",
+            "name" : "甘南县"
+          },
+          {
+            "code" : "230227",
+            "name" : "富裕县"
+          },
+          {
+            "code" : "230229",
+            "name" : "克山县"
+          },
+          {
+            "code" : "230230",
+            "name" : "克东县"
+          },
+          {
+            "code" : "230231",
+            "name" : "拜泉县"
+          },
+          {
+            "code" : "230281",
+            "name" : "讷河市"
+          }
+        ]
+      },
+      {
+        "code" : "230300",
+        "name" : "鸡西市",
+        "areaList" : [
+          {
+            "code" : "230302",
+            "name" : "鸡冠区"
+          },
+          {
+            "code" : "230303",
+            "name" : "恒山区"
+          },
+          {
+            "code" : "230304",
+            "name" : "滴道区"
+          },
+          {
+            "code" : "230305",
+            "name" : "梨树区"
+          },
+          {
+            "code" : "230306",
+            "name" : "城子河区"
+          },
+          {
+            "code" : "230307",
+            "name" : "麻山区"
+          },
+          {
+            "code" : "230321",
+            "name" : "鸡东县"
+          },
+          {
+            "code" : "230381",
+            "name" : "虎林市"
+          },
+          {
+            "code" : "230382",
+            "name" : "密山市"
+          }
+        ]
+      },
+      {
+        "code" : "230400",
+        "name" : "鹤岗市",
+        "areaList" : [
+          {
+            "code" : "230402",
+            "name" : "向阳区"
+          },
+          {
+            "code" : "230403",
+            "name" : "工农区"
+          },
+          {
+            "code" : "230404",
+            "name" : "南山区"
+          },
+          {
+            "code" : "230405",
+            "name" : "兴安区"
+          },
+          {
+            "code" : "230406",
+            "name" : "东山区"
+          },
+          {
+            "code" : "230407",
+            "name" : "兴山区"
+          },
+          {
+            "code" : "230421",
+            "name" : "萝北县"
+          },
+          {
+            "code" : "230422",
+            "name" : "绥滨县"
+          }
+        ]
+      },
+      {
+        "code" : "230500",
+        "name" : "双鸭山市",
+        "areaList" : [
+          {
+            "code" : "230502",
+            "name" : "尖山区"
+          },
+          {
+            "code" : "230503",
+            "name" : "岭东区"
+          },
+          {
+            "code" : "230505",
+            "name" : "四方台区"
+          },
+          {
+            "code" : "230506",
+            "name" : "宝山区"
+          },
+          {
+            "code" : "230521",
+            "name" : "集贤县"
+          },
+          {
+            "code" : "230522",
+            "name" : "友谊县"
+          },
+          {
+            "code" : "230523",
+            "name" : "宝清县"
+          },
+          {
+            "code" : "230524",
+            "name" : "饶河县"
+          }
+        ]
+      },
+      {
+        "code" : "230600",
+        "name" : "大庆市",
+        "areaList" : [
+          {
+            "code" : "230602",
+            "name" : "萨尔图区"
+          },
+          {
+            "code" : "230603",
+            "name" : "龙凤区"
+          },
+          {
+            "code" : "230604",
+            "name" : "让胡路区"
+          },
+          {
+            "code" : "230605",
+            "name" : "红岗区"
+          },
+          {
+            "code" : "230606",
+            "name" : "大同区"
+          },
+          {
+            "code" : "230621",
+            "name" : "肇州县"
+          },
+          {
+            "code" : "230622",
+            "name" : "肇源县"
+          },
+          {
+            "code" : "230623",
+            "name" : "林甸县"
+          },
+          {
+            "code" : "230624",
+            "name" : "杜尔伯特蒙古族自治县"
+          }
+        ]
+      },
+      {
+        "code" : "230700",
+        "name" : "伊春市",
+        "areaList" : [
+          {
+            "code" : "230717",
+            "name" : "伊美区"
+          },
+          {
+            "code" : "230718",
+            "name" : "乌翠区"
+          },
+          {
+            "code" : "230719",
+            "name" : "友好区"
+          },
+          {
+            "code" : "230722",
+            "name" : "嘉荫县"
+          },
+          {
+            "code" : "230723",
+            "name" : "汤旺县"
+          },
+          {
+            "code" : "230724",
+            "name" : "丰林县"
+          },
+          {
+            "code" : "230725",
+            "name" : "大箐山县"
+          },
+          {
+            "code" : "230726",
+            "name" : "南岔县"
+          },
+          {
+            "code" : "230751",
+            "name" : "金林区"
+          },
+          {
+            "code" : "230781",
+            "name" : "铁力市"
+          }
+        ]
+      },
+      {
+        "code" : "230800",
+        "name" : "佳木斯市",
+        "areaList" : [
+          {
+            "code" : "230803",
+            "name" : "向阳区"
+          },
+          {
+            "code" : "230804",
+            "name" : "前进区"
+          },
+          {
+            "code" : "230805",
+            "name" : "东风区"
+          },
+          {
+            "code" : "230811",
+            "name" : "郊区"
+          },
+          {
+            "code" : "230822",
+            "name" : "桦南县"
+          },
+          {
+            "code" : "230826",
+            "name" : "桦川县"
+          },
+          {
+            "code" : "230828",
+            "name" : "汤原县"
+          },
+          {
+            "code" : "230881",
+            "name" : "同江市"
+          },
+          {
+            "code" : "230882",
+            "name" : "富锦市"
+          },
+          {
+            "code" : "230883",
+            "name" : "抚远市"
+          }
+        ]
+      },
+      {
+        "code" : "230900",
+        "name" : "七台河市",
+        "areaList" : [
+          {
+            "code" : "230902",
+            "name" : "新兴区"
+          },
+          {
+            "code" : "230903",
+            "name" : "桃山区"
+          },
+          {
+            "code" : "230904",
+            "name" : "茄子河区"
+          },
+          {
+            "code" : "230921",
+            "name" : "勃利县"
+          }
+        ]
+      },
+      {
+        "code" : "231000",
+        "name" : "牡丹江市",
+        "areaList" : [
+          {
+            "code" : "231002",
+            "name" : "东安区"
+          },
+          {
+            "code" : "231003",
+            "name" : "阳明区"
+          },
+          {
+            "code" : "231004",
+            "name" : "爱民区"
+          },
+          {
+            "code" : "231005",
+            "name" : "西安区"
+          },
+          {
+            "code" : "231025",
+            "name" : "林口县"
+          },
+          {
+            "code" : "231081",
+            "name" : "绥芬河市"
+          },
+          {
+            "code" : "231083",
+            "name" : "海林市"
+          },
+          {
+            "code" : "231084",
+            "name" : "宁安市"
+          },
+          {
+            "code" : "231085",
+            "name" : "穆棱市"
+          },
+          {
+            "code" : "231086",
+            "name" : "东宁市"
+          }
+        ]
+      },
+      {
+        "code" : "231100",
+        "name" : "黑河市",
+        "areaList" : [
+          {
+            "code" : "231102",
+            "name" : "爱辉区"
+          },
+          {
+            "code" : "231123",
+            "name" : "逊克县"
+          },
+          {
+            "code" : "231124",
+            "name" : "孙吴县"
+          },
+          {
+            "code" : "231181",
+            "name" : "北安市"
+          },
+          {
+            "code" : "231182",
+            "name" : "五大连池市"
+          },
+          {
+            "code" : "231183",
+            "name" : "嫩江市"
+          }
+        ]
+      },
+      {
+        "code" : "231200",
+        "name" : "绥化市",
+        "areaList" : [
+          {
+            "code" : "231202",
+            "name" : "北林区"
+          },
+          {
+            "code" : "231221",
+            "name" : "望奎县"
+          },
+          {
+            "code" : "231222",
+            "name" : "兰西县"
+          },
+          {
+            "code" : "231223",
+            "name" : "青冈县"
+          },
+          {
+            "code" : "231224",
+            "name" : "庆安县"
+          },
+          {
+            "code" : "231225",
+            "name" : "明水县"
+          },
+          {
+            "code" : "231226",
+            "name" : "绥棱县"
+          },
+          {
+            "code" : "231281",
+            "name" : "安达市"
+          },
+          {
+            "code" : "231282",
+            "name" : "肇东市"
+          },
+          {
+            "code" : "231283",
+            "name" : "海伦市"
+          }
+        ]
+      },
+      {
+        "code" : "232700",
+        "name" : "大兴安岭地区",
+        "areaList" : [
+          {
+            "code" : "232701",
+            "name" : "漠河市"
+          },
+          {
+            "code" : "232718",
+            "name" : "加格达奇区"
+          },
+          {
+            "code" : "232721",
+            "name" : "呼玛县"
+          },
+          {
+            "code" : "232722",
+            "name" : "塔河县"
+          }
+        ]
+      }
+    ]
+  },
+  {
+    "code" : "310000",
+    "name" : "上海市",
+    "cityList" : [
+      {
+        "code" : "310100",
+        "name" : "上海城区",
+        "areaList" : [
+          {
+            "code" : "310101",
+            "name" : "黄浦区"
+          },
+          {
+            "code" : "310104",
+            "name" : "徐汇区"
+          },
+          {
+            "code" : "310105",
+            "name" : "长宁区"
+          },
+          {
+            "code" : "310106",
+            "name" : "静安区"
+          },
+          {
+            "code" : "310107",
+            "name" : "普陀区"
+          },
+          {
+            "code" : "310109",
+            "name" : "虹口区"
+          },
+          {
+            "code" : "310110",
+            "name" : "杨浦区"
+          },
+          {
+            "code" : "310112",
+            "name" : "闵行区"
+          },
+          {
+            "code" : "310113",
+            "name" : "宝山区"
+          },
+          {
+            "code" : "310114",
+            "name" : "嘉定区"
+          },
+          {
+            "code" : "310115",
+            "name" : "浦东新区"
+          },
+          {
+            "code" : "310116",
+            "name" : "金山区"
+          },
+          {
+            "code" : "310117",
+            "name" : "松江区"
+          },
+          {
+            "code" : "310118",
+            "name" : "青浦区"
+          },
+          {
+            "code" : "310120",
+            "name" : "奉贤区"
+          },
+          {
+            "code" : "310151",
+            "name" : "崇明区"
+          }
+        ]
+      }
+    ]
+  },
+  {
+    "code" : "320000",
+    "name" : "江苏省",
+    "cityList" : [
+      {
+        "code" : "320100",
+        "name" : "南京市",
+        "areaList" : [
+          {
+            "code" : "320102",
+            "name" : "玄武区"
+          },
+          {
+            "code" : "320104",
+            "name" : "秦淮区"
+          },
+          {
+            "code" : "320105",
+            "name" : "建邺区"
+          },
+          {
+            "code" : "320106",
+            "name" : "鼓楼区"
+          },
+          {
+            "code" : "320111",
+            "name" : "浦口区"
+          },
+          {
+            "code" : "320113",
+            "name" : "栖霞区"
+          },
+          {
+            "code" : "320114",
+            "name" : "雨花台区"
+          },
+          {
+            "code" : "320115",
+            "name" : "江宁区"
+          },
+          {
+            "code" : "320116",
+            "name" : "六合区"
+          },
+          {
+            "code" : "320117",
+            "name" : "溧水区"
+          },
+          {
+            "code" : "320118",
+            "name" : "高淳区"
+          }
+        ]
+      },
+      {
+        "code" : "320200",
+        "name" : "无锡市",
+        "areaList" : [
+          {
+            "code" : "320205",
+            "name" : "锡山区"
+          },
+          {
+            "code" : "320206",
+            "name" : "惠山区"
+          },
+          {
+            "code" : "320211",
+            "name" : "滨湖区"
+          },
+          {
+            "code" : "320213",
+            "name" : "梁溪区"
+          },
+          {
+            "code" : "320214",
+            "name" : "新吴区"
+          },
+          {
+            "code" : "320281",
+            "name" : "江阴市"
+          },
+          {
+            "code" : "320282",
+            "name" : "宜兴市"
+          }
+        ]
+      },
+      {
+        "code" : "320300",
+        "name" : "徐州市",
+        "areaList" : [
+          {
+            "code" : "320302",
+            "name" : "鼓楼区"
+          },
+          {
+            "code" : "320303",
+            "name" : "云龙区"
+          },
+          {
+            "code" : "320305",
+            "name" : "贾汪区"
+          },
+          {
+            "code" : "320311",
+            "name" : "泉山区"
+          },
+          {
+            "code" : "320312",
+            "name" : "铜山区"
+          },
+          {
+            "code" : "320321",
+            "name" : "丰县"
+          },
+          {
+            "code" : "320322",
+            "name" : "沛县"
+          },
+          {
+            "code" : "320324",
+            "name" : "睢宁县"
+          },
+          {
+            "code" : "320381",
+            "name" : "新沂市"
+          },
+          {
+            "code" : "320382",
+            "name" : "邳州市"
+          }
+        ]
+      },
+      {
+        "code" : "320400",
+        "name" : "常州市",
+        "areaList" : [
+          {
+            "code" : "320402",
+            "name" : "天宁区"
+          },
+          {
+            "code" : "320404",
+            "name" : "钟楼区"
+          },
+          {
+            "code" : "320411",
+            "name" : "新北区"
+          },
+          {
+            "code" : "320412",
+            "name" : "武进区"
+          },
+          {
+            "code" : "320413",
+            "name" : "金坛区"
+          },
+          {
+            "code" : "320481",
+            "name" : "溧阳市"
+          }
+        ]
+      },
+      {
+        "code" : "320500",
+        "name" : "苏州市",
+        "areaList" : [
+          {
+            "code" : "320505",
+            "name" : "虎丘区"
+          },
+          {
+            "code" : "320506",
+            "name" : "吴中区"
+          },
+          {
+            "code" : "320507",
+            "name" : "相城区"
+          },
+          {
+            "code" : "320508",
+            "name" : "姑苏区"
+          },
+          {
+            "code" : "320509",
+            "name" : "吴江区"
+          },
+          {
+            "code" : "320581",
+            "name" : "常熟市"
+          },
+          {
+            "code" : "320582",
+            "name" : "张家港市"
+          },
+          {
+            "code" : "320583",
+            "name" : "昆山市"
+          },
+          {
+            "code" : "320585",
+            "name" : "太仓市"
+          }
+        ]
+      },
+      {
+        "code" : "320600",
+        "name" : "南通市",
+        "areaList" : [
+          {
+            "code" : "320612",
+            "name" : "通州区"
+          },
+          {
+            "code" : "320613",
+            "name" : "崇川区"
+          },
+          {
+            "code" : "320614",
+            "name" : "海门区"
+          },
+          {
+            "code" : "320623",
+            "name" : "如东县"
+          },
+          {
+            "code" : "320681",
+            "name" : "启东市"
+          },
+          {
+            "code" : "320682",
+            "name" : "如皋市"
+          },
+          {
+            "code" : "320685",
+            "name" : "海安市"
+          }
+        ]
+      },
+      {
+        "code" : "320700",
+        "name" : "连云港市",
+        "areaList" : [
+          {
+            "code" : "320703",
+            "name" : "连云区"
+          },
+          {
+            "code" : "320706",
+            "name" : "海州区"
+          },
+          {
+            "code" : "320707",
+            "name" : "赣榆区"
+          },
+          {
+            "code" : "320722",
+            "name" : "东海县"
+          },
+          {
+            "code" : "320723",
+            "name" : "灌云县"
+          },
+          {
+            "code" : "320724",
+            "name" : "灌南县"
+          }
+        ]
+      },
+      {
+        "code" : "320800",
+        "name" : "淮安市",
+        "areaList" : [
+          {
+            "code" : "320803",
+            "name" : "淮安区"
+          },
+          {
+            "code" : "320804",
+            "name" : "淮阴区"
+          },
+          {
+            "code" : "320812",
+            "name" : "清江浦区"
+          },
+          {
+            "code" : "320813",
+            "name" : "洪泽区"
+          },
+          {
+            "code" : "320826",
+            "name" : "涟水县"
+          },
+          {
+            "code" : "320830",
+            "name" : "盱眙县"
+          },
+          {
+            "code" : "320831",
+            "name" : "金湖县"
+          }
+        ]
+      },
+      {
+        "code" : "320900",
+        "name" : "盐城市",
+        "areaList" : [
+          {
+            "code" : "320902",
+            "name" : "亭湖区"
+          },
+          {
+            "code" : "320903",
+            "name" : "盐都区"
+          },
+          {
+            "code" : "320904",
+            "name" : "大丰区"
+          },
+          {
+            "code" : "320921",
+            "name" : "响水县"
+          },
+          {
+            "code" : "320922",
+            "name" : "滨海县"
+          },
+          {
+            "code" : "320923",
+            "name" : "阜宁县"
+          },
+          {
+            "code" : "320924",
+            "name" : "射阳县"
+          },
+          {
+            "code" : "320925",
+            "name" : "建湖县"
+          },
+          {
+            "code" : "320981",
+            "name" : "东台市"
+          }
+        ]
+      },
+      {
+        "code" : "321000",
+        "name" : "扬州市",
+        "areaList" : [
+          {
+            "code" : "321002",
+            "name" : "广陵区"
+          },
+          {
+            "code" : "321003",
+            "name" : "邗江区"
+          },
+          {
+            "code" : "321012",
+            "name" : "江都区"
+          },
+          {
+            "code" : "321023",
+            "name" : "宝应县"
+          },
+          {
+            "code" : "321081",
+            "name" : "仪征市"
+          },
+          {
+            "code" : "321084",
+            "name" : "高邮市"
+          }
+        ]
+      },
+      {
+        "code" : "321100",
+        "name" : "镇江市",
+        "areaList" : [
+          {
+            "code" : "321102",
+            "name" : "京口区"
+          },
+          {
+            "code" : "321111",
+            "name" : "润州区"
+          },
+          {
+            "code" : "321112",
+            "name" : "丹徒区"
+          },
+          {
+            "code" : "321181",
+            "name" : "丹阳市"
+          },
+          {
+            "code" : "321182",
+            "name" : "扬中市"
+          },
+          {
+            "code" : "321183",
+            "name" : "句容市"
+          }
+        ]
+      },
+      {
+        "code" : "321200",
+        "name" : "泰州市",
+        "areaList" : [
+          {
+            "code" : "321202",
+            "name" : "海陵区"
+          },
+          {
+            "code" : "321203",
+            "name" : "高港区"
+          },
+          {
+            "code" : "321204",
+            "name" : "姜堰区"
+          },
+          {
+            "code" : "321281",
+            "name" : "兴化市"
+          },
+          {
+            "code" : "321282",
+            "name" : "靖江市"
+          },
+          {
+            "code" : "321283",
+            "name" : "泰兴市"
+          }
+        ]
+      },
+      {
+        "code" : "321300",
+        "name" : "宿迁市",
+        "areaList" : [
+          {
+            "code" : "321302",
+            "name" : "宿城区"
+          },
+          {
+            "code" : "321311",
+            "name" : "宿豫区"
+          },
+          {
+            "code" : "321322",
+            "name" : "沭阳县"
+          },
+          {
+            "code" : "321323",
+            "name" : "泗阳县"
+          },
+          {
+            "code" : "321324",
+            "name" : "泗洪县"
+          }
+        ]
+      }
+    ]
+  },
+  {
+    "code" : "330000",
+    "name" : "浙江省",
+    "cityList" : [
+      {
+        "code" : "330100",
+        "name" : "杭州市",
+        "areaList" : [
+          {
+            "code" : "330102",
+            "name" : "上城区"
+          },
+          {
+            "code" : "330105",
+            "name" : "拱墅区"
+          },
+          {
+            "code" : "330106",
+            "name" : "西湖区"
+          },
+          {
+            "code" : "330108",
+            "name" : "滨江区"
+          },
+          {
+            "code" : "330109",
+            "name" : "萧山区"
+          },
+          {
+            "code" : "330110",
+            "name" : "余杭区"
+          },
+          {
+            "code" : "330111",
+            "name" : "富阳区"
+          },
+          {
+            "code" : "330112",
+            "name" : "临安区"
+          },
+          {
+            "code" : "330113",
+            "name" : "临平区"
+          },
+          {
+            "code" : "330114",
+            "name" : "钱塘区"
+          },
+          {
+            "code" : "330122",
+            "name" : "桐庐县"
+          },
+          {
+            "code" : "330127",
+            "name" : "淳安县"
+          },
+          {
+            "code" : "330182",
+            "name" : "建德市"
+          }
+        ]
+      },
+      {
+        "code" : "330200",
+        "name" : "宁波市",
+        "areaList" : [
+          {
+            "code" : "330203",
+            "name" : "海曙区"
+          },
+          {
+            "code" : "330205",
+            "name" : "江北区"
+          },
+          {
+            "code" : "330206",
+            "name" : "北仑区"
+          },
+          {
+            "code" : "330211",
+            "name" : "镇海区"
+          },
+          {
+            "code" : "330212",
+            "name" : "鄞州区"
+          },
+          {
+            "code" : "330213",
+            "name" : "奉化区"
+          },
+          {
+            "code" : "330225",
+            "name" : "象山县"
+          },
+          {
+            "code" : "330226",
+            "name" : "宁海县"
+          },
+          {
+            "code" : "330281",
+            "name" : "余姚市"
+          },
+          {
+            "code" : "330282",
+            "name" : "慈溪市"
+          }
+        ]
+      },
+      {
+        "code" : "330300",
+        "name" : "温州市",
+        "areaList" : [
+          {
+            "code" : "330302",
+            "name" : "鹿城区"
+          },
+          {
+            "code" : "330303",
+            "name" : "龙湾区"
+          },
+          {
+            "code" : "330304",
+            "name" : "瓯海区"
+          },
+          {
+            "code" : "330305",
+            "name" : "洞头区"
+          },
+          {
+            "code" : "330324",
+            "name" : "永嘉县"
+          },
+          {
+            "code" : "330326",
+            "name" : "平阳县"
+          },
+          {
+            "code" : "330327",
+            "name" : "苍南县"
+          },
+          {
+            "code" : "330328",
+            "name" : "文成县"
+          },
+          {
+            "code" : "330329",
+            "name" : "泰顺县"
+          },
+          {
+            "code" : "330381",
+            "name" : "瑞安市"
+          },
+          {
+            "code" : "330382",
+            "name" : "乐清市"
+          },
+          {
+            "code" : "330383",
+            "name" : "龙港市"
+          }
+        ]
+      },
+      {
+        "code" : "330400",
+        "name" : "嘉兴市",
+        "areaList" : [
+          {
+            "code" : "330402",
+            "name" : "南湖区"
+          },
+          {
+            "code" : "330411",
+            "name" : "秀洲区"
+          },
+          {
+            "code" : "330421",
+            "name" : "嘉善县"
+          },
+          {
+            "code" : "330424",
+            "name" : "海盐县"
+          },
+          {
+            "code" : "330481",
+            "name" : "海宁市"
+          },
+          {
+            "code" : "330482",
+            "name" : "平湖市"
+          },
+          {
+            "code" : "330483",
+            "name" : "桐乡市"
+          }
+        ]
+      },
+      {
+        "code" : "330500",
+        "name" : "湖州市",
+        "areaList" : [
+          {
+            "code" : "330502",
+            "name" : "吴兴区"
+          },
+          {
+            "code" : "330503",
+            "name" : "南浔区"
+          },
+          {
+            "code" : "330521",
+            "name" : "德清县"
+          },
+          {
+            "code" : "330522",
+            "name" : "长兴县"
+          },
+          {
+            "code" : "330523",
+            "name" : "安吉县"
+          }
+        ]
+      },
+      {
+        "code" : "330600",
+        "name" : "绍兴市",
+        "areaList" : [
+          {
+            "code" : "330602",
+            "name" : "越城区"
+          },
+          {
+            "code" : "330603",
+            "name" : "柯桥区"
+          },
+          {
+            "code" : "330604",
+            "name" : "上虞区"
+          },
+          {
+            "code" : "330624",
+            "name" : "新昌县"
+          },
+          {
+            "code" : "330681",
+            "name" : "诸暨市"
+          },
+          {
+            "code" : "330683",
+            "name" : "嵊州市"
+          }
+        ]
+      },
+      {
+        "code" : "330700",
+        "name" : "金华市",
+        "areaList" : [
+          {
+            "code" : "330702",
+            "name" : "婺城区"
+          },
+          {
+            "code" : "330703",
+            "name" : "金东区"
+          },
+          {
+            "code" : "330723",
+            "name" : "武义县"
+          },
+          {
+            "code" : "330726",
+            "name" : "浦江县"
+          },
+          {
+            "code" : "330727",
+            "name" : "磐安县"
+          },
+          {
+            "code" : "330781",
+            "name" : "兰溪市"
+          },
+          {
+            "code" : "330782",
+            "name" : "义乌市"
+          },
+          {
+            "code" : "330783",
+            "name" : "东阳市"
+          },
+          {
+            "code" : "330784",
+            "name" : "永康市"
+          }
+        ]
+      },
+      {
+        "code" : "330800",
+        "name" : "衢州市",
+        "areaList" : [
+          {
+            "code" : "330802",
+            "name" : "柯城区"
+          },
+          {
+            "code" : "330803",
+            "name" : "衢江区"
+          },
+          {
+            "code" : "330822",
+            "name" : "常山县"
+          },
+          {
+            "code" : "330824",
+            "name" : "开化县"
+          },
+          {
+            "code" : "330825",
+            "name" : "龙游县"
+          },
+          {
+            "code" : "330881",
+            "name" : "江山市"
+          }
+        ]
+      },
+      {
+        "code" : "330900",
+        "name" : "舟山市",
+        "areaList" : [
+          {
+            "code" : "330902",
+            "name" : "定海区"
+          },
+          {
+            "code" : "330903",
+            "name" : "普陀区"
+          },
+          {
+            "code" : "330921",
+            "name" : "岱山县"
+          },
+          {
+            "code" : "330922",
+            "name" : "嵊泗县"
+          }
+        ]
+      },
+      {
+        "code" : "331000",
+        "name" : "台州市",
+        "areaList" : [
+          {
+            "code" : "331002",
+            "name" : "椒江区"
+          },
+          {
+            "code" : "331003",
+            "name" : "黄岩区"
+          },
+          {
+            "code" : "331004",
+            "name" : "路桥区"
+          },
+          {
+            "code" : "331022",
+            "name" : "三门县"
+          },
+          {
+            "code" : "331023",
+            "name" : "天台县"
+          },
+          {
+            "code" : "331024",
+            "name" : "仙居县"
+          },
+          {
+            "code" : "331081",
+            "name" : "温岭市"
+          },
+          {
+            "code" : "331082",
+            "name" : "临海市"
+          },
+          {
+            "code" : "331083",
+            "name" : "玉环市"
+          }
+        ]
+      },
+      {
+        "code" : "331100",
+        "name" : "丽水市",
+        "areaList" : [
+          {
+            "code" : "331102",
+            "name" : "莲都区"
+          },
+          {
+            "code" : "331121",
+            "name" : "青田县"
+          },
+          {
+            "code" : "331122",
+            "name" : "缙云县"
+          },
+          {
+            "code" : "331123",
+            "name" : "遂昌县"
+          },
+          {
+            "code" : "331124",
+            "name" : "松阳县"
+          },
+          {
+            "code" : "331125",
+            "name" : "云和县"
+          },
+          {
+            "code" : "331126",
+            "name" : "庆元县"
+          },
+          {
+            "code" : "331127",
+            "name" : "景宁畲族自治县"
+          },
+          {
+            "code" : "331181",
+            "name" : "龙泉市"
+          }
+        ]
+      }
+    ]
+  },
+  {
+    "code" : "340000",
+    "name" : "安徽省",
+    "cityList" : [
+      {
+        "code" : "340100",
+        "name" : "合肥市",
+        "areaList" : [
+          {
+            "code" : "340102",
+            "name" : "瑶海区"
+          },
+          {
+            "code" : "340103",
+            "name" : "庐阳区"
+          },
+          {
+            "code" : "340104",
+            "name" : "蜀山区"
+          },
+          {
+            "code" : "340111",
+            "name" : "包河区"
+          },
+          {
+            "code" : "340121",
+            "name" : "长丰县"
+          },
+          {
+            "code" : "340122",
+            "name" : "肥东县"
+          },
+          {
+            "code" : "340123",
+            "name" : "肥西县"
+          },
+          {
+            "code" : "340124",
+            "name" : "庐江县"
+          },
+          {
+            "code" : "340181",
+            "name" : "巢湖市"
+          }
+        ]
+      },
+      {
+        "code" : "340200",
+        "name" : "芜湖市",
+        "areaList" : [
+          {
+            "code" : "340202",
+            "name" : "镜湖区"
+          },
+          {
+            "code" : "340207",
+            "name" : "鸠江区"
+          },
+          {
+            "code" : "340209",
+            "name" : "弋江区"
+          },
+          {
+            "code" : "340210",
+            "name" : "湾沚区"
+          },
+          {
+            "code" : "340212",
+            "name" : "繁昌区"
+          },
+          {
+            "code" : "340223",
+            "name" : "南陵县"
+          },
+          {
+            "code" : "340281",
+            "name" : "无为市"
+          }
+        ]
+      },
+      {
+        "code" : "340300",
+        "name" : "蚌埠市",
+        "areaList" : [
+          {
+            "code" : "340302",
+            "name" : "龙子湖区"
+          },
+          {
+            "code" : "340303",
+            "name" : "蚌山区"
+          },
+          {
+            "code" : "340304",
+            "name" : "禹会区"
+          },
+          {
+            "code" : "340311",
+            "name" : "淮上区"
+          },
+          {
+            "code" : "340321",
+            "name" : "怀远县"
+          },
+          {
+            "code" : "340322",
+            "name" : "五河县"
+          },
+          {
+            "code" : "340323",
+            "name" : "固镇县"
+          }
+        ]
+      },
+      {
+        "code" : "340400",
+        "name" : "淮南市",
+        "areaList" : [
+          {
+            "code" : "340402",
+            "name" : "大通区"
+          },
+          {
+            "code" : "340403",
+            "name" : "田家庵区"
+          },
+          {
+            "code" : "340404",
+            "name" : "谢家集区"
+          },
+          {
+            "code" : "340405",
+            "name" : "八公山区"
+          },
+          {
+            "code" : "340406",
+            "name" : "潘集区"
+          },
+          {
+            "code" : "340421",
+            "name" : "凤台县"
+          },
+          {
+            "code" : "340422",
+            "name" : "寿县"
+          }
+        ]
+      },
+      {
+        "code" : "340500",
+        "name" : "马鞍山市",
+        "areaList" : [
+          {
+            "code" : "340503",
+            "name" : "花山区"
+          },
+          {
+            "code" : "340504",
+            "name" : "雨山区"
+          },
+          {
+            "code" : "340506",
+            "name" : "博望区"
+          },
+          {
+            "code" : "340521",
+            "name" : "当涂县"
+          },
+          {
+            "code" : "340522",
+            "name" : "含山县"
+          },
+          {
+            "code" : "340523",
+            "name" : "和县"
+          }
+        ]
+      },
+      {
+        "code" : "340600",
+        "name" : "淮北市",
+        "areaList" : [
+          {
+            "code" : "340602",
+            "name" : "杜集区"
+          },
+          {
+            "code" : "340603",
+            "name" : "相山区"
+          },
+          {
+            "code" : "340604",
+            "name" : "烈山区"
+          },
+          {
+            "code" : "340621",
+            "name" : "濉溪县"
+          }
+        ]
+      },
+      {
+        "code" : "340700",
+        "name" : "铜陵市",
+        "areaList" : [
+          {
+            "code" : "340705",
+            "name" : "铜官区"
+          },
+          {
+            "code" : "340706",
+            "name" : "义安区"
+          },
+          {
+            "code" : "340711",
+            "name" : "郊区"
+          },
+          {
+            "code" : "340722",
+            "name" : "枞阳县"
+          }
+        ]
+      },
+      {
+        "code" : "340800",
+        "name" : "安庆市",
+        "areaList" : [
+          {
+            "code" : "340802",
+            "name" : "迎江区"
+          },
+          {
+            "code" : "340803",
+            "name" : "大观区"
+          },
+          {
+            "code" : "340811",
+            "name" : "宜秀区"
+          },
+          {
+            "code" : "340822",
+            "name" : "怀宁县"
+          },
+          {
+            "code" : "340825",
+            "name" : "太湖县"
+          },
+          {
+            "code" : "340826",
+            "name" : "宿松县"
+          },
+          {
+            "code" : "340827",
+            "name" : "望江县"
+          },
+          {
+            "code" : "340828",
+            "name" : "岳西县"
+          },
+          {
+            "code" : "340881",
+            "name" : "桐城市"
+          },
+          {
+            "code" : "340882",
+            "name" : "潜山市"
+          }
+        ]
+      },
+      {
+        "code" : "341000",
+        "name" : "黄山市",
+        "areaList" : [
+          {
+            "code" : "341002",
+            "name" : "屯溪区"
+          },
+          {
+            "code" : "341003",
+            "name" : "黄山区"
+          },
+          {
+            "code" : "341004",
+            "name" : "徽州区"
+          },
+          {
+            "code" : "341021",
+            "name" : "歙县"
+          },
+          {
+            "code" : "341022",
+            "name" : "休宁县"
+          },
+          {
+            "code" : "341023",
+            "name" : "黟县"
+          },
+          {
+            "code" : "341024",
+            "name" : "祁门县"
+          }
+        ]
+      },
+      {
+        "code" : "341100",
+        "name" : "滁州市",
+        "areaList" : [
+          {
+            "code" : "341102",
+            "name" : "琅琊区"
+          },
+          {
+            "code" : "341103",
+            "name" : "南谯区"
+          },
+          {
+            "code" : "341122",
+            "name" : "来安县"
+          },
+          {
+            "code" : "341124",
+            "name" : "全椒县"
+          },
+          {
+            "code" : "341125",
+            "name" : "定远县"
+          },
+          {
+            "code" : "341126",
+            "name" : "凤阳县"
+          },
+          {
+            "code" : "341181",
+            "name" : "天长市"
+          },
+          {
+            "code" : "341182",
+            "name" : "明光市"
+          }
+        ]
+      },
+      {
+        "code" : "341200",
+        "name" : "阜阳市",
+        "areaList" : [
+          {
+            "code" : "341202",
+            "name" : "颍州区"
+          },
+          {
+            "code" : "341203",
+            "name" : "颍东区"
+          },
+          {
+            "code" : "341204",
+            "name" : "颍泉区"
+          },
+          {
+            "code" : "341221",
+            "name" : "临泉县"
+          },
+          {
+            "code" : "341222",
+            "name" : "太和县"
+          },
+          {
+            "code" : "341225",
+            "name" : "阜南县"
+          },
+          {
+            "code" : "341226",
+            "name" : "颍上县"
+          },
+          {
+            "code" : "341282",
+            "name" : "界首市"
+          }
+        ]
+      },
+      {
+        "code" : "341300",
+        "name" : "宿州市",
+        "areaList" : [
+          {
+            "code" : "341302",
+            "name" : "埇桥区"
+          },
+          {
+            "code" : "341321",
+            "name" : "砀山县"
+          },
+          {
+            "code" : "341322",
+            "name" : "萧县"
+          },
+          {
+            "code" : "341323",
+            "name" : "灵璧县"
+          },
+          {
+            "code" : "341324",
+            "name" : "泗县"
+          }
+        ]
+      },
+      {
+        "code" : "341500",
+        "name" : "六安市",
+        "areaList" : [
+          {
+            "code" : "341502",
+            "name" : "金安区"
+          },
+          {
+            "code" : "341503",
+            "name" : "裕安区"
+          },
+          {
+            "code" : "341504",
+            "name" : "叶集区"
+          },
+          {
+            "code" : "341522",
+            "name" : "霍邱县"
+          },
+          {
+            "code" : "341523",
+            "name" : "舒城县"
+          },
+          {
+            "code" : "341524",
+            "name" : "金寨县"
+          },
+          {
+            "code" : "341525",
+            "name" : "霍山县"
+          }
+        ]
+      },
+      {
+        "code" : "341600",
+        "name" : "亳州市",
+        "areaList" : [
+          {
+            "code" : "341602",
+            "name" : "谯城区"
+          },
+          {
+            "code" : "341621",
+            "name" : "涡阳县"
+          },
+          {
+            "code" : "341622",
+            "name" : "蒙城县"
+          },
+          {
+            "code" : "341623",
+            "name" : "利辛县"
+          }
+        ]
+      },
+      {
+        "code" : "341700",
+        "name" : "池州市",
+        "areaList" : [
+          {
+            "code" : "341702",
+            "name" : "贵池区"
+          },
+          {
+            "code" : "341721",
+            "name" : "东至县"
+          },
+          {
+            "code" : "341722",
+            "name" : "石台县"
+          },
+          {
+            "code" : "341723",
+            "name" : "青阳县"
+          }
+        ]
+      },
+      {
+        "code" : "341800",
+        "name" : "宣城市",
+        "areaList" : [
+          {
+            "code" : "341802",
+            "name" : "宣州区"
+          },
+          {
+            "code" : "341821",
+            "name" : "郎溪县"
+          },
+          {
+            "code" : "341823",
+            "name" : "泾县"
+          },
+          {
+            "code" : "341824",
+            "name" : "绩溪县"
+          },
+          {
+            "code" : "341825",
+            "name" : "旌德县"
+          },
+          {
+            "code" : "341881",
+            "name" : "宁国市"
+          },
+          {
+            "code" : "341882",
+            "name" : "广德市"
+          }
+        ]
+      }
+    ]
+  },
+  {
+    "code" : "350000",
+    "name" : "福建省",
+    "cityList" : [
+      {
+        "code" : "350100",
+        "name" : "福州市",
+        "areaList" : [
+          {
+            "code" : "350102",
+            "name" : "鼓楼区"
+          },
+          {
+            "code" : "350103",
+            "name" : "台江区"
+          },
+          {
+            "code" : "350104",
+            "name" : "仓山区"
+          },
+          {
+            "code" : "350105",
+            "name" : "马尾区"
+          },
+          {
+            "code" : "350111",
+            "name" : "晋安区"
+          },
+          {
+            "code" : "350112",
+            "name" : "长乐区"
+          },
+          {
+            "code" : "350121",
+            "name" : "闽侯县"
+          },
+          {
+            "code" : "350122",
+            "name" : "连江县"
+          },
+          {
+            "code" : "350123",
+            "name" : "罗源县"
+          },
+          {
+            "code" : "350124",
+            "name" : "闽清县"
+          },
+          {
+            "code" : "350125",
+            "name" : "永泰县"
+          },
+          {
+            "code" : "350128",
+            "name" : "平潭县"
+          },
+          {
+            "code" : "350181",
+            "name" : "福清市"
+          }
+        ]
+      },
+      {
+        "code" : "350200",
+        "name" : "厦门市",
+        "areaList" : [
+          {
+            "code" : "350203",
+            "name" : "思明区"
+          },
+          {
+            "code" : "350205",
+            "name" : "海沧区"
+          },
+          {
+            "code" : "350206",
+            "name" : "湖里区"
+          },
+          {
+            "code" : "350211",
+            "name" : "集美区"
+          },
+          {
+            "code" : "350212",
+            "name" : "同安区"
+          },
+          {
+            "code" : "350213",
+            "name" : "翔安区"
+          }
+        ]
+      },
+      {
+        "code" : "350300",
+        "name" : "莆田市",
+        "areaList" : [
+          {
+            "code" : "350302",
+            "name" : "城厢区"
+          },
+          {
+            "code" : "350303",
+            "name" : "涵江区"
+          },
+          {
+            "code" : "350304",
+            "name" : "荔城区"
+          },
+          {
+            "code" : "350305",
+            "name" : "秀屿区"
+          },
+          {
+            "code" : "350322",
+            "name" : "仙游县"
+          }
+        ]
+      },
+      {
+        "code" : "350400",
+        "name" : "三明市",
+        "areaList" : [
+          {
+            "code" : "350404",
+            "name" : "三元区"
+          },
+          {
+            "code" : "350405",
+            "name" : "沙县区"
+          },
+          {
+            "code" : "350421",
+            "name" : "明溪县"
+          },
+          {
+            "code" : "350423",
+            "name" : "清流县"
+          },
+          {
+            "code" : "350424",
+            "name" : "宁化县"
+          },
+          {
+            "code" : "350425",
+            "name" : "大田县"
+          },
+          {
+            "code" : "350426",
+            "name" : "尤溪县"
+          },
+          {
+            "code" : "350428",
+            "name" : "将乐县"
+          },
+          {
+            "code" : "350429",
+            "name" : "泰宁县"
+          },
+          {
+            "code" : "350430",
+            "name" : "建宁县"
+          },
+          {
+            "code" : "350481",
+            "name" : "永安市"
+          }
+        ]
+      },
+      {
+        "code" : "350500",
+        "name" : "泉州市",
+        "areaList" : [
+          {
+            "code" : "350502",
+            "name" : "鲤城区"
+          },
+          {
+            "code" : "350503",
+            "name" : "丰泽区"
+          },
+          {
+            "code" : "350504",
+            "name" : "洛江区"
+          },
+          {
+            "code" : "350505",
+            "name" : "泉港区"
+          },
+          {
+            "code" : "350521",
+            "name" : "惠安县"
+          },
+          {
+            "code" : "350524",
+            "name" : "安溪县"
+          },
+          {
+            "code" : "350525",
+            "name" : "永春县"
+          },
+          {
+            "code" : "350526",
+            "name" : "德化县"
+          },
+          {
+            "code" : "350527",
+            "name" : "金门县"
+          },
+          {
+            "code" : "350581",
+            "name" : "石狮市"
+          },
+          {
+            "code" : "350582",
+            "name" : "晋江市"
+          },
+          {
+            "code" : "350583",
+            "name" : "南安市"
+          }
+        ]
+      },
+      {
+        "code" : "350600",
+        "name" : "漳州市",
+        "areaList" : [
+          {
+            "code" : "350602",
+            "name" : "芗城区"
+          },
+          {
+            "code" : "350603",
+            "name" : "龙文区"
+          },
+          {
+            "code" : "350604",
+            "name" : "龙海区"
+          },
+          {
+            "code" : "350605",
+            "name" : "长泰区"
+          },
+          {
+            "code" : "350622",
+            "name" : "云霄县"
+          },
+          {
+            "code" : "350623",
+            "name" : "漳浦县"
+          },
+          {
+            "code" : "350624",
+            "name" : "诏安县"
+          },
+          {
+            "code" : "350626",
+            "name" : "东山县"
+          },
+          {
+            "code" : "350627",
+            "name" : "南靖县"
+          },
+          {
+            "code" : "350628",
+            "name" : "平和县"
+          },
+          {
+            "code" : "350629",
+            "name" : "华安县"
+          }
+        ]
+      },
+      {
+        "code" : "350700",
+        "name" : "南平市",
+        "areaList" : [
+          {
+            "code" : "350702",
+            "name" : "延平区"
+          },
+          {
+            "code" : "350703",
+            "name" : "建阳区"
+          },
+          {
+            "code" : "350721",
+            "name" : "顺昌县"
+          },
+          {
+            "code" : "350722",
+            "name" : "浦城县"
+          },
+          {
+            "code" : "350723",
+            "name" : "光泽县"
+          },
+          {
+            "code" : "350724",
+            "name" : "松溪县"
+          },
+          {
+            "code" : "350725",
+            "name" : "政和县"
+          },
+          {
+            "code" : "350781",
+            "name" : "邵武市"
+          },
+          {
+            "code" : "350782",
+            "name" : "武夷山市"
+          },
+          {
+            "code" : "350783",
+            "name" : "建瓯市"
+          }
+        ]
+      },
+      {
+        "code" : "350800",
+        "name" : "龙岩市",
+        "areaList" : [
+          {
+            "code" : "350802",
+            "name" : "新罗区"
+          },
+          {
+            "code" : "350803",
+            "name" : "永定区"
+          },
+          {
+            "code" : "350821",
+            "name" : "长汀县"
+          },
+          {
+            "code" : "350823",
+            "name" : "上杭县"
+          },
+          {
+            "code" : "350824",
+            "name" : "武平县"
+          },
+          {
+            "code" : "350825",
+            "name" : "连城县"
+          },
+          {
+            "code" : "350881",
+            "name" : "漳平市"
+          }
+        ]
+      },
+      {
+        "code" : "350900",
+        "name" : "宁德市",
+        "areaList" : [
+          {
+            "code" : "350902",
+            "name" : "蕉城区"
+          },
+          {
+            "code" : "350921",
+            "name" : "霞浦县"
+          },
+          {
+            "code" : "350922",
+            "name" : "古田县"
+          },
+          {
+            "code" : "350923",
+            "name" : "屏南县"
+          },
+          {
+            "code" : "350924",
+            "name" : "寿宁县"
+          },
+          {
+            "code" : "350925",
+            "name" : "周宁县"
+          },
+          {
+            "code" : "350926",
+            "name" : "柘荣县"
+          },
+          {
+            "code" : "350981",
+            "name" : "福安市"
+          },
+          {
+            "code" : "350982",
+            "name" : "福鼎市"
+          }
+        ]
+      }
+    ]
+  },
+  {
+    "code" : "360000",
+    "name" : "江西省",
+    "cityList" : [
+      {
+        "code" : "360100",
+        "name" : "南昌市",
+        "areaList" : [
+          {
+            "code" : "360102",
+            "name" : "东湖区"
+          },
+          {
+            "code" : "360103",
+            "name" : "西湖区"
+          },
+          {
+            "code" : "360104",
+            "name" : "青云谱区"
+          },
+          {
+            "code" : "360111",
+            "name" : "青山湖区"
+          },
+          {
+            "code" : "360112",
+            "name" : "新建区"
+          },
+          {
+            "code" : "360113",
+            "name" : "红谷滩区"
+          },
+          {
+            "code" : "360121",
+            "name" : "南昌县"
+          },
+          {
+            "code" : "360123",
+            "name" : "安义县"
+          },
+          {
+            "code" : "360124",
+            "name" : "进贤县"
+          }
+        ]
+      },
+      {
+        "code" : "360200",
+        "name" : "景德镇市",
+        "areaList" : [
+          {
+            "code" : "360202",
+            "name" : "昌江区"
+          },
+          {
+            "code" : "360203",
+            "name" : "珠山区"
+          },
+          {
+            "code" : "360222",
+            "name" : "浮梁县"
+          },
+          {
+            "code" : "360281",
+            "name" : "乐平市"
+          }
+        ]
+      },
+      {
+        "code" : "360300",
+        "name" : "萍乡市",
+        "areaList" : [
+          {
+            "code" : "360302",
+            "name" : "安源区"
+          },
+          {
+            "code" : "360313",
+            "name" : "湘东区"
+          },
+          {
+            "code" : "360321",
+            "name" : "莲花县"
+          },
+          {
+            "code" : "360322",
+            "name" : "上栗县"
+          },
+          {
+            "code" : "360323",
+            "name" : "芦溪县"
+          }
+        ]
+      },
+      {
+        "code" : "360400",
+        "name" : "九江市",
+        "areaList" : [
+          {
+            "code" : "360402",
+            "name" : "濂溪区"
+          },
+          {
+            "code" : "360403",
+            "name" : "浔阳区"
+          },
+          {
+            "code" : "360404",
+            "name" : "柴桑区"
+          },
+          {
+            "code" : "360423",
+            "name" : "武宁县"
+          },
+          {
+            "code" : "360424",
+            "name" : "修水县"
+          },
+          {
+            "code" : "360425",
+            "name" : "永修县"
+          },
+          {
+            "code" : "360426",
+            "name" : "德安县"
+          },
+          {
+            "code" : "360428",
+            "name" : "都昌县"
+          },
+          {
+            "code" : "360429",
+            "name" : "湖口县"
+          },
+          {
+            "code" : "360430",
+            "name" : "彭泽县"
+          },
+          {
+            "code" : "360481",
+            "name" : "瑞昌市"
+          },
+          {
+            "code" : "360482",
+            "name" : "共青城市"
+          },
+          {
+            "code" : "360483",
+            "name" : "庐山市"
+          }
+        ]
+      },
+      {
+        "code" : "360500",
+        "name" : "新余市",
+        "areaList" : [
+          {
+            "code" : "360502",
+            "name" : "渝水区"
+          },
+          {
+            "code" : "360521",
+            "name" : "分宜县"
+          }
+        ]
+      },
+      {
+        "code" : "360600",
+        "name" : "鹰潭市",
+        "areaList" : [
+          {
+            "code" : "360602",
+            "name" : "月湖区"
+          },
+          {
+            "code" : "360603",
+            "name" : "余江区"
+          },
+          {
+            "code" : "360681",
+            "name" : "贵溪市"
+          }
+        ]
+      },
+      {
+        "code" : "360700",
+        "name" : "赣州市",
+        "areaList" : [
+          {
+            "code" : "360702",
+            "name" : "章贡区"
+          },
+          {
+            "code" : "360703",
+            "name" : "南康区"
+          },
+          {
+            "code" : "360704",
+            "name" : "赣县区"
+          },
+          {
+            "code" : "360722",
+            "name" : "信丰县"
+          },
+          {
+            "code" : "360723",
+            "name" : "大余县"
+          },
+          {
+            "code" : "360724",
+            "name" : "上犹县"
+          },
+          {
+            "code" : "360725",
+            "name" : "崇义县"
+          },
+          {
+            "code" : "360726",
+            "name" : "安远县"
+          },
+          {
+            "code" : "360728",
+            "name" : "定南县"
+          },
+          {
+            "code" : "360729",
+            "name" : "全南县"
+          },
+          {
+            "code" : "360730",
+            "name" : "宁都县"
+          },
+          {
+            "code" : "360731",
+            "name" : "于都县"
+          },
+          {
+            "code" : "360732",
+            "name" : "兴国县"
+          },
+          {
+            "code" : "360733",
+            "name" : "会昌县"
+          },
+          {
+            "code" : "360734",
+            "name" : "寻乌县"
+          },
+          {
+            "code" : "360735",
+            "name" : "石城县"
+          },
+          {
+            "code" : "360781",
+            "name" : "瑞金市"
+          },
+          {
+            "code" : "360783",
+            "name" : "龙南市"
+          }
+        ]
+      },
+      {
+        "code" : "360800",
+        "name" : "吉安市",
+        "areaList" : [
+          {
+            "code" : "360802",
+            "name" : "吉州区"
+          },
+          {
+            "code" : "360803",
+            "name" : "青原区"
+          },
+          {
+            "code" : "360821",
+            "name" : "吉安县"
+          },
+          {
+            "code" : "360822",
+            "name" : "吉水县"
+          },
+          {
+            "code" : "360823",
+            "name" : "峡江县"
+          },
+          {
+            "code" : "360824",
+            "name" : "新干县"
+          },
+          {
+            "code" : "360825",
+            "name" : "永丰县"
+          },
+          {
+            "code" : "360826",
+            "name" : "泰和县"
+          },
+          {
+            "code" : "360827",
+            "name" : "遂川县"
+          },
+          {
+            "code" : "360828",
+            "name" : "万安县"
+          },
+          {
+            "code" : "360829",
+            "name" : "安福县"
+          },
+          {
+            "code" : "360830",
+            "name" : "永新县"
+          },
+          {
+            "code" : "360881",
+            "name" : "井冈山市"
+          }
+        ]
+      },
+      {
+        "code" : "360900",
+        "name" : "宜春市",
+        "areaList" : [
+          {
+            "code" : "360902",
+            "name" : "袁州区"
+          },
+          {
+            "code" : "360921",
+            "name" : "奉新县"
+          },
+          {
+            "code" : "360922",
+            "name" : "万载县"
+          },
+          {
+            "code" : "360923",
+            "name" : "上高县"
+          },
+          {
+            "code" : "360924",
+            "name" : "宜丰县"
+          },
+          {
+            "code" : "360925",
+            "name" : "靖安县"
+          },
+          {
+            "code" : "360926",
+            "name" : "铜鼓县"
+          },
+          {
+            "code" : "360981",
+            "name" : "丰城市"
+          },
+          {
+            "code" : "360982",
+            "name" : "樟树市"
+          },
+          {
+            "code" : "360983",
+            "name" : "高安市"
+          }
+        ]
+      },
+      {
+        "code" : "361000",
+        "name" : "抚州市",
+        "areaList" : [
+          {
+            "code" : "361002",
+            "name" : "临川区"
+          },
+          {
+            "code" : "361003",
+            "name" : "东乡区"
+          },
+          {
+            "code" : "361021",
+            "name" : "南城县"
+          },
+          {
+            "code" : "361022",
+            "name" : "黎川县"
+          },
+          {
+            "code" : "361023",
+            "name" : "南丰县"
+          },
+          {
+            "code" : "361024",
+            "name" : "崇仁县"
+          },
+          {
+            "code" : "361025",
+            "name" : "乐安县"
+          },
+          {
+            "code" : "361026",
+            "name" : "宜黄县"
+          },
+          {
+            "code" : "361027",
+            "name" : "金溪县"
+          },
+          {
+            "code" : "361028",
+            "name" : "资溪县"
+          },
+          {
+            "code" : "361030",
+            "name" : "广昌县"
+          }
+        ]
+      },
+      {
+        "code" : "361100",
+        "name" : "上饶市",
+        "areaList" : [
+          {
+            "code" : "361102",
+            "name" : "信州区"
+          },
+          {
+            "code" : "361103",
+            "name" : "广丰区"
+          },
+          {
+            "code" : "361104",
+            "name" : "广信区"
+          },
+          {
+            "code" : "361123",
+            "name" : "玉山县"
+          },
+          {
+            "code" : "361124",
+            "name" : "铅山县"
+          },
+          {
+            "code" : "361125",
+            "name" : "横峰县"
+          },
+          {
+            "code" : "361126",
+            "name" : "弋阳县"
+          },
+          {
+            "code" : "361127",
+            "name" : "余干县"
+          },
+          {
+            "code" : "361128",
+            "name" : "鄱阳县"
+          },
+          {
+            "code" : "361129",
+            "name" : "万年县"
+          },
+          {
+            "code" : "361130",
+            "name" : "婺源县"
+          },
+          {
+            "code" : "361181",
+            "name" : "德兴市"
+          }
+        ]
+      }
+    ]
+  },
+  {
+    "code" : "370000",
+    "name" : "山东省",
+    "cityList" : [
+      {
+        "code" : "370100",
+        "name" : "济南市",
+        "areaList" : [
+          {
+            "code" : "370102",
+            "name" : "历下区"
+          },
+          {
+            "code" : "370103",
+            "name" : "市中区"
+          },
+          {
+            "code" : "370104",
+            "name" : "槐荫区"
+          },
+          {
+            "code" : "370105",
+            "name" : "天桥区"
+          },
+          {
+            "code" : "370112",
+            "name" : "历城区"
+          },
+          {
+            "code" : "370113",
+            "name" : "长清区"
+          },
+          {
+            "code" : "370114",
+            "name" : "章丘区"
+          },
+          {
+            "code" : "370115",
+            "name" : "济阳区"
+          },
+          {
+            "code" : "370116",
+            "name" : "莱芜区"
+          },
+          {
+            "code" : "370117",
+            "name" : "钢城区"
+          },
+          {
+            "code" : "370124",
+            "name" : "平阴县"
+          },
+          {
+            "code" : "370126",
+            "name" : "商河县"
+          }
+        ]
+      },
+      {
+        "code" : "370200",
+        "name" : "青岛市",
+        "areaList" : [
+          {
+            "code" : "370202",
+            "name" : "市南区"
+          },
+          {
+            "code" : "370203",
+            "name" : "市北区"
+          },
+          {
+            "code" : "370211",
+            "name" : "黄岛区"
+          },
+          {
+            "code" : "370212",
+            "name" : "崂山区"
+          },
+          {
+            "code" : "370213",
+            "name" : "李沧区"
+          },
+          {
+            "code" : "370214",
+            "name" : "城阳区"
+          },
+          {
+            "code" : "370215",
+            "name" : "即墨区"
+          },
+          {
+            "code" : "370281",
+            "name" : "胶州市"
+          },
+          {
+            "code" : "370283",
+            "name" : "平度市"
+          },
+          {
+            "code" : "370285",
+            "name" : "莱西市"
+          }
+        ]
+      },
+      {
+        "code" : "370300",
+        "name" : "淄博市",
+        "areaList" : [
+          {
+            "code" : "370302",
+            "name" : "淄川区"
+          },
+          {
+            "code" : "370303",
+            "name" : "张店区"
+          },
+          {
+            "code" : "370304",
+            "name" : "博山区"
+          },
+          {
+            "code" : "370305",
+            "name" : "临淄区"
+          },
+          {
+            "code" : "370306",
+            "name" : "周村区"
+          },
+          {
+            "code" : "370321",
+            "name" : "桓台县"
+          },
+          {
+            "code" : "370322",
+            "name" : "高青县"
+          },
+          {
+            "code" : "370323",
+            "name" : "沂源县"
+          }
+        ]
+      },
+      {
+        "code" : "370400",
+        "name" : "枣庄市",
+        "areaList" : [
+          {
+            "code" : "370402",
+            "name" : "市中区"
+          },
+          {
+            "code" : "370403",
+            "name" : "薛城区"
+          },
+          {
+            "code" : "370404",
+            "name" : "峄城区"
+          },
+          {
+            "code" : "370405",
+            "name" : "台儿庄区"
+          },
+          {
+            "code" : "370406",
+            "name" : "山亭区"
+          },
+          {
+            "code" : "370481",
+            "name" : "滕州市"
+          }
+        ]
+      },
+      {
+        "code" : "370500",
+        "name" : "东营市",
+        "areaList" : [
+          {
+            "code" : "370502",
+            "name" : "东营区"
+          },
+          {
+            "code" : "370503",
+            "name" : "河口区"
+          },
+          {
+            "code" : "370505",
+            "name" : "垦利区"
+          },
+          {
+            "code" : "370522",
+            "name" : "利津县"
+          },
+          {
+            "code" : "370523",
+            "name" : "广饶县"
+          }
+        ]
+      },
+      {
+        "code" : "370600",
+        "name" : "烟台市",
+        "areaList" : [
+          {
+            "code" : "370602",
+            "name" : "芝罘区"
+          },
+          {
+            "code" : "370611",
+            "name" : "福山区"
+          },
+          {
+            "code" : "370612",
+            "name" : "牟平区"
+          },
+          {
+            "code" : "370613",
+            "name" : "莱山区"
+          },
+          {
+            "code" : "370614",
+            "name" : "蓬莱区"
+          },
+          {
+            "code" : "370681",
+            "name" : "龙口市"
+          },
+          {
+            "code" : "370682",
+            "name" : "莱阳市"
+          },
+          {
+            "code" : "370683",
+            "name" : "莱州市"
+          },
+          {
+            "code" : "370685",
+            "name" : "招远市"
+          },
+          {
+            "code" : "370686",
+            "name" : "栖霞市"
+          },
+          {
+            "code" : "370687",
+            "name" : "海阳市"
+          }
+        ]
+      },
+      {
+        "code" : "370700",
+        "name" : "潍坊市",
+        "areaList" : [
+          {
+            "code" : "370702",
+            "name" : "潍城区"
+          },
+          {
+            "code" : "370703",
+            "name" : "寒亭区"
+          },
+          {
+            "code" : "370704",
+            "name" : "坊子区"
+          },
+          {
+            "code" : "370705",
+            "name" : "奎文区"
+          },
+          {
+            "code" : "370724",
+            "name" : "临朐县"
+          },
+          {
+            "code" : "370725",
+            "name" : "昌乐县"
+          },
+          {
+            "code" : "370781",
+            "name" : "青州市"
+          },
+          {
+            "code" : "370782",
+            "name" : "诸城市"
+          },
+          {
+            "code" : "370783",
+            "name" : "寿光市"
+          },
+          {
+            "code" : "370784",
+            "name" : "安丘市"
+          },
+          {
+            "code" : "370785",
+            "name" : "高密市"
+          },
+          {
+            "code" : "370786",
+            "name" : "昌邑市"
+          }
+        ]
+      },
+      {
+        "code" : "370800",
+        "name" : "济宁市",
+        "areaList" : [
+          {
+            "code" : "370811",
+            "name" : "任城区"
+          },
+          {
+            "code" : "370812",
+            "name" : "兖州区"
+          },
+          {
+            "code" : "370826",
+            "name" : "微山县"
+          },
+          {
+            "code" : "370827",
+            "name" : "鱼台县"
+          },
+          {
+            "code" : "370828",
+            "name" : "金乡县"
+          },
+          {
+            "code" : "370829",
+            "name" : "嘉祥县"
+          },
+          {
+            "code" : "370830",
+            "name" : "汶上县"
+          },
+          {
+            "code" : "370831",
+            "name" : "泗水县"
+          },
+          {
+            "code" : "370832",
+            "name" : "梁山县"
+          },
+          {
+            "code" : "370881",
+            "name" : "曲阜市"
+          },
+          {
+            "code" : "370883",
+            "name" : "邹城市"
+          }
+        ]
+      },
+      {
+        "code" : "370900",
+        "name" : "泰安市",
+        "areaList" : [
+          {
+            "code" : "370902",
+            "name" : "泰山区"
+          },
+          {
+            "code" : "370911",
+            "name" : "岱岳区"
+          },
+          {
+            "code" : "370921",
+            "name" : "宁阳县"
+          },
+          {
+            "code" : "370923",
+            "name" : "东平县"
+          },
+          {
+            "code" : "370982",
+            "name" : "新泰市"
+          },
+          {
+            "code" : "370983",
+            "name" : "肥城市"
+          }
+        ]
+      },
+      {
+        "code" : "371000",
+        "name" : "威海市",
+        "areaList" : [
+          {
+            "code" : "371002",
+            "name" : "环翠区"
+          },
+          {
+            "code" : "371003",
+            "name" : "文登区"
+          },
+          {
+            "code" : "371082",
+            "name" : "荣成市"
+          },
+          {
+            "code" : "371083",
+            "name" : "乳山市"
+          }
+        ]
+      },
+      {
+        "code" : "371100",
+        "name" : "日照市",
+        "areaList" : [
+          {
+            "code" : "371102",
+            "name" : "东港区"
+          },
+          {
+            "code" : "371103",
+            "name" : "岚山区"
+          },
+          {
+            "code" : "371121",
+            "name" : "五莲县"
+          },
+          {
+            "code" : "371122",
+            "name" : "莒县"
+          }
+        ]
+      },
+      {
+        "code" : "371300",
+        "name" : "临沂市",
+        "areaList" : [
+          {
+            "code" : "371302",
+            "name" : "兰山区"
+          },
+          {
+            "code" : "371311",
+            "name" : "罗庄区"
+          },
+          {
+            "code" : "371312",
+            "name" : "河东区"
+          },
+          {
+            "code" : "371321",
+            "name" : "沂南县"
+          },
+          {
+            "code" : "371322",
+            "name" : "郯城县"
+          },
+          {
+            "code" : "371323",
+            "name" : "沂水县"
+          },
+          {
+            "code" : "371324",
+            "name" : "兰陵县"
+          },
+          {
+            "code" : "371325",
+            "name" : "费县"
+          },
+          {
+            "code" : "371326",
+            "name" : "平邑县"
+          },
+          {
+            "code" : "371327",
+            "name" : "莒南县"
+          },
+          {
+            "code" : "371328",
+            "name" : "蒙阴县"
+          },
+          {
+            "code" : "371329",
+            "name" : "临沭县"
+          }
+        ]
+      },
+      {
+        "code" : "371400",
+        "name" : "德州市",
+        "areaList" : [
+          {
+            "code" : "371402",
+            "name" : "德城区"
+          },
+          {
+            "code" : "371403",
+            "name" : "陵城区"
+          },
+          {
+            "code" : "371422",
+            "name" : "宁津县"
+          },
+          {
+            "code" : "371423",
+            "name" : "庆云县"
+          },
+          {
+            "code" : "371424",
+            "name" : "临邑县"
+          },
+          {
+            "code" : "371425",
+            "name" : "齐河县"
+          },
+          {
+            "code" : "371426",
+            "name" : "平原县"
+          },
+          {
+            "code" : "371427",
+            "name" : "夏津县"
+          },
+          {
+            "code" : "371428",
+            "name" : "武城县"
+          },
+          {
+            "code" : "371481",
+            "name" : "乐陵市"
+          },
+          {
+            "code" : "371482",
+            "name" : "禹城市"
+          }
+        ]
+      },
+      {
+        "code" : "371500",
+        "name" : "聊城市",
+        "areaList" : [
+          {
+            "code" : "371502",
+            "name" : "东昌府区"
+          },
+          {
+            "code" : "371503",
+            "name" : "茌平区"
+          },
+          {
+            "code" : "371521",
+            "name" : "阳谷县"
+          },
+          {
+            "code" : "371522",
+            "name" : "莘县"
+          },
+          {
+            "code" : "371524",
+            "name" : "东阿县"
+          },
+          {
+            "code" : "371525",
+            "name" : "冠县"
+          },
+          {
+            "code" : "371526",
+            "name" : "高唐县"
+          },
+          {
+            "code" : "371581",
+            "name" : "临清市"
+          }
+        ]
+      },
+      {
+        "code" : "371600",
+        "name" : "滨州市",
+        "areaList" : [
+          {
+            "code" : "371602",
+            "name" : "滨城区"
+          },
+          {
+            "code" : "371603",
+            "name" : "沾化区"
+          },
+          {
+            "code" : "371621",
+            "name" : "惠民县"
+          },
+          {
+            "code" : "371622",
+            "name" : "阳信县"
+          },
+          {
+            "code" : "371623",
+            "name" : "无棣县"
+          },
+          {
+            "code" : "371625",
+            "name" : "博兴县"
+          },
+          {
+            "code" : "371681",
+            "name" : "邹平市"
+          }
+        ]
+      },
+      {
+        "code" : "371700",
+        "name" : "菏泽市",
+        "areaList" : [
+          {
+            "code" : "371702",
+            "name" : "牡丹区"
+          },
+          {
+            "code" : "371703",
+            "name" : "定陶区"
+          },
+          {
+            "code" : "371721",
+            "name" : "曹县"
+          },
+          {
+            "code" : "371722",
+            "name" : "单县"
+          },
+          {
+            "code" : "371723",
+            "name" : "成武县"
+          },
+          {
+            "code" : "371724",
+            "name" : "巨野县"
+          },
+          {
+            "code" : "371725",
+            "name" : "郓城县"
+          },
+          {
+            "code" : "371726",
+            "name" : "鄄城县"
+          },
+          {
+            "code" : "371728",
+            "name" : "东明县"
+          }
+        ]
+      }
+    ]
+  },
+  {
+    "code" : "410000",
+    "name" : "河南省",
+    "cityList" : [
+      {
+        "code" : "410100",
+        "name" : "郑州市",
+        "areaList" : [
+          {
+            "code" : "410102",
+            "name" : "中原区"
+          },
+          {
+            "code" : "410103",
+            "name" : "二七区"
+          },
+          {
+            "code" : "410104",
+            "name" : "管城回族区"
+          },
+          {
+            "code" : "410105",
+            "name" : "金水区"
+          },
+          {
+            "code" : "410106",
+            "name" : "上街区"
+          },
+          {
+            "code" : "410108",
+            "name" : "惠济区"
+          },
+          {
+            "code" : "410122",
+            "name" : "中牟县"
+          },
+          {
+            "code" : "410181",
+            "name" : "巩义市"
+          },
+          {
+            "code" : "410182",
+            "name" : "荥阳市"
+          },
+          {
+            "code" : "410183",
+            "name" : "新密市"
+          },
+          {
+            "code" : "410184",
+            "name" : "新郑市"
+          },
+          {
+            "code" : "410185",
+            "name" : "登封市"
+          }
+        ]
+      },
+      {
+        "code" : "410200",
+        "name" : "开封市",
+        "areaList" : [
+          {
+            "code" : "410202",
+            "name" : "龙亭区"
+          },
+          {
+            "code" : "410203",
+            "name" : "顺河回族区"
+          },
+          {
+            "code" : "410204",
+            "name" : "鼓楼区"
+          },
+          {
+            "code" : "410205",
+            "name" : "禹王台区"
+          },
+          {
+            "code" : "410212",
+            "name" : "祥符区"
+          },
+          {
+            "code" : "410221",
+            "name" : "杞县"
+          },
+          {
+            "code" : "410222",
+            "name" : "通许县"
+          },
+          {
+            "code" : "410223",
+            "name" : "尉氏县"
+          },
+          {
+            "code" : "410225",
+            "name" : "兰考县"
+          }
+        ]
+      },
+      {
+        "code" : "410300",
+        "name" : "洛阳市",
+        "areaList" : [
+          {
+            "code" : "410302",
+            "name" : "老城区"
+          },
+          {
+            "code" : "410303",
+            "name" : "西工区"
+          },
+          {
+            "code" : "410304",
+            "name" : "瀍河回族区"
+          },
+          {
+            "code" : "410305",
+            "name" : "涧西区"
+          },
+          {
+            "code" : "410307",
+            "name" : "偃师区"
+          },
+          {
+            "code" : "410308",
+            "name" : "孟津区"
+          },
+          {
+            "code" : "410311",
+            "name" : "洛龙区"
+          },
+          {
+            "code" : "410323",
+            "name" : "新安县"
+          },
+          {
+            "code" : "410324",
+            "name" : "栾川县"
+          },
+          {
+            "code" : "410325",
+            "name" : "嵩县"
+          },
+          {
+            "code" : "410326",
+            "name" : "汝阳县"
+          },
+          {
+            "code" : "410327",
+            "name" : "宜阳县"
+          },
+          {
+            "code" : "410328",
+            "name" : "洛宁县"
+          },
+          {
+            "code" : "410329",
+            "name" : "伊川县"
+          }
+        ]
+      },
+      {
+        "code" : "410400",
+        "name" : "平顶山市",
+        "areaList" : [
+          {
+            "code" : "410402",
+            "name" : "新华区"
+          },
+          {
+            "code" : "410403",
+            "name" : "卫东区"
+          },
+          {
+            "code" : "410404",
+            "name" : "石龙区"
+          },
+          {
+            "code" : "410411",
+            "name" : "湛河区"
+          },
+          {
+            "code" : "410421",
+            "name" : "宝丰县"
+          },
+          {
+            "code" : "410422",
+            "name" : "叶县"
+          },
+          {
+            "code" : "410423",
+            "name" : "鲁山县"
+          },
+          {
+            "code" : "410425",
+            "name" : "郏县"
+          },
+          {
+            "code" : "410481",
+            "name" : "舞钢市"
+          },
+          {
+            "code" : "410482",
+            "name" : "汝州市"
+          }
+        ]
+      },
+      {
+        "code" : "410500",
+        "name" : "安阳市",
+        "areaList" : [
+          {
+            "code" : "410502",
+            "name" : "文峰区"
+          },
+          {
+            "code" : "410503",
+            "name" : "北关区"
+          },
+          {
+            "code" : "410505",
+            "name" : "殷都区"
+          },
+          {
+            "code" : "410506",
+            "name" : "龙安区"
+          },
+          {
+            "code" : "410522",
+            "name" : "安阳县"
+          },
+          {
+            "code" : "410523",
+            "name" : "汤阴县"
+          },
+          {
+            "code" : "410526",
+            "name" : "滑县"
+          },
+          {
+            "code" : "410527",
+            "name" : "内黄县"
+          },
+          {
+            "code" : "410581",
+            "name" : "林州市"
+          }
+        ]
+      },
+      {
+        "code" : "410600",
+        "name" : "鹤壁市",
+        "areaList" : [
+          {
+            "code" : "410602",
+            "name" : "鹤山区"
+          },
+          {
+            "code" : "410603",
+            "name" : "山城区"
+          },
+          {
+            "code" : "410611",
+            "name" : "淇滨区"
+          },
+          {
+            "code" : "410621",
+            "name" : "浚县"
+          },
+          {
+            "code" : "410622",
+            "name" : "淇县"
+          }
+        ]
+      },
+      {
+        "code" : "410700",
+        "name" : "新乡市",
+        "areaList" : [
+          {
+            "code" : "410702",
+            "name" : "红旗区"
+          },
+          {
+            "code" : "410703",
+            "name" : "卫滨区"
+          },
+          {
+            "code" : "410704",
+            "name" : "凤泉区"
+          },
+          {
+            "code" : "410711",
+            "name" : "牧野区"
+          },
+          {
+            "code" : "410721",
+            "name" : "新乡县"
+          },
+          {
+            "code" : "410724",
+            "name" : "获嘉县"
+          },
+          {
+            "code" : "410725",
+            "name" : "原阳县"
+          },
+          {
+            "code" : "410726",
+            "name" : "延津县"
+          },
+          {
+            "code" : "410727",
+            "name" : "封丘县"
+          },
+          {
+            "code" : "410781",
+            "name" : "卫辉市"
+          },
+          {
+            "code" : "410782",
+            "name" : "辉县市"
+          },
+          {
+            "code" : "410783",
+            "name" : "长垣市"
+          }
+        ]
+      },
+      {
+        "code" : "410800",
+        "name" : "焦作市",
+        "areaList" : [
+          {
+            "code" : "410802",
+            "name" : "解放区"
+          },
+          {
+            "code" : "410803",
+            "name" : "中站区"
+          },
+          {
+            "code" : "410804",
+            "name" : "马村区"
+          },
+          {
+            "code" : "410811",
+            "name" : "山阳区"
+          },
+          {
+            "code" : "410821",
+            "name" : "修武县"
+          },
+          {
+            "code" : "410822",
+            "name" : "博爱县"
+          },
+          {
+            "code" : "410823",
+            "name" : "武陟县"
+          },
+          {
+            "code" : "410825",
+            "name" : "温县"
+          },
+          {
+            "code" : "410882",
+            "name" : "沁阳市"
+          },
+          {
+            "code" : "410883",
+            "name" : "孟州市"
+          }
+        ]
+      },
+      {
+        "code" : "410900",
+        "name" : "濮阳市",
+        "areaList" : [
+          {
+            "code" : "410902",
+            "name" : "华龙区"
+          },
+          {
+            "code" : "410922",
+            "name" : "清丰县"
+          },
+          {
+            "code" : "410923",
+            "name" : "南乐县"
+          },
+          {
+            "code" : "410926",
+            "name" : "范县"
+          },
+          {
+            "code" : "410927",
+            "name" : "台前县"
+          },
+          {
+            "code" : "410928",
+            "name" : "濮阳县"
+          }
+        ]
+      },
+      {
+        "code" : "411000",
+        "name" : "许昌市",
+        "areaList" : [
+          {
+            "code" : "411002",
+            "name" : "魏都区"
+          },
+          {
+            "code" : "411003",
+            "name" : "建安区"
+          },
+          {
+            "code" : "411024",
+            "name" : "鄢陵县"
+          },
+          {
+            "code" : "411025",
+            "name" : "襄城县"
+          },
+          {
+            "code" : "411081",
+            "name" : "禹州市"
+          },
+          {
+            "code" : "411082",
+            "name" : "长葛市"
+          }
+        ]
+      },
+      {
+        "code" : "411100",
+        "name" : "漯河市",
+        "areaList" : [
+          {
+            "code" : "411102",
+            "name" : "源汇区"
+          },
+          {
+            "code" : "411103",
+            "name" : "郾城区"
+          },
+          {
+            "code" : "411104",
+            "name" : "召陵区"
+          },
+          {
+            "code" : "411121",
+            "name" : "舞阳县"
+          },
+          {
+            "code" : "411122",
+            "name" : "临颍县"
+          }
+        ]
+      },
+      {
+        "code" : "411200",
+        "name" : "三门峡市",
+        "areaList" : [
+          {
+            "code" : "411202",
+            "name" : "湖滨区"
+          },
+          {
+            "code" : "411203",
+            "name" : "陕州区"
+          },
+          {
+            "code" : "411221",
+            "name" : "渑池县"
+          },
+          {
+            "code" : "411224",
+            "name" : "卢氏县"
+          },
+          {
+            "code" : "411281",
+            "name" : "义马市"
+          },
+          {
+            "code" : "411282",
+            "name" : "灵宝市"
+          }
+        ]
+      },
+      {
+        "code" : "411300",
+        "name" : "南阳市",
+        "areaList" : [
+          {
+            "code" : "411302",
+            "name" : "宛城区"
+          },
+          {
+            "code" : "411303",
+            "name" : "卧龙区"
+          },
+          {
+            "code" : "411321",
+            "name" : "南召县"
+          },
+          {
+            "code" : "411322",
+            "name" : "方城县"
+          },
+          {
+            "code" : "411323",
+            "name" : "西峡县"
+          },
+          {
+            "code" : "411324",
+            "name" : "镇平县"
+          },
+          {
+            "code" : "411325",
+            "name" : "内乡县"
+          },
+          {
+            "code" : "411326",
+            "name" : "淅川县"
+          },
+          {
+            "code" : "411327",
+            "name" : "社旗县"
+          },
+          {
+            "code" : "411328",
+            "name" : "唐河县"
+          },
+          {
+            "code" : "411329",
+            "name" : "新野县"
+          },
+          {
+            "code" : "411330",
+            "name" : "桐柏县"
+          },
+          {
+            "code" : "411381",
+            "name" : "邓州市"
+          }
+        ]
+      },
+      {
+        "code" : "411400",
+        "name" : "商丘市",
+        "areaList" : [
+          {
+            "code" : "411402",
+            "name" : "梁园区"
+          },
+          {
+            "code" : "411403",
+            "name" : "睢阳区"
+          },
+          {
+            "code" : "411421",
+            "name" : "民权县"
+          },
+          {
+            "code" : "411422",
+            "name" : "睢县"
+          },
+          {
+            "code" : "411423",
+            "name" : "宁陵县"
+          },
+          {
+            "code" : "411424",
+            "name" : "柘城县"
+          },
+          {
+            "code" : "411425",
+            "name" : "虞城县"
+          },
+          {
+            "code" : "411426",
+            "name" : "夏邑县"
+          },
+          {
+            "code" : "411481",
+            "name" : "永城市"
+          }
+        ]
+      },
+      {
+        "code" : "411500",
+        "name" : "信阳市",
+        "areaList" : [
+          {
+            "code" : "411502",
+            "name" : "浉河区"
+          },
+          {
+            "code" : "411503",
+            "name" : "平桥区"
+          },
+          {
+            "code" : "411521",
+            "name" : "罗山县"
+          },
+          {
+            "code" : "411522",
+            "name" : "光山县"
+          },
+          {
+            "code" : "411523",
+            "name" : "新县"
+          },
+          {
+            "code" : "411524",
+            "name" : "商城县"
+          },
+          {
+            "code" : "411525",
+            "name" : "固始县"
+          },
+          {
+            "code" : "411526",
+            "name" : "潢川县"
+          },
+          {
+            "code" : "411527",
+            "name" : "淮滨县"
+          },
+          {
+            "code" : "411528",
+            "name" : "息县"
+          }
+        ]
+      },
+      {
+        "code" : "411600",
+        "name" : "周口市",
+        "areaList" : [
+          {
+            "code" : "411602",
+            "name" : "川汇区"
+          },
+          {
+            "code" : "411603",
+            "name" : "淮阳区"
+          },
+          {
+            "code" : "411621",
+            "name" : "扶沟县"
+          },
+          {
+            "code" : "411622",
+            "name" : "西华县"
+          },
+          {
+            "code" : "411623",
+            "name" : "商水县"
+          },
+          {
+            "code" : "411624",
+            "name" : "沈丘县"
+          },
+          {
+            "code" : "411625",
+            "name" : "郸城县"
+          },
+          {
+            "code" : "411627",
+            "name" : "太康县"
+          },
+          {
+            "code" : "411628",
+            "name" : "鹿邑县"
+          },
+          {
+            "code" : "411681",
+            "name" : "项城市"
+          }
+        ]
+      },
+      {
+        "code" : "411700",
+        "name" : "驻马店市",
+        "areaList" : [
+          {
+            "code" : "411702",
+            "name" : "驿城区"
+          },
+          {
+            "code" : "411721",
+            "name" : "西平县"
+          },
+          {
+            "code" : "411722",
+            "name" : "上蔡县"
+          },
+          {
+            "code" : "411723",
+            "name" : "平舆县"
+          },
+          {
+            "code" : "411724",
+            "name" : "正阳县"
+          },
+          {
+            "code" : "411725",
+            "name" : "确山县"
+          },
+          {
+            "code" : "411726",
+            "name" : "泌阳县"
+          },
+          {
+            "code" : "411727",
+            "name" : "汝南县"
+          },
+          {
+            "code" : "411728",
+            "name" : "遂平县"
+          },
+          {
+            "code" : "411729",
+            "name" : "新蔡县"
+          }
+        ]
+      },
+      {
+        "code" : "419001",
+        "name" : "济源市",
+        "areaList" : [
+          {
+            "code" : "419001",
+            "name" : "坡头镇"
+          },
+          {
+            "code" : "419001",
+            "name" : "梨林镇"
+          },
+          {
+            "code" : "419001",
+            "name" : "思礼镇"
+          },
+          {
+            "code" : "419001",
+            "name" : "五龙口镇"
+          },
+          {
+            "code" : "419001",
+            "name" : "王屋镇"
+          },
+          {
+            "code" : "419001",
+            "name" : "玉泉街道"
+          },
+          {
+            "code" : "419001",
+            "name" : "轵城镇"
+          },
+          {
+            "code" : "419001",
+            "name" : "济水街道"
+          },
+          {
+            "code" : "419001",
+            "name" : "沁园街道"
+          },
+          {
+            "code" : "419001",
+            "name" : "下冶镇"
+          },
+          {
+            "code" : "419001",
+            "name" : "克井镇"
+          },
+          {
+            "code" : "419001",
+            "name" : "天坛街道"
+          },
+          {
+            "code" : "419001",
+            "name" : "邵原镇"
+          },
+          {
+            "code" : "419001",
+            "name" : "北海街道"
+          },
+          {
+            "code" : "419001",
+            "name" : "承留镇"
+          },
+          {
+            "code" : "419001",
+            "name" : "大峪镇"
+          }
+        ]
+      }
+    ]
+  },
+  {
+    "code" : "420000",
+    "name" : "湖北省",
+    "cityList" : [
+      {
+        "code" : "420100",
+        "name" : "武汉市",
+        "areaList" : [
+          {
+            "code" : "420102",
+            "name" : "江岸区"
+          },
+          {
+            "code" : "420103",
+            "name" : "江汉区"
+          },
+          {
+            "code" : "420104",
+            "name" : "硚口区"
+          },
+          {
+            "code" : "420105",
+            "name" : "汉阳区"
+          },
+          {
+            "code" : "420106",
+            "name" : "武昌区"
+          },
+          {
+            "code" : "420107",
+            "name" : "青山区"
+          },
+          {
+            "code" : "420111",
+            "name" : "洪山区"
+          },
+          {
+            "code" : "420112",
+            "name" : "东西湖区"
+          },
+          {
+            "code" : "420113",
+            "name" : "汉南区"
+          },
+          {
+            "code" : "420114",
+            "name" : "蔡甸区"
+          },
+          {
+            "code" : "420115",
+            "name" : "江夏区"
+          },
+          {
+            "code" : "420116",
+            "name" : "黄陂区"
+          },
+          {
+            "code" : "420117",
+            "name" : "新洲区"
+          }
+        ]
+      },
+      {
+        "code" : "420200",
+        "name" : "黄石市",
+        "areaList" : [
+          {
+            "code" : "420202",
+            "name" : "黄石港区"
+          },
+          {
+            "code" : "420203",
+            "name" : "西塞山区"
+          },
+          {
+            "code" : "420204",
+            "name" : "下陆区"
+          },
+          {
+            "code" : "420205",
+            "name" : "铁山区"
+          },
+          {
+            "code" : "420222",
+            "name" : "阳新县"
+          },
+          {
+            "code" : "420281",
+            "name" : "大冶市"
+          }
+        ]
+      },
+      {
+        "code" : "420300",
+        "name" : "十堰市",
+        "areaList" : [
+          {
+            "code" : "420302",
+            "name" : "茅箭区"
+          },
+          {
+            "code" : "420303",
+            "name" : "张湾区"
+          },
+          {
+            "code" : "420304",
+            "name" : "郧阳区"
+          },
+          {
+            "code" : "420322",
+            "name" : "郧西县"
+          },
+          {
+            "code" : "420323",
+            "name" : "竹山县"
+          },
+          {
+            "code" : "420324",
+            "name" : "竹溪县"
+          },
+          {
+            "code" : "420325",
+            "name" : "房县"
+          },
+          {
+            "code" : "420381",
+            "name" : "丹江口市"
+          }
+        ]
+      },
+      {
+        "code" : "420500",
+        "name" : "宜昌市",
+        "areaList" : [
+          {
+            "code" : "420502",
+            "name" : "西陵区"
+          },
+          {
+            "code" : "420503",
+            "name" : "伍家岗区"
+          },
+          {
+            "code" : "420504",
+            "name" : "点军区"
+          },
+          {
+            "code" : "420505",
+            "name" : "猇亭区"
+          },
+          {
+            "code" : "420506",
+            "name" : "夷陵区"
+          },
+          {
+            "code" : "420525",
+            "name" : "远安县"
+          },
+          {
+            "code" : "420526",
+            "name" : "兴山县"
+          },
+          {
+            "code" : "420527",
+            "name" : "秭归县"
+          },
+          {
+            "code" : "420528",
+            "name" : "长阳土家族自治县"
+          },
+          {
+            "code" : "420529",
+            "name" : "五峰土家族自治县"
+          },
+          {
+            "code" : "420581",
+            "name" : "宜都市"
+          },
+          {
+            "code" : "420582",
+            "name" : "当阳市"
+          },
+          {
+            "code" : "420583",
+            "name" : "枝江市"
+          }
+        ]
+      },
+      {
+        "code" : "420600",
+        "name" : "襄阳市",
+        "areaList" : [
+          {
+            "code" : "420602",
+            "name" : "襄城区"
+          },
+          {
+            "code" : "420606",
+            "name" : "樊城区"
+          },
+          {
+            "code" : "420607",
+            "name" : "襄州区"
+          },
+          {
+            "code" : "420624",
+            "name" : "南漳县"
+          },
+          {
+            "code" : "420625",
+            "name" : "谷城县"
+          },
+          {
+            "code" : "420626",
+            "name" : "保康县"
+          },
+          {
+            "code" : "420682",
+            "name" : "老河口市"
+          },
+          {
+            "code" : "420683",
+            "name" : "枣阳市"
+          },
+          {
+            "code" : "420684",
+            "name" : "宜城市"
+          }
+        ]
+      },
+      {
+        "code" : "420700",
+        "name" : "鄂州市",
+        "areaList" : [
+          {
+            "code" : "420702",
+            "name" : "梁子湖区"
+          },
+          {
+            "code" : "420703",
+            "name" : "华容区"
+          },
+          {
+            "code" : "420704",
+            "name" : "鄂城区"
+          }
+        ]
+      },
+      {
+        "code" : "420800",
+        "name" : "荆门市",
+        "areaList" : [
+          {
+            "code" : "420802",
+            "name" : "东宝区"
+          },
+          {
+            "code" : "420804",
+            "name" : "掇刀区"
+          },
+          {
+            "code" : "420822",
+            "name" : "沙洋县"
+          },
+          {
+            "code" : "420881",
+            "name" : "钟祥市"
+          },
+          {
+            "code" : "420882",
+            "name" : "京山市"
+          }
+        ]
+      },
+      {
+        "code" : "420900",
+        "name" : "孝感市",
+        "areaList" : [
+          {
+            "code" : "420902",
+            "name" : "孝南区"
+          },
+          {
+            "code" : "420921",
+            "name" : "孝昌县"
+          },
+          {
+            "code" : "420922",
+            "name" : "大悟县"
+          },
+          {
+            "code" : "420923",
+            "name" : "云梦县"
+          },
+          {
+            "code" : "420981",
+            "name" : "应城市"
+          },
+          {
+            "code" : "420982",
+            "name" : "安陆市"
+          },
+          {
+            "code" : "420984",
+            "name" : "汉川市"
+          }
+        ]
+      },
+      {
+        "code" : "421000",
+        "name" : "荆州市",
+        "areaList" : [
+          {
+            "code" : "421002",
+            "name" : "沙市区"
+          },
+          {
+            "code" : "421003",
+            "name" : "荆州区"
+          },
+          {
+            "code" : "421022",
+            "name" : "公安县"
+          },
+          {
+            "code" : "421024",
+            "name" : "江陵县"
+          },
+          {
+            "code" : "421081",
+            "name" : "石首市"
+          },
+          {
+            "code" : "421083",
+            "name" : "洪湖市"
+          },
+          {
+            "code" : "421087",
+            "name" : "松滋市"
+          },
+          {
+            "code" : "421088",
+            "name" : "监利市"
+          }
+        ]
+      },
+      {
+        "code" : "421100",
+        "name" : "黄冈市",
+        "areaList" : [
+          {
+            "code" : "421102",
+            "name" : "黄州区"
+          },
+          {
+            "code" : "421121",
+            "name" : "团风县"
+          },
+          {
+            "code" : "421122",
+            "name" : "红安县"
+          },
+          {
+            "code" : "421123",
+            "name" : "罗田县"
+          },
+          {
+            "code" : "421124",
+            "name" : "英山县"
+          },
+          {
+            "code" : "421125",
+            "name" : "浠水县"
+          },
+          {
+            "code" : "421126",
+            "name" : "蕲春县"
+          },
+          {
+            "code" : "421127",
+            "name" : "黄梅县"
+          },
+          {
+            "code" : "421181",
+            "name" : "麻城市"
+          },
+          {
+            "code" : "421182",
+            "name" : "武穴市"
+          }
+        ]
+      },
+      {
+        "code" : "421200",
+        "name" : "咸宁市",
+        "areaList" : [
+          {
+            "code" : "421202",
+            "name" : "咸安区"
+          },
+          {
+            "code" : "421221",
+            "name" : "嘉鱼县"
+          },
+          {
+            "code" : "421222",
+            "name" : "通城县"
+          },
+          {
+            "code" : "421223",
+            "name" : "崇阳县"
+          },
+          {
+            "code" : "421224",
+            "name" : "通山县"
+          },
+          {
+            "code" : "421281",
+            "name" : "赤壁市"
+          }
+        ]
+      },
+      {
+        "code" : "421300",
+        "name" : "随州市",
+        "areaList" : [
+          {
+            "code" : "421303",
+            "name" : "曾都区"
+          },
+          {
+            "code" : "421321",
+            "name" : "随县"
+          },
+          {
+            "code" : "421381",
+            "name" : "广水市"
+          }
+        ]
+      },
+      {
+        "code" : "422800",
+        "name" : "恩施土家族苗族自治州",
+        "areaList" : [
+          {
+            "code" : "422801",
+            "name" : "恩施市"
+          },
+          {
+            "code" : "422802",
+            "name" : "利川市"
+          },
+          {
+            "code" : "422822",
+            "name" : "建始县"
+          },
+          {
+            "code" : "422823",
+            "name" : "巴东县"
+          },
+          {
+            "code" : "422825",
+            "name" : "宣恩县"
+          },
+          {
+            "code" : "422826",
+            "name" : "咸丰县"
+          },
+          {
+            "code" : "422827",
+            "name" : "来凤县"
+          },
+          {
+            "code" : "422828",
+            "name" : "鹤峰县"
+          }
+        ]
+      },
+      {
+        "code" : "429004",
+        "name" : "仙桃市",
+        "areaList" : [
+          {
+            "code" : "429004",
+            "name" : "通海口镇"
+          },
+          {
+            "code" : "429004",
+            "name" : "胡场镇"
+          },
+          {
+            "code" : "429004",
+            "name" : "干河街道"
+          },
+          {
+            "code" : "429004",
+            "name" : "杨林尾镇"
+          },
+          {
+            "code" : "429004",
+            "name" : "彭场镇"
+          },
+          {
+            "code" : "429004",
+            "name" : "沔城回族镇"
+          },
+          {
+            "code" : "429004",
+            "name" : "龙华山街道"
+          },
+          {
+            "code" : "429004",
+            "name" : "沙湖原种场"
+          },
+          {
+            "code" : "429004",
+            "name" : "郑场镇"
+          },
+          {
+            "code" : "429004",
+            "name" : "郭河镇"
+          },
+          {
+            "code" : "429004",
+            "name" : "排湖风景区"
+          },
+          {
+            "code" : "429004",
+            "name" : "沙嘴街道"
+          },
+          {
+            "code" : "429004",
+            "name" : "毛嘴镇"
+          },
+          {
+            "code" : "429004",
+            "name" : "张沟镇"
+          },
+          {
+            "code" : "429004",
+            "name" : "三伏潭镇"
+          },
+          {
+            "code" : "429004",
+            "name" : "西流河镇"
+          },
+          {
+            "code" : "429004",
+            "name" : "五湖渔场"
+          },
+          {
+            "code" : "429004",
+            "name" : "长埫口镇"
+          },
+          {
+            "code" : "429004",
+            "name" : "杜湖街道"
+          },
+          {
+            "code" : "429004",
+            "name" : "沙湖镇"
+          },
+          {
+            "code" : "429004",
+            "name" : "陈场镇"
+          },
+          {
+            "code" : "429004",
+            "name" : "剅河镇"
+          }
+        ]
+      },
+      {
+        "code" : "429005",
+        "name" : "潜江市",
+        "areaList" : [
+          {
+            "code" : "429005",
+            "name" : "泰丰街道"
+          },
+          {
+            "code" : "429005",
+            "name" : "广华寺街道"
+          },
+          {
+            "code" : "429005",
+            "name" : "周矶管理区"
+          },
+          {
+            "code" : "429005",
+            "name" : "高场街道"
+          },
+          {
+            "code" : "429005",
+            "name" : "总口管理区"
+          },
+          {
+            "code" : "429005",
+            "name" : "运粮湖管理区"
+          },
+          {
+            "code" : "429005",
+            "name" : "王场镇"
+          },
+          {
+            "code" : "429005",
+            "name" : "园林街道"
+          },
+          {
+            "code" : "429005",
+            "name" : "竹根滩镇"
+          },
+          {
+            "code" : "429005",
+            "name" : "白鹭湖管理区"
+          },
+          {
+            "code" : "429005",
+            "name" : "渔洋镇"
+          },
+          {
+            "code" : "429005",
+            "name" : "熊口镇"
+          },
+          {
+            "code" : "429005",
+            "name" : "后湖管理区"
+          },
+          {
+            "code" : "429005",
+            "name" : "熊口管理区"
+          },
+          {
+            "code" : "429005",
+            "name" : "张金镇"
+          },
+          {
+            "code" : "429005",
+            "name" : "杨市街道"
+          },
+          {
+            "code" : "429005",
+            "name" : "高石碑镇"
+          },
+          {
+            "code" : "429005",
+            "name" : "周矶街道"
+          },
+          {
+            "code" : "429005",
+            "name" : "积玉口镇"
+          },
+          {
+            "code" : "429005",
+            "name" : "泽口街道"
+          },
+          {
+            "code" : "429005",
+            "name" : "浩口镇"
+          },
+          {
+            "code" : "429005",
+            "name" : "老新镇"
+          },
+          {
+            "code" : "429005",
+            "name" : "龙湾镇"
+          }
+        ]
+      },
+      {
+        "code" : "429006",
+        "name" : "天门市",
+        "areaList" : [
+          {
+            "code" : "429006",
+            "name" : "胡市镇"
+          },
+          {
+            "code" : "429006",
+            "name" : "多祥镇"
+          },
+          {
+            "code" : "429006",
+            "name" : "黄潭镇"
+          },
+          {
+            "code" : "429006",
+            "name" : "沉湖管委会"
+          },
+          {
+            "code" : "429006",
+            "name" : "干驿镇"
+          },
+          {
+            "code" : "429006",
+            "name" : "马湾镇"
+          },
+          {
+            "code" : "429006",
+            "name" : "横林镇"
+          },
+          {
+            "code" : "429006",
+            "name" : "蒋湖农场"
+          },
+          {
+            "code" : "429006",
+            "name" : "小板镇"
+          },
+          {
+            "code" : "429006",
+            "name" : "岳口镇"
+          },
+          {
+            "code" : "429006",
+            "name" : "蒋场镇"
+          },
+          {
+            "code" : "429006",
+            "name" : "石家河镇"
+          },
+          {
+            "code" : "429006",
+            "name" : "彭市镇"
+          },
+          {
+            "code" : "429006",
+            "name" : "九真镇"
+          },
+          {
+            "code" : "429006",
+            "name" : "佛子山镇"
+          },
+          {
+            "code" : "429006",
+            "name" : "侯口街道"
+          },
+          {
+            "code" : "429006",
+            "name" : "竟陵街道"
+          },
+          {
+            "code" : "429006",
+            "name" : "麻洋镇"
+          },
+          {
+            "code" : "429006",
+            "name" : "杨林街道"
+          },
+          {
+            "code" : "429006",
+            "name" : "汪场镇"
+          },
+          {
+            "code" : "429006",
+            "name" : "白茅湖农场"
+          },
+          {
+            "code" : "429006",
+            "name" : "皂市镇"
+          },
+          {
+            "code" : "429006",
+            "name" : "拖市镇"
+          },
+          {
+            "code" : "429006",
+            "name" : "卢市镇"
+          },
+          {
+            "code" : "429006",
+            "name" : "净潭乡"
+          },
+          {
+            "code" : "429006",
+            "name" : "多宝镇"
+          },
+          {
+            "code" : "429006",
+            "name" : "张港镇"
+          },
+          {
+            "code" : "429006",
+            "name" : "渔薪镇"
+          }
+        ]
+      },
+      {
+        "code" : "429021",
+        "name" : "神农架林区",
+        "areaList" : [
+          {
+            "code" : "429021",
+            "name" : "木鱼镇"
+          },
+          {
+            "code" : "429021",
+            "name" : "新华镇"
+          },
+          {
+            "code" : "429021",
+            "name" : "宋洛乡"
+          },
+          {
+            "code" : "429021",
+            "name" : "松柏镇"
+          },
+          {
+            "code" : "429021",
+            "name" : "红坪镇"
+          },
+          {
+            "code" : "429021",
+            "name" : "阳日镇"
+          },
+          {
+            "code" : "429021",
+            "name" : "大九湖镇"
+          },
+          {
+            "code" : "429021",
+            "name" : "下谷坪土家族乡"
+          }
+        ]
+      }
+    ]
+  },
+  {
+    "code" : "430000",
+    "name" : "湖南省",
+    "cityList" : [
+      {
+        "code" : "430100",
+        "name" : "长沙市",
+        "areaList" : [
+          {
+            "code" : "430102",
+            "name" : "芙蓉区"
+          },
+          {
+            "code" : "430103",
+            "name" : "天心区"
+          },
+          {
+            "code" : "430104",
+            "name" : "岳麓区"
+          },
+          {
+            "code" : "430105",
+            "name" : "开福区"
+          },
+          {
+            "code" : "430111",
+            "name" : "雨花区"
+          },
+          {
+            "code" : "430112",
+            "name" : "望城区"
+          },
+          {
+            "code" : "430121",
+            "name" : "长沙县"
+          },
+          {
+            "code" : "430181",
+            "name" : "浏阳市"
+          },
+          {
+            "code" : "430182",
+            "name" : "宁乡市"
+          }
+        ]
+      },
+      {
+        "code" : "430200",
+        "name" : "株洲市",
+        "areaList" : [
+          {
+            "code" : "430202",
+            "name" : "荷塘区"
+          },
+          {
+            "code" : "430203",
+            "name" : "芦淞区"
+          },
+          {
+            "code" : "430204",
+            "name" : "石峰区"
+          },
+          {
+            "code" : "430211",
+            "name" : "天元区"
+          },
+          {
+            "code" : "430212",
+            "name" : "渌口区"
+          },
+          {
+            "code" : "430223",
+            "name" : "攸县"
+          },
+          {
+            "code" : "430224",
+            "name" : "茶陵县"
+          },
+          {
+            "code" : "430225",
+            "name" : "炎陵县"
+          },
+          {
+            "code" : "430281",
+            "name" : "醴陵市"
+          }
+        ]
+      },
+      {
+        "code" : "430300",
+        "name" : "湘潭市",
+        "areaList" : [
+          {
+            "code" : "430302",
+            "name" : "雨湖区"
+          },
+          {
+            "code" : "430304",
+            "name" : "岳塘区"
+          },
+          {
+            "code" : "430321",
+            "name" : "湘潭县"
+          },
+          {
+            "code" : "430381",
+            "name" : "湘乡市"
+          },
+          {
+            "code" : "430382",
+            "name" : "韶山市"
+          }
+        ]
+      },
+      {
+        "code" : "430400",
+        "name" : "衡阳市",
+        "areaList" : [
+          {
+            "code" : "430405",
+            "name" : "珠晖区"
+          },
+          {
+            "code" : "430406",
+            "name" : "雁峰区"
+          },
+          {
+            "code" : "430407",
+            "name" : "石鼓区"
+          },
+          {
+            "code" : "430408",
+            "name" : "蒸湘区"
+          },
+          {
+            "code" : "430412",
+            "name" : "南岳区"
+          },
+          {
+            "code" : "430421",
+            "name" : "衡阳县"
+          },
+          {
+            "code" : "430422",
+            "name" : "衡南县"
+          },
+          {
+            "code" : "430423",
+            "name" : "衡山县"
+          },
+          {
+            "code" : "430424",
+            "name" : "衡东县"
+          },
+          {
+            "code" : "430426",
+            "name" : "祁东县"
+          },
+          {
+            "code" : "430481",
+            "name" : "耒阳市"
+          },
+          {
+            "code" : "430482",
+            "name" : "常宁市"
+          }
+        ]
+      },
+      {
+        "code" : "430500",
+        "name" : "邵阳市",
+        "areaList" : [
+          {
+            "code" : "430502",
+            "name" : "双清区"
+          },
+          {
+            "code" : "430503",
+            "name" : "大祥区"
+          },
+          {
+            "code" : "430511",
+            "name" : "北塔区"
+          },
+          {
+            "code" : "430522",
+            "name" : "新邵县"
+          },
+          {
+            "code" : "430523",
+            "name" : "邵阳县"
+          },
+          {
+            "code" : "430524",
+            "name" : "隆回县"
+          },
+          {
+            "code" : "430525",
+            "name" : "洞口县"
+          },
+          {
+            "code" : "430527",
+            "name" : "绥宁县"
+          },
+          {
+            "code" : "430528",
+            "name" : "新宁县"
+          },
+          {
+            "code" : "430529",
+            "name" : "城步苗族自治县"
+          },
+          {
+            "code" : "430581",
+            "name" : "武冈市"
+          },
+          {
+            "code" : "430582",
+            "name" : "邵东市"
+          }
+        ]
+      },
+      {
+        "code" : "430600",
+        "name" : "岳阳市",
+        "areaList" : [
+          {
+            "code" : "430602",
+            "name" : "岳阳楼区"
+          },
+          {
+            "code" : "430603",
+            "name" : "云溪区"
+          },
+          {
+            "code" : "430611",
+            "name" : "君山区"
+          },
+          {
+            "code" : "430621",
+            "name" : "岳阳县"
+          },
+          {
+            "code" : "430623",
+            "name" : "华容县"
+          },
+          {
+            "code" : "430624",
+            "name" : "湘阴县"
+          },
+          {
+            "code" : "430626",
+            "name" : "平江县"
+          },
+          {
+            "code" : "430681",
+            "name" : "汨罗市"
+          },
+          {
+            "code" : "430682",
+            "name" : "临湘市"
+          }
+        ]
+      },
+      {
+        "code" : "430700",
+        "name" : "常德市",
+        "areaList" : [
+          {
+            "code" : "430702",
+            "name" : "武陵区"
+          },
+          {
+            "code" : "430703",
+            "name" : "鼎城区"
+          },
+          {
+            "code" : "430721",
+            "name" : "安乡县"
+          },
+          {
+            "code" : "430722",
+            "name" : "汉寿县"
+          },
+          {
+            "code" : "430723",
+            "name" : "澧县"
+          },
+          {
+            "code" : "430724",
+            "name" : "临澧县"
+          },
+          {
+            "code" : "430725",
+            "name" : "桃源县"
+          },
+          {
+            "code" : "430726",
+            "name" : "石门县"
+          },
+          {
+            "code" : "430781",
+            "name" : "津市市"
+          }
+        ]
+      },
+      {
+        "code" : "430800",
+        "name" : "张家界市",
+        "areaList" : [
+          {
+            "code" : "430802",
+            "name" : "永定区"
+          },
+          {
+            "code" : "430811",
+            "name" : "武陵源区"
+          },
+          {
+            "code" : "430821",
+            "name" : "慈利县"
+          },
+          {
+            "code" : "430822",
+            "name" : "桑植县"
+          }
+        ]
+      },
+      {
+        "code" : "430900",
+        "name" : "益阳市",
+        "areaList" : [
+          {
+            "code" : "430902",
+            "name" : "资阳区"
+          },
+          {
+            "code" : "430903",
+            "name" : "赫山区"
+          },
+          {
+            "code" : "430921",
+            "name" : "南县"
+          },
+          {
+            "code" : "430922",
+            "name" : "桃江县"
+          },
+          {
+            "code" : "430923",
+            "name" : "安化县"
+          },
+          {
+            "code" : "430981",
+            "name" : "沅江市"
+          }
+        ]
+      },
+      {
+        "code" : "431000",
+        "name" : "郴州市",
+        "areaList" : [
+          {
+            "code" : "431002",
+            "name" : "北湖区"
+          },
+          {
+            "code" : "431003",
+            "name" : "苏仙区"
+          },
+          {
+            "code" : "431021",
+            "name" : "桂阳县"
+          },
+          {
+            "code" : "431022",
+            "name" : "宜章县"
+          },
+          {
+            "code" : "431023",
+            "name" : "永兴县"
+          },
+          {
+            "code" : "431024",
+            "name" : "嘉禾县"
+          },
+          {
+            "code" : "431025",
+            "name" : "临武县"
+          },
+          {
+            "code" : "431026",
+            "name" : "汝城县"
+          },
+          {
+            "code" : "431027",
+            "name" : "桂东县"
+          },
+          {
+            "code" : "431028",
+            "name" : "安仁县"
+          },
+          {
+            "code" : "431081",
+            "name" : "资兴市"
+          }
+        ]
+      },
+      {
+        "code" : "431100",
+        "name" : "永州市",
+        "areaList" : [
+          {
+            "code" : "431102",
+            "name" : "零陵区"
+          },
+          {
+            "code" : "431103",
+            "name" : "冷水滩区"
+          },
+          {
+            "code" : "431122",
+            "name" : "东安县"
+          },
+          {
+            "code" : "431123",
+            "name" : "双牌县"
+          },
+          {
+            "code" : "431124",
+            "name" : "道县"
+          },
+          {
+            "code" : "431125",
+            "name" : "江永县"
+          },
+          {
+            "code" : "431126",
+            "name" : "宁远县"
+          },
+          {
+            "code" : "431127",
+            "name" : "蓝山县"
+          },
+          {
+            "code" : "431128",
+            "name" : "新田县"
+          },
+          {
+            "code" : "431129",
+            "name" : "江华瑶族自治县"
+          },
+          {
+            "code" : "431181",
+            "name" : "祁阳市"
+          }
+        ]
+      },
+      {
+        "code" : "431200",
+        "name" : "怀化市",
+        "areaList" : [
+          {
+            "code" : "431202",
+            "name" : "鹤城区"
+          },
+          {
+            "code" : "431221",
+            "name" : "中方县"
+          },
+          {
+            "code" : "431222",
+            "name" : "沅陵县"
+          },
+          {
+            "code" : "431223",
+            "name" : "辰溪县"
+          },
+          {
+            "code" : "431224",
+            "name" : "溆浦县"
+          },
+          {
+            "code" : "431225",
+            "name" : "会同县"
+          },
+          {
+            "code" : "431226",
+            "name" : "麻阳苗族自治县"
+          },
+          {
+            "code" : "431227",
+            "name" : "新晃侗族自治县"
+          },
+          {
+            "code" : "431228",
+            "name" : "芷江侗族自治县"
+          },
+          {
+            "code" : "431229",
+            "name" : "靖州苗族侗族自治县"
+          },
+          {
+            "code" : "431230",
+            "name" : "通道侗族自治县"
+          },
+          {
+            "code" : "431281",
+            "name" : "洪江市"
+          }
+        ]
+      },
+      {
+        "code" : "431300",
+        "name" : "娄底市",
+        "areaList" : [
+          {
+            "code" : "431302",
+            "name" : "娄星区"
+          },
+          {
+            "code" : "431321",
+            "name" : "双峰县"
+          },
+          {
+            "code" : "431322",
+            "name" : "新化县"
+          },
+          {
+            "code" : "431381",
+            "name" : "冷水江市"
+          },
+          {
+            "code" : "431382",
+            "name" : "涟源市"
+          }
+        ]
+      },
+      {
+        "code" : "433100",
+        "name" : "湘西土家族苗族自治州",
+        "areaList" : [
+          {
+            "code" : "433101",
+            "name" : "吉首市"
+          },
+          {
+            "code" : "433122",
+            "name" : "泸溪县"
+          },
+          {
+            "code" : "433123",
+            "name" : "凤凰县"
+          },
+          {
+            "code" : "433124",
+            "name" : "花垣县"
+          },
+          {
+            "code" : "433125",
+            "name" : "保靖县"
+          },
+          {
+            "code" : "433126",
+            "name" : "古丈县"
+          },
+          {
+            "code" : "433127",
+            "name" : "永顺县"
+          },
+          {
+            "code" : "433130",
+            "name" : "龙山县"
+          }
+        ]
+      }
+    ]
+  },
+  {
+    "code" : "440000",
+    "name" : "广东省",
+    "cityList" : [
+      {
+        "code" : "440100",
+        "name" : "广州市",
+        "areaList" : [
+          {
+            "code" : "440103",
+            "name" : "荔湾区"
+          },
+          {
+            "code" : "440104",
+            "name" : "越秀区"
+          },
+          {
+            "code" : "440105",
+            "name" : "海珠区"
+          },
+          {
+            "code" : "440106",
+            "name" : "天河区"
+          },
+          {
+            "code" : "440111",
+            "name" : "白云区"
+          },
+          {
+            "code" : "440112",
+            "name" : "黄埔区"
+          },
+          {
+            "code" : "440113",
+            "name" : "番禺区"
+          },
+          {
+            "code" : "440114",
+            "name" : "花都区"
+          },
+          {
+            "code" : "440115",
+            "name" : "南沙区"
+          },
+          {
+            "code" : "440117",
+            "name" : "从化区"
+          },
+          {
+            "code" : "440118",
+            "name" : "增城区"
+          }
+        ]
+      },
+      {
+        "code" : "440200",
+        "name" : "韶关市",
+        "areaList" : [
+          {
+            "code" : "440203",
+            "name" : "武江区"
+          },
+          {
+            "code" : "440204",
+            "name" : "浈江区"
+          },
+          {
+            "code" : "440205",
+            "name" : "曲江区"
+          },
+          {
+            "code" : "440222",
+            "name" : "始兴县"
+          },
+          {
+            "code" : "440224",
+            "name" : "仁化县"
+          },
+          {
+            "code" : "440229",
+            "name" : "翁源县"
+          },
+          {
+            "code" : "440232",
+            "name" : "乳源瑶族自治县"
+          },
+          {
+            "code" : "440233",
+            "name" : "新丰县"
+          },
+          {
+            "code" : "440281",
+            "name" : "乐昌市"
+          },
+          {
+            "code" : "440282",
+            "name" : "南雄市"
+          }
+        ]
+      },
+      {
+        "code" : "440300",
+        "name" : "深圳市",
+        "areaList" : [
+          {
+            "code" : "440303",
+            "name" : "罗湖区"
+          },
+          {
+            "code" : "440304",
+            "name" : "福田区"
+          },
+          {
+            "code" : "440305",
+            "name" : "南山区"
+          },
+          {
+            "code" : "440306",
+            "name" : "宝安区"
+          },
+          {
+            "code" : "440307",
+            "name" : "龙岗区"
+          },
+          {
+            "code" : "440308",
+            "name" : "盐田区"
+          },
+          {
+            "code" : "440309",
+            "name" : "龙华区"
+          },
+          {
+            "code" : "440310",
+            "name" : "坪山区"
+          },
+          {
+            "code" : "440311",
+            "name" : "光明区"
+          }
+        ]
+      },
+      {
+        "code" : "440400",
+        "name" : "珠海市",
+        "areaList" : [
+          {
+            "code" : "440402",
+            "name" : "香洲区"
+          },
+          {
+            "code" : "440403",
+            "name" : "斗门区"
+          },
+          {
+            "code" : "440404",
+            "name" : "金湾区"
+          },
+          {
+            "code" : "440499",
+            "name" : "澳门大学横琴校区(由澳门实施管辖)"
+          }
+        ]
+      },
+      {
+        "code" : "440500",
+        "name" : "汕头市",
+        "areaList" : [
+          {
+            "code" : "440507",
+            "name" : "龙湖区"
+          },
+          {
+            "code" : "440511",
+            "name" : "金平区"
+          },
+          {
+            "code" : "440512",
+            "name" : "濠江区"
+          },
+          {
+            "code" : "440513",
+            "name" : "潮阳区"
+          },
+          {
+            "code" : "440514",
+            "name" : "潮南区"
+          },
+          {
+            "code" : "440515",
+            "name" : "澄海区"
+          },
+          {
+            "code" : "440523",
+            "name" : "南澳县"
+          }
+        ]
+      },
+      {
+        "code" : "440600",
+        "name" : "佛山市",
+        "areaList" : [
+          {
+            "code" : "440604",
+            "name" : "禅城区"
+          },
+          {
+            "code" : "440605",
+            "name" : "南海区"
+          },
+          {
+            "code" : "440606",
+            "name" : "顺德区"
+          },
+          {
+            "code" : "440607",
+            "name" : "三水区"
+          },
+          {
+            "code" : "440608",
+            "name" : "高明区"
+          }
+        ]
+      },
+      {
+        "code" : "440700",
+        "name" : "江门市",
+        "areaList" : [
+          {
+            "code" : "440703",
+            "name" : "蓬江区"
+          },
+          {
+            "code" : "440704",
+            "name" : "江海区"
+          },
+          {
+            "code" : "440705",
+            "name" : "新会区"
+          },
+          {
+            "code" : "440781",
+            "name" : "台山市"
+          },
+          {
+            "code" : "440783",
+            "name" : "开平市"
+          },
+          {
+            "code" : "440784",
+            "name" : "鹤山市"
+          },
+          {
+            "code" : "440785",
+            "name" : "恩平市"
+          }
+        ]
+      },
+      {
+        "code" : "440800",
+        "name" : "湛江市",
+        "areaList" : [
+          {
+            "code" : "440802",
+            "name" : "赤坎区"
+          },
+          {
+            "code" : "440803",
+            "name" : "霞山区"
+          },
+          {
+            "code" : "440804",
+            "name" : "坡头区"
+          },
+          {
+            "code" : "440811",
+            "name" : "麻章区"
+          },
+          {
+            "code" : "440823",
+            "name" : "遂溪县"
+          },
+          {
+            "code" : "440825",
+            "name" : "徐闻县"
+          },
+          {
+            "code" : "440881",
+            "name" : "廉江市"
+          },
+          {
+            "code" : "440882",
+            "name" : "雷州市"
+          },
+          {
+            "code" : "440883",
+            "name" : "吴川市"
+          }
+        ]
+      },
+      {
+        "code" : "440900",
+        "name" : "茂名市",
+        "areaList" : [
+          {
+            "code" : "440902",
+            "name" : "茂南区"
+          },
+          {
+            "code" : "440904",
+            "name" : "电白区"
+          },
+          {
+            "code" : "440981",
+            "name" : "高州市"
+          },
+          {
+            "code" : "440982",
+            "name" : "化州市"
+          },
+          {
+            "code" : "440983",
+            "name" : "信宜市"
+          }
+        ]
+      },
+      {
+        "code" : "441200",
+        "name" : "肇庆市",
+        "areaList" : [
+          {
+            "code" : "441202",
+            "name" : "端州区"
+          },
+          {
+            "code" : "441203",
+            "name" : "鼎湖区"
+          },
+          {
+            "code" : "441204",
+            "name" : "高要区"
+          },
+          {
+            "code" : "441223",
+            "name" : "广宁县"
+          },
+          {
+            "code" : "441224",
+            "name" : "怀集县"
+          },
+          {
+            "code" : "441225",
+            "name" : "封开县"
+          },
+          {
+            "code" : "441226",
+            "name" : "德庆县"
+          },
+          {
+            "code" : "441284",
+            "name" : "四会市"
+          }
+        ]
+      },
+      {
+        "code" : "441300",
+        "name" : "惠州市",
+        "areaList" : [
+          {
+            "code" : "441302",
+            "name" : "惠城区"
+          },
+          {
+            "code" : "441303",
+            "name" : "惠阳区"
+          },
+          {
+            "code" : "441322",
+            "name" : "博罗县"
+          },
+          {
+            "code" : "441323",
+            "name" : "惠东县"
+          },
+          {
+            "code" : "441324",
+            "name" : "龙门县"
+          }
+        ]
+      },
+      {
+        "code" : "441400",
+        "name" : "梅州市",
+        "areaList" : [
+          {
+            "code" : "441402",
+            "name" : "梅江区"
+          },
+          {
+            "code" : "441403",
+            "name" : "梅县区"
+          },
+          {
+            "code" : "441422",
+            "name" : "大埔县"
+          },
+          {
+            "code" : "441423",
+            "name" : "丰顺县"
+          },
+          {
+            "code" : "441424",
+            "name" : "五华县"
+          },
+          {
+            "code" : "441426",
+            "name" : "平远县"
+          },
+          {
+            "code" : "441427",
+            "name" : "蕉岭县"
+          },
+          {
+            "code" : "441481",
+            "name" : "兴宁市"
+          }
+        ]
+      },
+      {
+        "code" : "441500",
+        "name" : "汕尾市",
+        "areaList" : [
+          {
+            "code" : "441502",
+            "name" : "城区"
+          },
+          {
+            "code" : "441521",
+            "name" : "海丰县"
+          },
+          {
+            "code" : "441523",
+            "name" : "陆河县"
+          },
+          {
+            "code" : "441581",
+            "name" : "陆丰市"
+          }
+        ]
+      },
+      {
+        "code" : "441600",
+        "name" : "河源市",
+        "areaList" : [
+          {
+            "code" : "441602",
+            "name" : "源城区"
+          },
+          {
+            "code" : "441621",
+            "name" : "紫金县"
+          },
+          {
+            "code" : "441622",
+            "name" : "龙川县"
+          },
+          {
+            "code" : "441623",
+            "name" : "连平县"
+          },
+          {
+            "code" : "441624",
+            "name" : "和平县"
+          },
+          {
+            "code" : "441625",
+            "name" : "东源县"
+          }
+        ]
+      },
+      {
+        "code" : "441700",
+        "name" : "阳江市",
+        "areaList" : [
+          {
+            "code" : "441702",
+            "name" : "江城区"
+          },
+          {
+            "code" : "441704",
+            "name" : "阳东区"
+          },
+          {
+            "code" : "441721",
+            "name" : "阳西县"
+          },
+          {
+            "code" : "441781",
+            "name" : "阳春市"
+          }
+        ]
+      },
+      {
+        "code" : "441800",
+        "name" : "清远市",
+        "areaList" : [
+          {
+            "code" : "441802",
+            "name" : "清城区"
+          },
+          {
+            "code" : "441803",
+            "name" : "清新区"
+          },
+          {
+            "code" : "441821",
+            "name" : "佛冈县"
+          },
+          {
+            "code" : "441823",
+            "name" : "阳山县"
+          },
+          {
+            "code" : "441825",
+            "name" : "连山壮族瑶族自治县"
+          },
+          {
+            "code" : "441826",
+            "name" : "连南瑶族自治县"
+          },
+          {
+            "code" : "441881",
+            "name" : "英德市"
+          },
+          {
+            "code" : "441882",
+            "name" : "连州市"
+          }
+        ]
+      },
+      {
+        "code" : "441900",
+        "name" : "东莞市",
+        "areaList" : [
+          {
+            "code" : "441900",
+            "name" : "黄江镇"
+          },
+          {
+            "code" : "441900",
+            "name" : "清溪镇"
+          },
+          {
+            "code" : "441900",
+            "name" : "桥头镇"
+          },
+          {
+            "code" : "441900",
+            "name" : "洪梅镇"
+          },
+          {
+            "code" : "441900",
+            "name" : "高埗镇"
+          },
+          {
+            "code" : "441900",
+            "name" : "麻涌镇"
+          },
+          {
+            "code" : "441900",
+            "name" : "塘厦镇"
+          },
+          {
+            "code" : "441900",
+            "name" : "道滘镇"
+          },
+          {
+            "code" : "441900",
+            "name" : "望牛墩镇"
+          },
+          {
+            "code" : "441900",
+            "name" : "万江街道"
+          },
+          {
+            "code" : "441900",
+            "name" : "企石镇"
+          },
+          {
+            "code" : "441900",
+            "name" : "莞城街道"
+          },
+          {
+            "code" : "441900",
+            "name" : "南城街道"
+          },
+          {
+            "code" : "441900",
+            "name" : "谢岗镇"
+          },
+          {
+            "code" : "441900",
+            "name" : "大岭山镇"
+          },
+          {
+            "code" : "441900",
+            "name" : "东坑镇"
+          },
+          {
+            "code" : "441900",
+            "name" : "樟木头镇"
+          },
+          {
+            "code" : "441900",
+            "name" : "东城街道"
+          },
+          {
+            "code" : "441900",
+            "name" : "常平镇"
+          },
+          {
+            "code" : "441900",
+            "name" : "凤岗镇"
+          },
+          {
+            "code" : "441900",
+            "name" : "茶山镇"
+          },
+          {
+            "code" : "441900",
+            "name" : "寮步镇"
+          },
+          {
+            "code" : "441900",
+            "name" : "石排镇"
+          },
+          {
+            "code" : "441900",
+            "name" : "横沥镇"
+          },
+          {
+            "code" : "441900",
+            "name" : "沙田镇"
+          },
+          {
+            "code" : "441900",
+            "name" : "大朗镇"
+          },
+          {
+            "code" : "441900",
+            "name" : "中堂镇"
+          },
+          {
+            "code" : "441900",
+            "name" : "厚街镇"
+          },
+          {
+            "code" : "441900",
+            "name" : "虎门镇"
+          },
+          {
+            "code" : "441900",
+            "name" : "长安镇"
+          },
+          {
+            "code" : "441900",
+            "name" : "石龙镇"
+          },
+          {
+            "code" : "441900",
+            "name" : "石碣镇"
+          }
+        ]
+      },
+      {
+        "code" : "442000",
+        "name" : "中山市",
+        "areaList" : [
+          {
+            "code" : "442000",
+            "name" : "横栏镇"
+          },
+          {
+            "code" : "442000",
+            "name" : "小榄镇"
+          },
+          {
+            "code" : "442000",
+            "name" : "神湾镇"
+          },
+          {
+            "code" : "442000",
+            "name" : "古镇镇"
+          },
+          {
+            "code" : "442000",
+            "name" : "港口镇"
+          },
+          {
+            "code" : "442000",
+            "name" : "三乡镇"
+          },
+          {
+            "code" : "442000",
+            "name" : "石岐街道"
+          },
+          {
+            "code" : "442000",
+            "name" : "大涌镇"
+          },
+          {
+            "code" : "442000",
+            "name" : "阜沙镇"
+          },
+          {
+            "code" : "442000",
+            "name" : "西区街道"
+          },
+          {
+            "code" : "442000",
+            "name" : "沙溪镇"
+          },
+          {
+            "code" : "442000",
+            "name" : "东凤镇"
+          },
+          {
+            "code" : "442000",
+            "name" : "坦洲镇"
+          },
+          {
+            "code" : "442000",
+            "name" : "三角镇"
+          },
+          {
+            "code" : "442000",
+            "name" : "南头镇"
+          },
+          {
+            "code" : "442000",
+            "name" : "民众街道"
+          },
+          {
+            "code" : "442000",
+            "name" : "板芙镇"
+          },
+          {
+            "code" : "442000",
+            "name" : "黄圃镇"
+          },
+          {
+            "code" : "442000",
+            "name" : "南区街道"
+          },
+          {
+            "code" : "442000",
+            "name" : "南朗街道"
+          },
+          {
+            "code" : "442000",
+            "name" : "东区街道"
+          },
+          {
+            "code" : "442000",
+            "name" : "中山港街道"
+          },
+          {
+            "code" : "442000",
+            "name" : "五桂山街道"
+          }
+        ]
+      },
+      {
+        "code" : "445100",
+        "name" : "潮州市",
+        "areaList" : [
+          {
+            "code" : "445102",
+            "name" : "湘桥区"
+          },
+          {
+            "code" : "445103",
+            "name" : "潮安区"
+          },
+          {
+            "code" : "445122",
+            "name" : "饶平县"
+          }
+        ]
+      },
+      {
+        "code" : "445200",
+        "name" : "揭阳市",
+        "areaList" : [
+          {
+            "code" : "445202",
+            "name" : "榕城区"
+          },
+          {
+            "code" : "445203",
+            "name" : "揭东区"
+          },
+          {
+            "code" : "445222",
+            "name" : "揭西县"
+          },
+          {
+            "code" : "445224",
+            "name" : "惠来县"
+          },
+          {
+            "code" : "445281",
+            "name" : "普宁市"
+          }
+        ]
+      },
+      {
+        "code" : "445300",
+        "name" : "云浮市",
+        "areaList" : [
+          {
+            "code" : "445302",
+            "name" : "云城区"
+          },
+          {
+            "code" : "445303",
+            "name" : "云安区"
+          },
+          {
+            "code" : "445321",
+            "name" : "新兴县"
+          },
+          {
+            "code" : "445322",
+            "name" : "郁南县"
+          },
+          {
+            "code" : "445381",
+            "name" : "罗定市"
+          }
+        ]
+      }
+    ]
+  },
+  {
+    "code" : "450000",
+    "name" : "广西壮族自治区",
+    "cityList" : [
+      {
+        "code" : "450100",
+        "name" : "南宁市",
+        "areaList" : [
+          {
+            "code" : "450102",
+            "name" : "兴宁区"
+          },
+          {
+            "code" : "450103",
+            "name" : "青秀区"
+          },
+          {
+            "code" : "450105",
+            "name" : "江南区"
+          },
+          {
+            "code" : "450107",
+            "name" : "西乡塘区"
+          },
+          {
+            "code" : "450108",
+            "name" : "良庆区"
+          },
+          {
+            "code" : "450109",
+            "name" : "邕宁区"
+          },
+          {
+            "code" : "450110",
+            "name" : "武鸣区"
+          },
+          {
+            "code" : "450123",
+            "name" : "隆安县"
+          },
+          {
+            "code" : "450124",
+            "name" : "马山县"
+          },
+          {
+            "code" : "450125",
+            "name" : "上林县"
+          },
+          {
+            "code" : "450126",
+            "name" : "宾阳县"
+          },
+          {
+            "code" : "450181",
+            "name" : "横州市"
+          }
+        ]
+      },
+      {
+        "code" : "450200",
+        "name" : "柳州市",
+        "areaList" : [
+          {
+            "code" : "450202",
+            "name" : "城中区"
+          },
+          {
+            "code" : "450203",
+            "name" : "鱼峰区"
+          },
+          {
+            "code" : "450204",
+            "name" : "柳南区"
+          },
+          {
+            "code" : "450205",
+            "name" : "柳北区"
+          },
+          {
+            "code" : "450206",
+            "name" : "柳江区"
+          },
+          {
+            "code" : "450222",
+            "name" : "柳城县"
+          },
+          {
+            "code" : "450223",
+            "name" : "鹿寨县"
+          },
+          {
+            "code" : "450224",
+            "name" : "融安县"
+          },
+          {
+            "code" : "450225",
+            "name" : "融水苗族自治县"
+          },
+          {
+            "code" : "450226",
+            "name" : "三江侗族自治县"
+          }
+        ]
+      },
+      {
+        "code" : "450300",
+        "name" : "桂林市",
+        "areaList" : [
+          {
+            "code" : "450302",
+            "name" : "秀峰区"
+          },
+          {
+            "code" : "450303",
+            "name" : "叠彩区"
+          },
+          {
+            "code" : "450304",
+            "name" : "象山区"
+          },
+          {
+            "code" : "450305",
+            "name" : "七星区"
+          },
+          {
+            "code" : "450311",
+            "name" : "雁山区"
+          },
+          {
+            "code" : "450312",
+            "name" : "临桂区"
+          },
+          {
+            "code" : "450321",
+            "name" : "阳朔县"
+          },
+          {
+            "code" : "450323",
+            "name" : "灵川县"
+          },
+          {
+            "code" : "450324",
+            "name" : "全州县"
+          },
+          {
+            "code" : "450325",
+            "name" : "兴安县"
+          },
+          {
+            "code" : "450326",
+            "name" : "永福县"
+          },
+          {
+            "code" : "450327",
+            "name" : "灌阳县"
+          },
+          {
+            "code" : "450328",
+            "name" : "龙胜各族自治县"
+          },
+          {
+            "code" : "450329",
+            "name" : "资源县"
+          },
+          {
+            "code" : "450330",
+            "name" : "平乐县"
+          },
+          {
+            "code" : "450332",
+            "name" : "恭城瑶族自治县"
+          },
+          {
+            "code" : "450381",
+            "name" : "荔浦市"
+          }
+        ]
+      },
+      {
+        "code" : "450400",
+        "name" : "梧州市",
+        "areaList" : [
+          {
+            "code" : "450403",
+            "name" : "万秀区"
+          },
+          {
+            "code" : "450405",
+            "name" : "长洲区"
+          },
+          {
+            "code" : "450406",
+            "name" : "龙圩区"
+          },
+          {
+            "code" : "450421",
+            "name" : "苍梧县"
+          },
+          {
+            "code" : "450422",
+            "name" : "藤县"
+          },
+          {
+            "code" : "450423",
+            "name" : "蒙山县"
+          },
+          {
+            "code" : "450481",
+            "name" : "岑溪市"
+          }
+        ]
+      },
+      {
+        "code" : "450500",
+        "name" : "北海市",
+        "areaList" : [
+          {
+            "code" : "450502",
+            "name" : "海城区"
+          },
+          {
+            "code" : "450503",
+            "name" : "银海区"
+          },
+          {
+            "code" : "450512",
+            "name" : "铁山港区"
+          },
+          {
+            "code" : "450521",
+            "name" : "合浦县"
+          }
+        ]
+      },
+      {
+        "code" : "450600",
+        "name" : "防城港市",
+        "areaList" : [
+          {
+            "code" : "450602",
+            "name" : "港口区"
+          },
+          {
+            "code" : "450603",
+            "name" : "防城区"
+          },
+          {
+            "code" : "450621",
+            "name" : "上思县"
+          },
+          {
+            "code" : "450681",
+            "name" : "东兴市"
+          }
+        ]
+      },
+      {
+        "code" : "450700",
+        "name" : "钦州市",
+        "areaList" : [
+          {
+            "code" : "450702",
+            "name" : "钦南区"
+          },
+          {
+            "code" : "450703",
+            "name" : "钦北区"
+          },
+          {
+            "code" : "450721",
+            "name" : "灵山县"
+          },
+          {
+            "code" : "450722",
+            "name" : "浦北县"
+          }
+        ]
+      },
+      {
+        "code" : "450800",
+        "name" : "贵港市",
+        "areaList" : [
+          {
+            "code" : "450802",
+            "name" : "港北区"
+          },
+          {
+            "code" : "450803",
+            "name" : "港南区"
+          },
+          {
+            "code" : "450804",
+            "name" : "覃塘区"
+          },
+          {
+            "code" : "450821",
+            "name" : "平南县"
+          },
+          {
+            "code" : "450881",
+            "name" : "桂平市"
+          }
+        ]
+      },
+      {
+        "code" : "450900",
+        "name" : "玉林市",
+        "areaList" : [
+          {
+            "code" : "450902",
+            "name" : "玉州区"
+          },
+          {
+            "code" : "450903",
+            "name" : "福绵区"
+          },
+          {
+            "code" : "450921",
+            "name" : "容县"
+          },
+          {
+            "code" : "450922",
+            "name" : "陆川县"
+          },
+          {
+            "code" : "450923",
+            "name" : "博白县"
+          },
+          {
+            "code" : "450924",
+            "name" : "兴业县"
+          },
+          {
+            "code" : "450981",
+            "name" : "北流市"
+          }
+        ]
+      },
+      {
+        "code" : "451000",
+        "name" : "百色市",
+        "areaList" : [
+          {
+            "code" : "451002",
+            "name" : "右江区"
+          },
+          {
+            "code" : "451003",
+            "name" : "田阳区"
+          },
+          {
+            "code" : "451022",
+            "name" : "田东县"
+          },
+          {
+            "code" : "451024",
+            "name" : "德保县"
+          },
+          {
+            "code" : "451026",
+            "name" : "那坡县"
+          },
+          {
+            "code" : "451027",
+            "name" : "凌云县"
+          },
+          {
+            "code" : "451028",
+            "name" : "乐业县"
+          },
+          {
+            "code" : "451029",
+            "name" : "田林县"
+          },
+          {
+            "code" : "451030",
+            "name" : "西林县"
+          },
+          {
+            "code" : "451031",
+            "name" : "隆林各族自治县"
+          },
+          {
+            "code" : "451081",
+            "name" : "靖西市"
+          },
+          {
+            "code" : "451082",
+            "name" : "平果市"
+          }
+        ]
+      },
+      {
+        "code" : "451100",
+        "name" : "贺州市",
+        "areaList" : [
+          {
+            "code" : "451102",
+            "name" : "八步区"
+          },
+          {
+            "code" : "451103",
+            "name" : "平桂区"
+          },
+          {
+            "code" : "451121",
+            "name" : "昭平县"
+          },
+          {
+            "code" : "451122",
+            "name" : "钟山县"
+          },
+          {
+            "code" : "451123",
+            "name" : "富川瑶族自治县"
+          }
+        ]
+      },
+      {
+        "code" : "451200",
+        "name" : "河池市",
+        "areaList" : [
+          {
+            "code" : "451202",
+            "name" : "金城江区"
+          },
+          {
+            "code" : "451203",
+            "name" : "宜州区"
+          },
+          {
+            "code" : "451221",
+            "name" : "南丹县"
+          },
+          {
+            "code" : "451222",
+            "name" : "天峨县"
+          },
+          {
+            "code" : "451223",
+            "name" : "凤山县"
+          },
+          {
+            "code" : "451224",
+            "name" : "东兰县"
+          },
+          {
+            "code" : "451225",
+            "name" : "罗城仫佬族自治县"
+          },
+          {
+            "code" : "451226",
+            "name" : "环江毛南族自治县"
+          },
+          {
+            "code" : "451227",
+            "name" : "巴马瑶族自治县"
+          },
+          {
+            "code" : "451228",
+            "name" : "都安瑶族自治县"
+          },
+          {
+            "code" : "451229",
+            "name" : "大化瑶族自治县"
+          }
+        ]
+      },
+      {
+        "code" : "451300",
+        "name" : "来宾市",
+        "areaList" : [
+          {
+            "code" : "451302",
+            "name" : "兴宾区"
+          },
+          {
+            "code" : "451321",
+            "name" : "忻城县"
+          },
+          {
+            "code" : "451322",
+            "name" : "象州县"
+          },
+          {
+            "code" : "451323",
+            "name" : "武宣县"
+          },
+          {
+            "code" : "451324",
+            "name" : "金秀瑶族自治县"
+          },
+          {
+            "code" : "451381",
+            "name" : "合山市"
+          }
+        ]
+      },
+      {
+        "code" : "451400",
+        "name" : "崇左市",
+        "areaList" : [
+          {
+            "code" : "451402",
+            "name" : "江州区"
+          },
+          {
+            "code" : "451421",
+            "name" : "扶绥县"
+          },
+          {
+            "code" : "451422",
+            "name" : "宁明县"
+          },
+          {
+            "code" : "451423",
+            "name" : "龙州县"
+          },
+          {
+            "code" : "451424",
+            "name" : "大新县"
+          },
+          {
+            "code" : "451425",
+            "name" : "天等县"
+          },
+          {
+            "code" : "451481",
+            "name" : "凭祥市"
+          }
+        ]
+      }
+    ]
+  },
+  {
+    "code" : "460000",
+    "name" : "海南省",
+    "cityList" : [
+      {
+        "code" : "460100",
+        "name" : "海口市",
+        "areaList" : [
+          {
+            "code" : "460105",
+            "name" : "秀英区"
+          },
+          {
+            "code" : "460106",
+            "name" : "龙华区"
+          },
+          {
+            "code" : "460107",
+            "name" : "琼山区"
+          },
+          {
+            "code" : "460108",
+            "name" : "美兰区"
+          }
+        ]
+      },
+      {
+        "code" : "460200",
+        "name" : "三亚市",
+        "areaList" : [
+          {
+            "code" : "460202",
+            "name" : "海棠区"
+          },
+          {
+            "code" : "460203",
+            "name" : "吉阳区"
+          },
+          {
+            "code" : "460204",
+            "name" : "天涯区"
+          },
+          {
+            "code" : "460205",
+            "name" : "崖州区"
+          }
+        ]
+      },
+      {
+        "code" : "460300",
+        "name" : "三沙市",
+        "areaList" : [
+          {
+            "code" : "460301",
+            "name" : "西沙区"
+          },
+          {
+            "code" : "460302",
+            "name" : "南沙区"
+          }
+        ]
+      },
+      {
+        "code" : "460400",
+        "name" : "儋州市",
+        "areaList" : [
+          {
+            "code" : "460400",
+            "name" : "光村镇"
+          },
+          {
+            "code" : "460400",
+            "name" : "海头镇"
+          },
+          {
+            "code" : "460400",
+            "name" : "新州镇"
+          },
+          {
+            "code" : "460400",
+            "name" : "中和镇"
+          },
+          {
+            "code" : "460400",
+            "name" : "三都镇"
+          },
+          {
+            "code" : "460400",
+            "name" : "峨蔓镇"
+          },
+          {
+            "code" : "460400",
+            "name" : "王五镇"
+          },
+          {
+            "code" : "460400",
+            "name" : "白马井镇"
+          },
+          {
+            "code" : "460400",
+            "name" : "排浦镇"
+          },
+          {
+            "code" : "460400",
+            "name" : "雅星镇"
+          },
+          {
+            "code" : "460400",
+            "name" : "木棠镇"
+          },
+          {
+            "code" : "460400",
+            "name" : "大成镇"
+          },
+          {
+            "code" : "460400",
+            "name" : "东成镇"
+          },
+          {
+            "code" : "460400",
+            "name" : "兰洋镇"
+          },
+          {
+            "code" : "460400",
+            "name" : "南丰镇"
+          },
+          {
+            "code" : "460400",
+            "name" : "和庆镇"
+          },
+          {
+            "code" : "460400",
+            "name" : "那大镇"
+          }
+        ]
+      },
+      {
+        "code" : "469001",
+        "name" : "五指山市",
+        "areaList" : [
+          {
+            "code" : "469001",
+            "name" : "毛阳镇"
+          },
+          {
+            "code" : "469001",
+            "name" : "水满乡"
+          },
+          {
+            "code" : "469001",
+            "name" : "毛道乡"
+          },
+          {
+            "code" : "469001",
+            "name" : "番阳镇"
+          },
+          {
+            "code" : "469001",
+            "name" : "畅好乡"
+          },
+          {
+            "code" : "469001",
+            "name" : "南圣镇"
+          },
+          {
+            "code" : "469001",
+            "name" : "通什镇"
+          }
+        ]
+      },
+      {
+        "code" : "469002",
+        "name" : "琼海市",
+        "areaList" : [
+          {
+            "code" : "469002",
+            "name" : "长坡镇"
+          },
+          {
+            "code" : "469002",
+            "name" : "龙江镇"
+          },
+          {
+            "code" : "469002",
+            "name" : "石壁镇"
+          },
+          {
+            "code" : "469002",
+            "name" : "阳江镇"
+          },
+          {
+            "code" : "469002",
+            "name" : "会山镇"
+          },
+          {
+            "code" : "469002",
+            "name" : "潭门镇"
+          },
+          {
+            "code" : "469002",
+            "name" : "塔洋镇"
+          },
+          {
+            "code" : "469002",
+            "name" : "大路镇"
+          },
+          {
+            "code" : "469002",
+            "name" : "嘉积镇"
+          },
+          {
+            "code" : "469002",
+            "name" : "万泉镇"
+          },
+          {
+            "code" : "469002",
+            "name" : "博鳌镇"
+          },
+          {
+            "code" : "469002",
+            "name" : "中原镇"
+          }
+        ]
+      },
+      {
+        "code" : "469005",
+        "name" : "文昌市",
+        "areaList" : [
+          {
+            "code" : "469005",
+            "name" : "文教镇"
+          },
+          {
+            "code" : "469005",
+            "name" : "铺前镇"
+          },
+          {
+            "code" : "469005",
+            "name" : "龙楼镇"
+          },
+          {
+            "code" : "469005",
+            "name" : "东郊镇"
+          },
+          {
+            "code" : "469005",
+            "name" : "昌洒镇"
+          },
+          {
+            "code" : "469005",
+            "name" : "锦山镇"
+          },
+          {
+            "code" : "469005",
+            "name" : "公坡镇"
+          },
+          {
+            "code" : "469005",
+            "name" : "抱罗镇"
+          },
+          {
+            "code" : "469005",
+            "name" : "东阁镇"
+          },
+          {
+            "code" : "469005",
+            "name" : "蓬莱镇"
+          },
+          {
+            "code" : "469005",
+            "name" : "重兴镇"
+          },
+          {
+            "code" : "469005",
+            "name" : "冯坡镇"
+          },
+          {
+            "code" : "469005",
+            "name" : "翁田镇"
+          },
+          {
+            "code" : "469005",
+            "name" : "潭牛镇"
+          },
+          {
+            "code" : "469005",
+            "name" : "东路镇"
+          },
+          {
+            "code" : "469005",
+            "name" : "文城镇"
+          },
+          {
+            "code" : "469005",
+            "name" : "会文镇"
+          }
+        ]
+      },
+      {
+        "code" : "469006",
+        "name" : "万宁市",
+        "areaList" : [
+          {
+            "code" : "469006",
+            "name" : "后安镇"
+          },
+          {
+            "code" : "469006",
+            "name" : "和乐镇"
+          },
+          {
+            "code" : "469006",
+            "name" : "东澳镇"
+          },
+          {
+            "code" : "469006",
+            "name" : "山根镇"
+          },
+          {
+            "code" : "469006",
+            "name" : "龙滚镇"
+          },
+          {
+            "code" : "469006",
+            "name" : "北大镇"
+          },
+          {
+            "code" : "469006",
+            "name" : "三更罗镇"
+          },
+          {
+            "code" : "469006",
+            "name" : "礼纪镇"
+          },
+          {
+            "code" : "469006",
+            "name" : "大茂镇"
+          },
+          {
+            "code" : "469006",
+            "name" : "万城镇"
+          },
+          {
+            "code" : "469006",
+            "name" : "长丰镇"
+          },
+          {
+            "code" : "469006",
+            "name" : "南桥镇"
+          }
+        ]
+      },
+      {
+        "code" : "469007",
+        "name" : "东方市",
+        "areaList" : [
+          {
+            "code" : "469007",
+            "name" : "八所镇"
+          },
+          {
+            "code" : "469007",
+            "name" : "新龙镇"
+          },
+          {
+            "code" : "469007",
+            "name" : "东河镇"
+          },
+          {
+            "code" : "469007",
+            "name" : "板桥镇"
+          },
+          {
+            "code" : "469007",
+            "name" : "天安乡"
+          },
+          {
+            "code" : "469007",
+            "name" : "三家镇"
+          },
+          {
+            "code" : "469007",
+            "name" : "四更镇"
+          },
+          {
+            "code" : "469007",
+            "name" : "江边乡"
+          },
+          {
+            "code" : "469007",
+            "name" : "大田镇"
+          },
+          {
+            "code" : "469007",
+            "name" : "感城镇"
+          }
+        ]
+      },
+      {
+        "code" : "469021",
+        "name" : "定安县",
+        "areaList" : [
+          {
+            "code" : "469021",
+            "name" : "岭口镇"
+          },
+          {
+            "code" : "469021",
+            "name" : "龙门镇"
+          },
+          {
+            "code" : "469021",
+            "name" : "定城镇"
+          },
+          {
+            "code" : "469021",
+            "name" : "雷鸣镇"
+          },
+          {
+            "code" : "469021",
+            "name" : "龙河镇"
+          },
+          {
+            "code" : "469021",
+            "name" : "龙湖镇"
+          },
+          {
+            "code" : "469021",
+            "name" : "新竹镇"
+          },
+          {
+            "code" : "469021",
+            "name" : "富文镇"
+          },
+          {
+            "code" : "469021",
+            "name" : "黄竹镇"
+          },
+          {
+            "code" : "469021",
+            "name" : "翰林镇"
+          }
+        ]
+      },
+      {
+        "code" : "469022",
+        "name" : "屯昌县",
+        "areaList" : [
+          {
+            "code" : "469022",
+            "name" : "南吕镇"
+          },
+          {
+            "code" : "469022",
+            "name" : "枫木镇"
+          },
+          {
+            "code" : "469022",
+            "name" : "西昌镇"
+          },
+          {
+            "code" : "469022",
+            "name" : "屯城镇"
+          },
+          {
+            "code" : "469022",
+            "name" : "南坤镇"
+          },
+          {
+            "code" : "469022",
+            "name" : "乌坡镇"
+          },
+          {
+            "code" : "469022",
+            "name" : "坡心镇"
+          },
+          {
+            "code" : "469022",
+            "name" : "新兴镇"
+          }
+        ]
+      },
+      {
+        "code" : "469023",
+        "name" : "澄迈县",
+        "areaList" : [
+          {
+            "code" : "469023",
+            "name" : "老城镇"
+          },
+          {
+            "code" : "469023",
+            "name" : "大丰镇"
+          },
+          {
+            "code" : "469023",
+            "name" : "瑞溪镇"
+          },
+          {
+            "code" : "469023",
+            "name" : "加乐镇"
+          },
+          {
+            "code" : "469023",
+            "name" : "中兴镇"
+          },
+          {
+            "code" : "469023",
+            "name" : "仁兴镇"
+          },
+          {
+            "code" : "469023",
+            "name" : "桥头镇"
+          },
+          {
+            "code" : "469023",
+            "name" : "金江镇"
+          },
+          {
+            "code" : "469023",
+            "name" : "文儒镇"
+          },
+          {
+            "code" : "469023",
+            "name" : "福山镇"
+          },
+          {
+            "code" : "469023",
+            "name" : "永发镇"
+          }
+        ]
+      },
+      {
+        "code" : "469024",
+        "name" : "临高县",
+        "areaList" : [
+          {
+            "code" : "469024",
+            "name" : "博厚镇"
+          },
+          {
+            "code" : "469024",
+            "name" : "南宝镇"
+          },
+          {
+            "code" : "469024",
+            "name" : "和舍镇"
+          },
+          {
+            "code" : "469024",
+            "name" : "调楼镇"
+          },
+          {
+            "code" : "469024",
+            "name" : "东英镇"
+          },
+          {
+            "code" : "469024",
+            "name" : "加来镇"
+          },
+          {
+            "code" : "469024",
+            "name" : "临城镇"
+          },
+          {
+            "code" : "469024",
+            "name" : "多文镇"
+          },
+          {
+            "code" : "469024",
+            "name" : "波莲镇"
+          },
+          {
+            "code" : "469024",
+            "name" : "皇桐镇"
+          },
+          {
+            "code" : "469024",
+            "name" : "新盈镇"
+          }
+        ]
+      },
+      {
+        "code" : "469025",
+        "name" : "白沙黎族自治县",
+        "areaList" : [
+          {
+            "code" : "469025",
+            "name" : "南开乡"
+          },
+          {
+            "code" : "469025",
+            "name" : "阜龙乡"
+          },
+          {
+            "code" : "469025",
+            "name" : "细水乡"
+          },
+          {
+            "code" : "469025",
+            "name" : "七坊镇"
+          },
+          {
+            "code" : "469025",
+            "name" : "打安镇"
+          },
+          {
+            "code" : "469025",
+            "name" : "金波乡"
+          },
+          {
+            "code" : "469025",
+            "name" : "牙叉镇"
+          },
+          {
+            "code" : "469025",
+            "name" : "青松乡"
+          },
+          {
+            "code" : "469025",
+            "name" : "元门乡"
+          },
+          {
+            "code" : "469025",
+            "name" : "荣邦乡"
+          },
+          {
+            "code" : "469025",
+            "name" : "邦溪镇"
+          }
+        ]
+      },
+      {
+        "code" : "469026",
+        "name" : "昌江黎族自治县",
+        "areaList" : [
+          {
+            "code" : "469026",
+            "name" : "乌烈镇"
+          },
+          {
+            "code" : "469026",
+            "name" : "叉河镇"
+          },
+          {
+            "code" : "469026",
+            "name" : "石碌镇"
+          },
+          {
+            "code" : "469026",
+            "name" : "昌化镇"
+          },
+          {
+            "code" : "469026",
+            "name" : "王下乡"
+          },
+          {
+            "code" : "469026",
+            "name" : "十月田镇"
+          },
+          {
+            "code" : "469026",
+            "name" : "七叉镇"
+          },
+          {
+            "code" : "469026",
+            "name" : "海尾镇"
+          }
+        ]
+      },
+      {
+        "code" : "469027",
+        "name" : "乐东黎族自治县",
+        "areaList" : [
+          {
+            "code" : "469027",
+            "name" : "莺歌海镇"
+          },
+          {
+            "code" : "469027",
+            "name" : "佛罗镇"
+          },
+          {
+            "code" : "469027",
+            "name" : "黄流镇"
+          },
+          {
+            "code" : "469027",
+            "name" : "尖峰镇"
+          },
+          {
+            "code" : "469027",
+            "name" : "志仲镇"
+          },
+          {
+            "code" : "469027",
+            "name" : "大安镇"
+          },
+          {
+            "code" : "469027",
+            "name" : "万冲镇"
+          },
+          {
+            "code" : "469027",
+            "name" : "抱由镇"
+          },
+          {
+            "code" : "469027",
+            "name" : "千家镇"
+          },
+          {
+            "code" : "469027",
+            "name" : "九所镇"
+          },
+          {
+            "code" : "469027",
+            "name" : "利国镇"
+          }
+        ]
+      },
+      {
+        "code" : "469028",
+        "name" : "陵水黎族自治县",
+        "areaList" : [
+          {
+            "code" : "469028",
+            "name" : "椰林镇"
+          },
+          {
+            "code" : "469028",
+            "name" : "文罗镇"
+          },
+          {
+            "code" : "469028",
+            "name" : "新村镇"
+          },
+          {
+            "code" : "469028",
+            "name" : "黎安镇"
+          },
+          {
+            "code" : "469028",
+            "name" : "提蒙乡"
+          },
+          {
+            "code" : "469028",
+            "name" : "群英乡"
+          },
+          {
+            "code" : "469028",
+            "name" : "三才镇"
+          },
+          {
+            "code" : "469028",
+            "name" : "隆广镇"
+          },
+          {
+            "code" : "469028",
+            "name" : "英州镇"
+          },
+          {
+            "code" : "469028",
+            "name" : "光坡镇"
+          },
+          {
+            "code" : "469028",
+            "name" : "本号镇"
+          }
+        ]
+      },
+      {
+        "code" : "469029",
+        "name" : "保亭黎族苗族自治县",
+        "areaList" : [
+          {
+            "code" : "469029",
+            "name" : "南林乡"
+          },
+          {
+            "code" : "469029",
+            "name" : "毛感乡"
+          },
+          {
+            "code" : "469029",
+            "name" : "三道镇"
+          },
+          {
+            "code" : "469029",
+            "name" : "什玲镇"
+          },
+          {
+            "code" : "469029",
+            "name" : "六弓乡"
+          },
+          {
+            "code" : "469029",
+            "name" : "响水镇"
+          },
+          {
+            "code" : "469029",
+            "name" : "新政镇"
+          },
+          {
+            "code" : "469029",
+            "name" : "加茂镇"
+          },
+          {
+            "code" : "469029",
+            "name" : "保城镇"
+          }
+        ]
+      },
+      {
+        "code" : "469030",
+        "name" : "琼中黎族苗族自治县",
+        "areaList" : [
+          {
+            "code" : "469030",
+            "name" : "什运乡"
+          },
+          {
+            "code" : "469030",
+            "name" : "黎母山镇"
+          },
+          {
+            "code" : "469030",
+            "name" : "上安乡"
+          },
+          {
+            "code" : "469030",
+            "name" : "吊罗山乡"
+          },
+          {
+            "code" : "469030",
+            "name" : "营根镇"
+          },
+          {
+            "code" : "469030",
+            "name" : "红毛镇"
+          },
+          {
+            "code" : "469030",
+            "name" : "和平镇"
+          },
+          {
+            "code" : "469030",
+            "name" : "中平镇"
+          },
+          {
+            "code" : "469030",
+            "name" : "长征镇"
+          },
+          {
+            "code" : "469030",
+            "name" : "湾岭镇"
+          }
+        ]
+      }
+    ]
+  },
+  {
+    "code" : "500000",
+    "name" : "重庆市",
+    "cityList" : [
+      {
+        "code" : "500100",
+        "name" : "重庆城区",
+        "areaList" : [
+          {
+            "code" : "500101",
+            "name" : "万州区"
+          },
+          {
+            "code" : "500102",
+            "name" : "涪陵区"
+          },
+          {
+            "code" : "500103",
+            "name" : "渝中区"
+          },
+          {
+            "code" : "500104",
+            "name" : "大渡口区"
+          },
+          {
+            "code" : "500105",
+            "name" : "江北区"
+          },
+          {
+            "code" : "500106",
+            "name" : "沙坪坝区"
+          },
+          {
+            "code" : "500107",
+            "name" : "九龙坡区"
+          },
+          {
+            "code" : "500108",
+            "name" : "南岸区"
+          },
+          {
+            "code" : "500109",
+            "name" : "北碚区"
+          },
+          {
+            "code" : "500110",
+            "name" : "綦江区"
+          },
+          {
+            "code" : "500111",
+            "name" : "大足区"
+          },
+          {
+            "code" : "500112",
+            "name" : "渝北区"
+          },
+          {
+            "code" : "500113",
+            "name" : "巴南区"
+          },
+          {
+            "code" : "500114",
+            "name" : "黔江区"
+          },
+          {
+            "code" : "500115",
+            "name" : "长寿区"
+          },
+          {
+            "code" : "500116",
+            "name" : "江津区"
+          },
+          {
+            "code" : "500117",
+            "name" : "合川区"
+          },
+          {
+            "code" : "500118",
+            "name" : "永川区"
+          },
+          {
+            "code" : "500119",
+            "name" : "南川区"
+          },
+          {
+            "code" : "500120",
+            "name" : "璧山区"
+          },
+          {
+            "code" : "500151",
+            "name" : "铜梁区"
+          },
+          {
+            "code" : "500152",
+            "name" : "潼南区"
+          },
+          {
+            "code" : "500153",
+            "name" : "荣昌区"
+          },
+          {
+            "code" : "500154",
+            "name" : "开州区"
+          },
+          {
+            "code" : "500155",
+            "name" : "梁平区"
+          },
+          {
+            "code" : "500156",
+            "name" : "武隆区"
+          }
+        ]
+      },
+      {
+        "code" : "500200",
+        "name" : "重庆郊县",
+        "areaList" : [
+          {
+            "code" : "500229",
+            "name" : "城口县"
+          },
+          {
+            "code" : "500230",
+            "name" : "丰都县"
+          },
+          {
+            "code" : "500231",
+            "name" : "垫江县"
+          },
+          {
+            "code" : "500233",
+            "name" : "忠县"
+          },
+          {
+            "code" : "500235",
+            "name" : "云阳县"
+          },
+          {
+            "code" : "500236",
+            "name" : "奉节县"
+          },
+          {
+            "code" : "500237",
+            "name" : "巫山县"
+          },
+          {
+            "code" : "500238",
+            "name" : "巫溪县"
+          },
+          {
+            "code" : "500240",
+            "name" : "石柱土家族自治县"
+          },
+          {
+            "code" : "500241",
+            "name" : "秀山土家族苗族自治县"
+          },
+          {
+            "code" : "500242",
+            "name" : "酉阳土家族苗族自治县"
+          },
+          {
+            "code" : "500243",
+            "name" : "彭水苗族土家族自治县"
+          }
+        ]
+      }
+    ]
+  },
+  {
+    "code" : "510000",
+    "name" : "四川省",
+    "cityList" : [
+      {
+        "code" : "510100",
+        "name" : "成都市",
+        "areaList" : [
+          {
+            "code" : "510104",
+            "name" : "锦江区"
+          },
+          {
+            "code" : "510105",
+            "name" : "青羊区"
+          },
+          {
+            "code" : "510106",
+            "name" : "金牛区"
+          },
+          {
+            "code" : "510107",
+            "name" : "武侯区"
+          },
+          {
+            "code" : "510108",
+            "name" : "成华区"
+          },
+          {
+            "code" : "510112",
+            "name" : "龙泉驿区"
+          },
+          {
+            "code" : "510113",
+            "name" : "青白江区"
+          },
+          {
+            "code" : "510114",
+            "name" : "新都区"
+          },
+          {
+            "code" : "510115",
+            "name" : "温江区"
+          },
+          {
+            "code" : "510116",
+            "name" : "双流区"
+          },
+          {
+            "code" : "510117",
+            "name" : "郫都区"
+          },
+          {
+            "code" : "510118",
+            "name" : "新津区"
+          },
+          {
+            "code" : "510121",
+            "name" : "金堂县"
+          },
+          {
+            "code" : "510129",
+            "name" : "大邑县"
+          },
+          {
+            "code" : "510131",
+            "name" : "蒲江县"
+          },
+          {
+            "code" : "510181",
+            "name" : "都江堰市"
+          },
+          {
+            "code" : "510182",
+            "name" : "彭州市"
+          },
+          {
+            "code" : "510183",
+            "name" : "邛崃市"
+          },
+          {
+            "code" : "510184",
+            "name" : "崇州市"
+          },
+          {
+            "code" : "510185",
+            "name" : "简阳市"
+          }
+        ]
+      },
+      {
+        "code" : "510300",
+        "name" : "自贡市",
+        "areaList" : [
+          {
+            "code" : "510302",
+            "name" : "自流井区"
+          },
+          {
+            "code" : "510303",
+            "name" : "贡井区"
+          },
+          {
+            "code" : "510304",
+            "name" : "大安区"
+          },
+          {
+            "code" : "510311",
+            "name" : "沿滩区"
+          },
+          {
+            "code" : "510321",
+            "name" : "荣县"
+          },
+          {
+            "code" : "510322",
+            "name" : "富顺县"
+          }
+        ]
+      },
+      {
+        "code" : "510400",
+        "name" : "攀枝花市",
+        "areaList" : [
+          {
+            "code" : "510402",
+            "name" : "东区"
+          },
+          {
+            "code" : "510403",
+            "name" : "西区"
+          },
+          {
+            "code" : "510411",
+            "name" : "仁和区"
+          },
+          {
+            "code" : "510421",
+            "name" : "米易县"
+          },
+          {
+            "code" : "510422",
+            "name" : "盐边县"
+          }
+        ]
+      },
+      {
+        "code" : "510500",
+        "name" : "泸州市",
+        "areaList" : [
+          {
+            "code" : "510502",
+            "name" : "江阳区"
+          },
+          {
+            "code" : "510503",
+            "name" : "纳溪区"
+          },
+          {
+            "code" : "510504",
+            "name" : "龙马潭区"
+          },
+          {
+            "code" : "510521",
+            "name" : "泸县"
+          },
+          {
+            "code" : "510522",
+            "name" : "合江县"
+          },
+          {
+            "code" : "510524",
+            "name" : "叙永县"
+          },
+          {
+            "code" : "510525",
+            "name" : "古蔺县"
+          }
+        ]
+      },
+      {
+        "code" : "510600",
+        "name" : "德阳市",
+        "areaList" : [
+          {
+            "code" : "510603",
+            "name" : "旌阳区"
+          },
+          {
+            "code" : "510604",
+            "name" : "罗江区"
+          },
+          {
+            "code" : "510623",
+            "name" : "中江县"
+          },
+          {
+            "code" : "510681",
+            "name" : "广汉市"
+          },
+          {
+            "code" : "510682",
+            "name" : "什邡市"
+          },
+          {
+            "code" : "510683",
+            "name" : "绵竹市"
+          }
+        ]
+      },
+      {
+        "code" : "510700",
+        "name" : "绵阳市",
+        "areaList" : [
+          {
+            "code" : "510703",
+            "name" : "涪城区"
+          },
+          {
+            "code" : "510704",
+            "name" : "游仙区"
+          },
+          {
+            "code" : "510705",
+            "name" : "安州区"
+          },
+          {
+            "code" : "510722",
+            "name" : "三台县"
+          },
+          {
+            "code" : "510723",
+            "name" : "盐亭县"
+          },
+          {
+            "code" : "510725",
+            "name" : "梓潼县"
+          },
+          {
+            "code" : "510726",
+            "name" : "北川羌族自治县"
+          },
+          {
+            "code" : "510727",
+            "name" : "平武县"
+          },
+          {
+            "code" : "510781",
+            "name" : "江油市"
+          }
+        ]
+      },
+      {
+        "code" : "510800",
+        "name" : "广元市",
+        "areaList" : [
+          {
+            "code" : "510802",
+            "name" : "利州区"
+          },
+          {
+            "code" : "510811",
+            "name" : "昭化区"
+          },
+          {
+            "code" : "510812",
+            "name" : "朝天区"
+          },
+          {
+            "code" : "510821",
+            "name" : "旺苍县"
+          },
+          {
+            "code" : "510822",
+            "name" : "青川县"
+          },
+          {
+            "code" : "510823",
+            "name" : "剑阁县"
+          },
+          {
+            "code" : "510824",
+            "name" : "苍溪县"
+          }
+        ]
+      },
+      {
+        "code" : "510900",
+        "name" : "遂宁市",
+        "areaList" : [
+          {
+            "code" : "510903",
+            "name" : "船山区"
+          },
+          {
+            "code" : "510904",
+            "name" : "安居区"
+          },
+          {
+            "code" : "510921",
+            "name" : "蓬溪县"
+          },
+          {
+            "code" : "510923",
+            "name" : "大英县"
+          },
+          {
+            "code" : "510981",
+            "name" : "射洪市"
+          }
+        ]
+      },
+      {
+        "code" : "511000",
+        "name" : "内江市",
+        "areaList" : [
+          {
+            "code" : "511002",
+            "name" : "市中区"
+          },
+          {
+            "code" : "511011",
+            "name" : "东兴区"
+          },
+          {
+            "code" : "511024",
+            "name" : "威远县"
+          },
+          {
+            "code" : "511025",
+            "name" : "资中县"
+          },
+          {
+            "code" : "511083",
+            "name" : "隆昌市"
+          }
+        ]
+      },
+      {
+        "code" : "511100",
+        "name" : "乐山市",
+        "areaList" : [
+          {
+            "code" : "511102",
+            "name" : "市中区"
+          },
+          {
+            "code" : "511111",
+            "name" : "沙湾区"
+          },
+          {
+            "code" : "511112",
+            "name" : "五通桥区"
+          },
+          {
+            "code" : "511113",
+            "name" : "金口河区"
+          },
+          {
+            "code" : "511123",
+            "name" : "犍为县"
+          },
+          {
+            "code" : "511124",
+            "name" : "井研县"
+          },
+          {
+            "code" : "511126",
+            "name" : "夹江县"
+          },
+          {
+            "code" : "511129",
+            "name" : "沐川县"
+          },
+          {
+            "code" : "511132",
+            "name" : "峨边彝族自治县"
+          },
+          {
+            "code" : "511133",
+            "name" : "马边彝族自治县"
+          },
+          {
+            "code" : "511181",
+            "name" : "峨眉山市"
+          }
+        ]
+      },
+      {
+        "code" : "511300",
+        "name" : "南充市",
+        "areaList" : [
+          {
+            "code" : "511302",
+            "name" : "顺庆区"
+          },
+          {
+            "code" : "511303",
+            "name" : "高坪区"
+          },
+          {
+            "code" : "511304",
+            "name" : "嘉陵区"
+          },
+          {
+            "code" : "511321",
+            "name" : "南部县"
+          },
+          {
+            "code" : "511322",
+            "name" : "营山县"
+          },
+          {
+            "code" : "511323",
+            "name" : "蓬安县"
+          },
+          {
+            "code" : "511324",
+            "name" : "仪陇县"
+          },
+          {
+            "code" : "511325",
+            "name" : "西充县"
+          },
+          {
+            "code" : "511381",
+            "name" : "阆中市"
+          }
+        ]
+      },
+      {
+        "code" : "511400",
+        "name" : "眉山市",
+        "areaList" : [
+          {
+            "code" : "511402",
+            "name" : "东坡区"
+          },
+          {
+            "code" : "511403",
+            "name" : "彭山区"
+          },
+          {
+            "code" : "511421",
+            "name" : "仁寿县"
+          },
+          {
+            "code" : "511423",
+            "name" : "洪雅县"
+          },
+          {
+            "code" : "511424",
+            "name" : "丹棱县"
+          },
+          {
+            "code" : "511425",
+            "name" : "青神县"
+          }
+        ]
+      },
+      {
+        "code" : "511500",
+        "name" : "宜宾市",
+        "areaList" : [
+          {
+            "code" : "511502",
+            "name" : "翠屏区"
+          },
+          {
+            "code" : "511503",
+            "name" : "南溪区"
+          },
+          {
+            "code" : "511504",
+            "name" : "叙州区"
+          },
+          {
+            "code" : "511523",
+            "name" : "江安县"
+          },
+          {
+            "code" : "511524",
+            "name" : "长宁县"
+          },
+          {
+            "code" : "511525",
+            "name" : "高县"
+          },
+          {
+            "code" : "511526",
+            "name" : "珙县"
+          },
+          {
+            "code" : "511527",
+            "name" : "筠连县"
+          },
+          {
+            "code" : "511528",
+            "name" : "兴文县"
+          },
+          {
+            "code" : "511529",
+            "name" : "屏山县"
+          }
+        ]
+      },
+      {
+        "code" : "511600",
+        "name" : "广安市",
+        "areaList" : [
+          {
+            "code" : "511602",
+            "name" : "广安区"
+          },
+          {
+            "code" : "511603",
+            "name" : "前锋区"
+          },
+          {
+            "code" : "511621",
+            "name" : "岳池县"
+          },
+          {
+            "code" : "511622",
+            "name" : "武胜县"
+          },
+          {
+            "code" : "511623",
+            "name" : "邻水县"
+          },
+          {
+            "code" : "511681",
+            "name" : "华蓥市"
+          }
+        ]
+      },
+      {
+        "code" : "511700",
+        "name" : "达州市",
+        "areaList" : [
+          {
+            "code" : "511702",
+            "name" : "通川区"
+          },
+          {
+            "code" : "511703",
+            "name" : "达川区"
+          },
+          {
+            "code" : "511722",
+            "name" : "宣汉县"
+          },
+          {
+            "code" : "511723",
+            "name" : "开江县"
+          },
+          {
+            "code" : "511724",
+            "name" : "大竹县"
+          },
+          {
+            "code" : "511725",
+            "name" : "渠县"
+          },
+          {
+            "code" : "511781",
+            "name" : "万源市"
+          }
+        ]
+      },
+      {
+        "code" : "511800",
+        "name" : "雅安市",
+        "areaList" : [
+          {
+            "code" : "511802",
+            "name" : "雨城区"
+          },
+          {
+            "code" : "511803",
+            "name" : "名山区"
+          },
+          {
+            "code" : "511822",
+            "name" : "荥经县"
+          },
+          {
+            "code" : "511823",
+            "name" : "汉源县"
+          },
+          {
+            "code" : "511824",
+            "name" : "石棉县"
+          },
+          {
+            "code" : "511825",
+            "name" : "天全县"
+          },
+          {
+            "code" : "511826",
+            "name" : "芦山县"
+          },
+          {
+            "code" : "511827",
+            "name" : "宝兴县"
+          }
+        ]
+      },
+      {
+        "code" : "511900",
+        "name" : "巴中市",
+        "areaList" : [
+          {
+            "code" : "511902",
+            "name" : "巴州区"
+          },
+          {
+            "code" : "511903",
+            "name" : "恩阳区"
+          },
+          {
+            "code" : "511921",
+            "name" : "通江县"
+          },
+          {
+            "code" : "511922",
+            "name" : "南江县"
+          },
+          {
+            "code" : "511923",
+            "name" : "平昌县"
+          }
+        ]
+      },
+      {
+        "code" : "512000",
+        "name" : "资阳市",
+        "areaList" : [
+          {
+            "code" : "512002",
+            "name" : "雁江区"
+          },
+          {
+            "code" : "512021",
+            "name" : "安岳县"
+          },
+          {
+            "code" : "512022",
+            "name" : "乐至县"
+          }
+        ]
+      },
+      {
+        "code" : "513200",
+        "name" : "阿坝藏族羌族自治州",
+        "areaList" : [
+          {
+            "code" : "513201",
+            "name" : "马尔康市"
+          },
+          {
+            "code" : "513221",
+            "name" : "汶川县"
+          },
+          {
+            "code" : "513222",
+            "name" : "理县"
+          },
+          {
+            "code" : "513223",
+            "name" : "茂县"
+          },
+          {
+            "code" : "513224",
+            "name" : "松潘县"
+          },
+          {
+            "code" : "513225",
+            "name" : "九寨沟县"
+          },
+          {
+            "code" : "513226",
+            "name" : "金川县"
+          },
+          {
+            "code" : "513227",
+            "name" : "小金县"
+          },
+          {
+            "code" : "513228",
+            "name" : "黑水县"
+          },
+          {
+            "code" : "513230",
+            "name" : "壤塘县"
+          },
+          {
+            "code" : "513231",
+            "name" : "阿坝县"
+          },
+          {
+            "code" : "513232",
+            "name" : "若尔盖县"
+          },
+          {
+            "code" : "513233",
+            "name" : "红原县"
+          }
+        ]
+      },
+      {
+        "code" : "513300",
+        "name" : "甘孜藏族自治州",
+        "areaList" : [
+          {
+            "code" : "513301",
+            "name" : "康定市"
+          },
+          {
+            "code" : "513322",
+            "name" : "泸定县"
+          },
+          {
+            "code" : "513323",
+            "name" : "丹巴县"
+          },
+          {
+            "code" : "513324",
+            "name" : "九龙县"
+          },
+          {
+            "code" : "513325",
+            "name" : "雅江县"
+          },
+          {
+            "code" : "513326",
+            "name" : "道孚县"
+          },
+          {
+            "code" : "513327",
+            "name" : "炉霍县"
+          },
+          {
+            "code" : "513328",
+            "name" : "甘孜县"
+          },
+          {
+            "code" : "513329",
+            "name" : "新龙县"
+          },
+          {
+            "code" : "513330",
+            "name" : "德格县"
+          },
+          {
+            "code" : "513331",
+            "name" : "白玉县"
+          },
+          {
+            "code" : "513332",
+            "name" : "石渠县"
+          },
+          {
+            "code" : "513333",
+            "name" : "色达县"
+          },
+          {
+            "code" : "513334",
+            "name" : "理塘县"
+          },
+          {
+            "code" : "513335",
+            "name" : "巴塘县"
+          },
+          {
+            "code" : "513336",
+            "name" : "乡城县"
+          },
+          {
+            "code" : "513337",
+            "name" : "稻城县"
+          },
+          {
+            "code" : "513338",
+            "name" : "得荣县"
+          }
+        ]
+      },
+      {
+        "code" : "513400",
+        "name" : "凉山彝族自治州",
+        "areaList" : [
+          {
+            "code" : "513401",
+            "name" : "西昌市"
+          },
+          {
+            "code" : "513402",
+            "name" : "会理市"
+          },
+          {
+            "code" : "513422",
+            "name" : "木里藏族自治县"
+          },
+          {
+            "code" : "513423",
+            "name" : "盐源县"
+          },
+          {
+            "code" : "513424",
+            "name" : "德昌县"
+          },
+          {
+            "code" : "513426",
+            "name" : "会东县"
+          },
+          {
+            "code" : "513427",
+            "name" : "宁南县"
+          },
+          {
+            "code" : "513428",
+            "name" : "普格县"
+          },
+          {
+            "code" : "513429",
+            "name" : "布拖县"
+          },
+          {
+            "code" : "513430",
+            "name" : "金阳县"
+          },
+          {
+            "code" : "513431",
+            "name" : "昭觉县"
+          },
+          {
+            "code" : "513432",
+            "name" : "喜德县"
+          },
+          {
+            "code" : "513433",
+            "name" : "冕宁县"
+          },
+          {
+            "code" : "513434",
+            "name" : "越西县"
+          },
+          {
+            "code" : "513435",
+            "name" : "甘洛县"
+          },
+          {
+            "code" : "513436",
+            "name" : "美姑县"
+          },
+          {
+            "code" : "513437",
+            "name" : "雷波县"
+          }
+        ]
+      }
+    ]
+  },
+  {
+    "code" : "520000",
+    "name" : "贵州省",
+    "cityList" : [
+      {
+        "code" : "520100",
+        "name" : "贵阳市",
+        "areaList" : [
+          {
+            "code" : "520102",
+            "name" : "南明区"
+          },
+          {
+            "code" : "520103",
+            "name" : "云岩区"
+          },
+          {
+            "code" : "520111",
+            "name" : "花溪区"
+          },
+          {
+            "code" : "520112",
+            "name" : "乌当区"
+          },
+          {
+            "code" : "520113",
+            "name" : "白云区"
+          },
+          {
+            "code" : "520115",
+            "name" : "观山湖区"
+          },
+          {
+            "code" : "520121",
+            "name" : "开阳县"
+          },
+          {
+            "code" : "520122",
+            "name" : "息烽县"
+          },
+          {
+            "code" : "520123",
+            "name" : "修文县"
+          },
+          {
+            "code" : "520181",
+            "name" : "清镇市"
+          }
+        ]
+      },
+      {
+        "code" : "520200",
+        "name" : "六盘水市",
+        "areaList" : [
+          {
+            "code" : "520201",
+            "name" : "钟山区"
+          },
+          {
+            "code" : "520203",
+            "name" : "六枝特区"
+          },
+          {
+            "code" : "520204",
+            "name" : "水城区"
+          },
+          {
+            "code" : "520281",
+            "name" : "盘州市"
+          }
+        ]
+      },
+      {
+        "code" : "520300",
+        "name" : "遵义市",
+        "areaList" : [
+          {
+            "code" : "520302",
+            "name" : "红花岗区"
+          },
+          {
+            "code" : "520303",
+            "name" : "汇川区"
+          },
+          {
+            "code" : "520304",
+            "name" : "播州区"
+          },
+          {
+            "code" : "520322",
+            "name" : "桐梓县"
+          },
+          {
+            "code" : "520323",
+            "name" : "绥阳县"
+          },
+          {
+            "code" : "520324",
+            "name" : "正安县"
+          },
+          {
+            "code" : "520325",
+            "name" : "道真仡佬族苗族自治县"
+          },
+          {
+            "code" : "520326",
+            "name" : "务川仡佬族苗族自治县"
+          },
+          {
+            "code" : "520327",
+            "name" : "凤冈县"
+          },
+          {
+            "code" : "520328",
+            "name" : "湄潭县"
+          },
+          {
+            "code" : "520329",
+            "name" : "余庆县"
+          },
+          {
+            "code" : "520330",
+            "name" : "习水县"
+          },
+          {
+            "code" : "520381",
+            "name" : "赤水市"
+          },
+          {
+            "code" : "520382",
+            "name" : "仁怀市"
+          }
+        ]
+      },
+      {
+        "code" : "520400",
+        "name" : "安顺市",
+        "areaList" : [
+          {
+            "code" : "520402",
+            "name" : "西秀区"
+          },
+          {
+            "code" : "520403",
+            "name" : "平坝区"
+          },
+          {
+            "code" : "520422",
+            "name" : "普定县"
+          },
+          {
+            "code" : "520423",
+            "name" : "镇宁布依族苗族自治县"
+          },
+          {
+            "code" : "520424",
+            "name" : "关岭布依族苗族自治县"
+          },
+          {
+            "code" : "520425",
+            "name" : "紫云苗族布依族自治县"
+          }
+        ]
+      },
+      {
+        "code" : "520500",
+        "name" : "毕节市",
+        "areaList" : [
+          {
+            "code" : "520502",
+            "name" : "七星关区"
+          },
+          {
+            "code" : "520521",
+            "name" : "大方县"
+          },
+          {
+            "code" : "520523",
+            "name" : "金沙县"
+          },
+          {
+            "code" : "520524",
+            "name" : "织金县"
+          },
+          {
+            "code" : "520525",
+            "name" : "纳雍县"
+          },
+          {
+            "code" : "520526",
+            "name" : "威宁彝族回族苗族自治县"
+          },
+          {
+            "code" : "520527",
+            "name" : "赫章县"
+          },
+          {
+            "code" : "520581",
+            "name" : "黔西市"
+          }
+        ]
+      },
+      {
+        "code" : "520600",
+        "name" : "铜仁市",
+        "areaList" : [
+          {
+            "code" : "520602",
+            "name" : "碧江区"
+          },
+          {
+            "code" : "520603",
+            "name" : "万山区"
+          },
+          {
+            "code" : "520621",
+            "name" : "江口县"
+          },
+          {
+            "code" : "520622",
+            "name" : "玉屏侗族自治县"
+          },
+          {
+            "code" : "520623",
+            "name" : "石阡县"
+          },
+          {
+            "code" : "520624",
+            "name" : "思南县"
+          },
+          {
+            "code" : "520625",
+            "name" : "印江土家族苗族自治县"
+          },
+          {
+            "code" : "520626",
+            "name" : "德江县"
+          },
+          {
+            "code" : "520627",
+            "name" : "沿河土家族自治县"
+          },
+          {
+            "code" : "520628",
+            "name" : "松桃苗族自治县"
+          }
+        ]
+      },
+      {
+        "code" : "522300",
+        "name" : "黔西南布依族苗族自治州",
+        "areaList" : [
+          {
+            "code" : "522301",
+            "name" : "兴义市"
+          },
+          {
+            "code" : "522302",
+            "name" : "兴仁市"
+          },
+          {
+            "code" : "522323",
+            "name" : "普安县"
+          },
+          {
+            "code" : "522324",
+            "name" : "晴隆县"
+          },
+          {
+            "code" : "522325",
+            "name" : "贞丰县"
+          },
+          {
+            "code" : "522326",
+            "name" : "望谟县"
+          },
+          {
+            "code" : "522327",
+            "name" : "册亨县"
+          },
+          {
+            "code" : "522328",
+            "name" : "安龙县"
+          }
+        ]
+      },
+      {
+        "code" : "522600",
+        "name" : "黔东南苗族侗族自治州",
+        "areaList" : [
+          {
+            "code" : "522601",
+            "name" : "凯里市"
+          },
+          {
+            "code" : "522622",
+            "name" : "黄平县"
+          },
+          {
+            "code" : "522623",
+            "name" : "施秉县"
+          },
+          {
+            "code" : "522624",
+            "name" : "三穗县"
+          },
+          {
+            "code" : "522625",
+            "name" : "镇远县"
+          },
+          {
+            "code" : "522626",
+            "name" : "岑巩县"
+          },
+          {
+            "code" : "522627",
+            "name" : "天柱县"
+          },
+          {
+            "code" : "522628",
+            "name" : "锦屏县"
+          },
+          {
+            "code" : "522629",
+            "name" : "剑河县"
+          },
+          {
+            "code" : "522630",
+            "name" : "台江县"
+          },
+          {
+            "code" : "522631",
+            "name" : "黎平县"
+          },
+          {
+            "code" : "522632",
+            "name" : "榕江县"
+          },
+          {
+            "code" : "522633",
+            "name" : "从江县"
+          },
+          {
+            "code" : "522634",
+            "name" : "雷山县"
+          },
+          {
+            "code" : "522635",
+            "name" : "麻江县"
+          },
+          {
+            "code" : "522636",
+            "name" : "丹寨县"
+          }
+        ]
+      },
+      {
+        "code" : "522700",
+        "name" : "黔南布依族苗族自治州",
+        "areaList" : [
+          {
+            "code" : "522701",
+            "name" : "都匀市"
+          },
+          {
+            "code" : "522702",
+            "name" : "福泉市"
+          },
+          {
+            "code" : "522722",
+            "name" : "荔波县"
+          },
+          {
+            "code" : "522723",
+            "name" : "贵定县"
+          },
+          {
+            "code" : "522725",
+            "name" : "瓮安县"
+          },
+          {
+            "code" : "522726",
+            "name" : "独山县"
+          },
+          {
+            "code" : "522727",
+            "name" : "平塘县"
+          },
+          {
+            "code" : "522728",
+            "name" : "罗甸县"
+          },
+          {
+            "code" : "522729",
+            "name" : "长顺县"
+          },
+          {
+            "code" : "522730",
+            "name" : "龙里县"
+          },
+          {
+            "code" : "522731",
+            "name" : "惠水县"
+          },
+          {
+            "code" : "522732",
+            "name" : "三都水族自治县"
+          }
+        ]
+      }
+    ]
+  },
+  {
+    "code" : "530000",
+    "name" : "云南省",
+    "cityList" : [
+      {
+        "code" : "530100",
+        "name" : "昆明市",
+        "areaList" : [
+          {
+            "code" : "530102",
+            "name" : "五华区"
+          },
+          {
+            "code" : "530103",
+            "name" : "盘龙区"
+          },
+          {
+            "code" : "530111",
+            "name" : "官渡区"
+          },
+          {
+            "code" : "530112",
+            "name" : "西山区"
+          },
+          {
+            "code" : "530113",
+            "name" : "东川区"
+          },
+          {
+            "code" : "530114",
+            "name" : "呈贡区"
+          },
+          {
+            "code" : "530115",
+            "name" : "晋宁区"
+          },
+          {
+            "code" : "530124",
+            "name" : "富民县"
+          },
+          {
+            "code" : "530125",
+            "name" : "宜良县"
+          },
+          {
+            "code" : "530126",
+            "name" : "石林彝族自治县"
+          },
+          {
+            "code" : "530127",
+            "name" : "嵩明县"
+          },
+          {
+            "code" : "530128",
+            "name" : "禄劝彝族苗族自治县"
+          },
+          {
+            "code" : "530129",
+            "name" : "寻甸回族彝族自治县"
+          },
+          {
+            "code" : "530181",
+            "name" : "安宁市"
+          }
+        ]
+      },
+      {
+        "code" : "530300",
+        "name" : "曲靖市",
+        "areaList" : [
+          {
+            "code" : "530302",
+            "name" : "麒麟区"
+          },
+          {
+            "code" : "530303",
+            "name" : "沾益区"
+          },
+          {
+            "code" : "530304",
+            "name" : "马龙区"
+          },
+          {
+            "code" : "530322",
+            "name" : "陆良县"
+          },
+          {
+            "code" : "530323",
+            "name" : "师宗县"
+          },
+          {
+            "code" : "530324",
+            "name" : "罗平县"
+          },
+          {
+            "code" : "530325",
+            "name" : "富源县"
+          },
+          {
+            "code" : "530326",
+            "name" : "会泽县"
+          },
+          {
+            "code" : "530381",
+            "name" : "宣威市"
+          }
+        ]
+      },
+      {
+        "code" : "530400",
+        "name" : "玉溪市",
+        "areaList" : [
+          {
+            "code" : "530402",
+            "name" : "红塔区"
+          },
+          {
+            "code" : "530403",
+            "name" : "江川区"
+          },
+          {
+            "code" : "530423",
+            "name" : "通海县"
+          },
+          {
+            "code" : "530424",
+            "name" : "华宁县"
+          },
+          {
+            "code" : "530425",
+            "name" : "易门县"
+          },
+          {
+            "code" : "530426",
+            "name" : "峨山彝族自治县"
+          },
+          {
+            "code" : "530427",
+            "name" : "新平彝族傣族自治县"
+          },
+          {
+            "code" : "530428",
+            "name" : "元江哈尼族彝族傣族自治县"
+          },
+          {
+            "code" : "530481",
+            "name" : "澄江市"
+          }
+        ]
+      },
+      {
+        "code" : "530500",
+        "name" : "保山市",
+        "areaList" : [
+          {
+            "code" : "530502",
+            "name" : "隆阳区"
+          },
+          {
+            "code" : "530521",
+            "name" : "施甸县"
+          },
+          {
+            "code" : "530523",
+            "name" : "龙陵县"
+          },
+          {
+            "code" : "530524",
+            "name" : "昌宁县"
+          },
+          {
+            "code" : "530581",
+            "name" : "腾冲市"
+          }
+        ]
+      },
+      {
+        "code" : "530600",
+        "name" : "昭通市",
+        "areaList" : [
+          {
+            "code" : "530602",
+            "name" : "昭阳区"
+          },
+          {
+            "code" : "530621",
+            "name" : "鲁甸县"
+          },
+          {
+            "code" : "530622",
+            "name" : "巧家县"
+          },
+          {
+            "code" : "530623",
+            "name" : "盐津县"
+          },
+          {
+            "code" : "530624",
+            "name" : "大关县"
+          },
+          {
+            "code" : "530625",
+            "name" : "永善县"
+          },
+          {
+            "code" : "530626",
+            "name" : "绥江县"
+          },
+          {
+            "code" : "530627",
+            "name" : "镇雄县"
+          },
+          {
+            "code" : "530628",
+            "name" : "彝良县"
+          },
+          {
+            "code" : "530629",
+            "name" : "威信县"
+          },
+          {
+            "code" : "530681",
+            "name" : "水富市"
+          }
+        ]
+      },
+      {
+        "code" : "530700",
+        "name" : "丽江市",
+        "areaList" : [
+          {
+            "code" : "530702",
+            "name" : "古城区"
+          },
+          {
+            "code" : "530721",
+            "name" : "玉龙纳西族自治县"
+          },
+          {
+            "code" : "530722",
+            "name" : "永胜县"
+          },
+          {
+            "code" : "530723",
+            "name" : "华坪县"
+          },
+          {
+            "code" : "530724",
+            "name" : "宁蒗彝族自治县"
+          }
+        ]
+      },
+      {
+        "code" : "530800",
+        "name" : "普洱市",
+        "areaList" : [
+          {
+            "code" : "530802",
+            "name" : "思茅区"
+          },
+          {
+            "code" : "530821",
+            "name" : "宁洱哈尼族彝族自治县"
+          },
+          {
+            "code" : "530822",
+            "name" : "墨江哈尼族自治县"
+          },
+          {
+            "code" : "530823",
+            "name" : "景东彝族自治县"
+          },
+          {
+            "code" : "530824",
+            "name" : "景谷傣族彝族自治县"
+          },
+          {
+            "code" : "530825",
+            "name" : "镇沅彝族哈尼族拉祜族自治县"
+          },
+          {
+            "code" : "530826",
+            "name" : "江城哈尼族彝族自治县"
+          },
+          {
+            "code" : "530827",
+            "name" : "孟连傣族拉祜族佤族自治县"
+          },
+          {
+            "code" : "530828",
+            "name" : "澜沧拉祜族自治县"
+          },
+          {
+            "code" : "530829",
+            "name" : "西盟佤族自治县"
+          }
+        ]
+      },
+      {
+        "code" : "530900",
+        "name" : "临沧市",
+        "areaList" : [
+          {
+            "code" : "530902",
+            "name" : "临翔区"
+          },
+          {
+            "code" : "530921",
+            "name" : "凤庆县"
+          },
+          {
+            "code" : "530922",
+            "name" : "云县"
+          },
+          {
+            "code" : "530923",
+            "name" : "永德县"
+          },
+          {
+            "code" : "530924",
+            "name" : "镇康县"
+          },
+          {
+            "code" : "530925",
+            "name" : "双江拉祜族佤族布朗族傣族自治县"
+          },
+          {
+            "code" : "530926",
+            "name" : "耿马傣族佤族自治县"
+          },
+          {
+            "code" : "530927",
+            "name" : "沧源佤族自治县"
+          }
+        ]
+      },
+      {
+        "code" : "532300",
+        "name" : "楚雄彝族自治州",
+        "areaList" : [
+          {
+            "code" : "532301",
+            "name" : "楚雄市"
+          },
+          {
+            "code" : "532302",
+            "name" : "禄丰市"
+          },
+          {
+            "code" : "532322",
+            "name" : "双柏县"
+          },
+          {
+            "code" : "532323",
+            "name" : "牟定县"
+          },
+          {
+            "code" : "532324",
+            "name" : "南华县"
+          },
+          {
+            "code" : "532325",
+            "name" : "姚安县"
+          },
+          {
+            "code" : "532326",
+            "name" : "大姚县"
+          },
+          {
+            "code" : "532327",
+            "name" : "永仁县"
+          },
+          {
+            "code" : "532328",
+            "name" : "元谋县"
+          },
+          {
+            "code" : "532329",
+            "name" : "武定县"
+          }
+        ]
+      },
+      {
+        "code" : "532500",
+        "name" : "红河哈尼族彝族自治州",
+        "areaList" : [
+          {
+            "code" : "532501",
+            "name" : "个旧市"
+          },
+          {
+            "code" : "532502",
+            "name" : "开远市"
+          },
+          {
+            "code" : "532503",
+            "name" : "蒙自市"
+          },
+          {
+            "code" : "532504",
+            "name" : "弥勒市"
+          },
+          {
+            "code" : "532523",
+            "name" : "屏边苗族自治县"
+          },
+          {
+            "code" : "532524",
+            "name" : "建水县"
+          },
+          {
+            "code" : "532525",
+            "name" : "石屏县"
+          },
+          {
+            "code" : "532527",
+            "name" : "泸西县"
+          },
+          {
+            "code" : "532528",
+            "name" : "元阳县"
+          },
+          {
+            "code" : "532529",
+            "name" : "红河县"
+          },
+          {
+            "code" : "532530",
+            "name" : "金平苗族瑶族傣族自治县"
+          },
+          {
+            "code" : "532531",
+            "name" : "绿春县"
+          },
+          {
+            "code" : "532532",
+            "name" : "河口瑶族自治县"
+          }
+        ]
+      },
+      {
+        "code" : "532600",
+        "name" : "文山壮族苗族自治州",
+        "areaList" : [
+          {
+            "code" : "532601",
+            "name" : "文山市"
+          },
+          {
+            "code" : "532622",
+            "name" : "砚山县"
+          },
+          {
+            "code" : "532623",
+            "name" : "西畴县"
+          },
+          {
+            "code" : "532624",
+            "name" : "麻栗坡县"
+          },
+          {
+            "code" : "532625",
+            "name" : "马关县"
+          },
+          {
+            "code" : "532626",
+            "name" : "丘北县"
+          },
+          {
+            "code" : "532627",
+            "name" : "广南县"
+          },
+          {
+            "code" : "532628",
+            "name" : "富宁县"
+          }
+        ]
+      },
+      {
+        "code" : "532800",
+        "name" : "西双版纳傣族自治州",
+        "areaList" : [
+          {
+            "code" : "532801",
+            "name" : "景洪市"
+          },
+          {
+            "code" : "532822",
+            "name" : "勐海县"
+          },
+          {
+            "code" : "532823",
+            "name" : "勐腊县"
+          }
+        ]
+      },
+      {
+        "code" : "532900",
+        "name" : "大理白族自治州",
+        "areaList" : [
+          {
+            "code" : "532901",
+            "name" : "大理市"
+          },
+          {
+            "code" : "532922",
+            "name" : "漾濞彝族自治县"
+          },
+          {
+            "code" : "532923",
+            "name" : "祥云县"
+          },
+          {
+            "code" : "532924",
+            "name" : "宾川县"
+          },
+          {
+            "code" : "532925",
+            "name" : "弥渡县"
+          },
+          {
+            "code" : "532926",
+            "name" : "南涧彝族自治县"
+          },
+          {
+            "code" : "532927",
+            "name" : "巍山彝族回族自治县"
+          },
+          {
+            "code" : "532928",
+            "name" : "永平县"
+          },
+          {
+            "code" : "532929",
+            "name" : "云龙县"
+          },
+          {
+            "code" : "532930",
+            "name" : "洱源县"
+          },
+          {
+            "code" : "532931",
+            "name" : "剑川县"
+          },
+          {
+            "code" : "532932",
+            "name" : "鹤庆县"
+          }
+        ]
+      },
+      {
+        "code" : "533100",
+        "name" : "德宏傣族景颇族自治州",
+        "areaList" : [
+          {
+            "code" : "533102",
+            "name" : "瑞丽市"
+          },
+          {
+            "code" : "533103",
+            "name" : "芒市"
+          },
+          {
+            "code" : "533122",
+            "name" : "梁河县"
+          },
+          {
+            "code" : "533123",
+            "name" : "盈江县"
+          },
+          {
+            "code" : "533124",
+            "name" : "陇川县"
+          }
+        ]
+      },
+      {
+        "code" : "533300",
+        "name" : "怒江傈僳族自治州",
+        "areaList" : [
+          {
+            "code" : "533301",
+            "name" : "泸水市"
+          },
+          {
+            "code" : "533323",
+            "name" : "福贡县"
+          },
+          {
+            "code" : "533324",
+            "name" : "贡山独龙族怒族自治县"
+          },
+          {
+            "code" : "533325",
+            "name" : "兰坪白族普米族自治县"
+          }
+        ]
+      },
+      {
+        "code" : "533400",
+        "name" : "迪庆藏族自治州",
+        "areaList" : [
+          {
+            "code" : "533401",
+            "name" : "香格里拉市"
+          },
+          {
+            "code" : "533422",
+            "name" : "德钦县"
+          },
+          {
+            "code" : "533423",
+            "name" : "维西傈僳族自治县"
+          }
+        ]
+      }
+    ]
+  },
+  {
+    "code" : "540000",
+    "name" : "西藏自治区",
+    "cityList" : [
+      {
+        "code" : "540100",
+        "name" : "拉萨市",
+        "areaList" : [
+          {
+            "code" : "540102",
+            "name" : "城关区"
+          },
+          {
+            "code" : "540103",
+            "name" : "堆龙德庆区"
+          },
+          {
+            "code" : "540104",
+            "name" : "达孜区"
+          },
+          {
+            "code" : "540121",
+            "name" : "林周县"
+          },
+          {
+            "code" : "540122",
+            "name" : "当雄县"
+          },
+          {
+            "code" : "540123",
+            "name" : "尼木县"
+          },
+          {
+            "code" : "540124",
+            "name" : "曲水县"
+          },
+          {
+            "code" : "540127",
+            "name" : "墨竹工卡县"
+          }
+        ]
+      },
+      {
+        "code" : "540200",
+        "name" : "日喀则市",
+        "areaList" : [
+          {
+            "code" : "540202",
+            "name" : "桑珠孜区"
+          },
+          {
+            "code" : "540221",
+            "name" : "南木林县"
+          },
+          {
+            "code" : "540222",
+            "name" : "江孜县"
+          },
+          {
+            "code" : "540223",
+            "name" : "定日县"
+          },
+          {
+            "code" : "540224",
+            "name" : "萨迦县"
+          },
+          {
+            "code" : "540225",
+            "name" : "拉孜县"
+          },
+          {
+            "code" : "540226",
+            "name" : "昂仁县"
+          },
+          {
+            "code" : "540227",
+            "name" : "谢通门县"
+          },
+          {
+            "code" : "540228",
+            "name" : "白朗县"
+          },
+          {
+            "code" : "540229",
+            "name" : "仁布县"
+          },
+          {
+            "code" : "540230",
+            "name" : "康马县"
+          },
+          {
+            "code" : "540231",
+            "name" : "定结县"
+          },
+          {
+            "code" : "540232",
+            "name" : "仲巴县"
+          },
+          {
+            "code" : "540233",
+            "name" : "亚东县"
+          },
+          {
+            "code" : "540234",
+            "name" : "吉隆县"
+          },
+          {
+            "code" : "540235",
+            "name" : "聂拉木县"
+          },
+          {
+            "code" : "540236",
+            "name" : "萨嘎县"
+          },
+          {
+            "code" : "540237",
+            "name" : "岗巴县"
+          }
+        ]
+      },
+      {
+        "code" : "540300",
+        "name" : "昌都市",
+        "areaList" : [
+          {
+            "code" : "540302",
+            "name" : "卡若区"
+          },
+          {
+            "code" : "540321",
+            "name" : "江达县"
+          },
+          {
+            "code" : "540322",
+            "name" : "贡觉县"
+          },
+          {
+            "code" : "540323",
+            "name" : "类乌齐县"
+          },
+          {
+            "code" : "540324",
+            "name" : "丁青县"
+          },
+          {
+            "code" : "540325",
+            "name" : "察雅县"
+          },
+          {
+            "code" : "540326",
+            "name" : "八宿县"
+          },
+          {
+            "code" : "540327",
+            "name" : "左贡县"
+          },
+          {
+            "code" : "540328",
+            "name" : "芒康县"
+          },
+          {
+            "code" : "540329",
+            "name" : "洛隆县"
+          },
+          {
+            "code" : "540330",
+            "name" : "边坝县"
+          }
+        ]
+      },
+      {
+        "code" : "540400",
+        "name" : "林芝市",
+        "areaList" : [
+          {
+            "code" : "540402",
+            "name" : "巴宜区"
+          },
+          {
+            "code" : "540421",
+            "name" : "工布江达县"
+          },
+          {
+            "code" : "540422",
+            "name" : "米林市"
+          },
+          {
+            "code" : "540423",
+            "name" : "墨脱县"
+          },
+          {
+            "code" : "540424",
+            "name" : "波密县"
+          },
+          {
+            "code" : "540425",
+            "name" : "察隅县"
+          },
+          {
+            "code" : "540426",
+            "name" : "朗县"
+          }
+        ]
+      },
+      {
+        "code" : "540500",
+        "name" : "山南市",
+        "areaList" : [
+          {
+            "code" : "540502",
+            "name" : "乃东区"
+          },
+          {
+            "code" : "540521",
+            "name" : "扎囊县"
+          },
+          {
+            "code" : "540522",
+            "name" : "贡嘎县"
+          },
+          {
+            "code" : "540523",
+            "name" : "桑日县"
+          },
+          {
+            "code" : "540524",
+            "name" : "琼结县"
+          },
+          {
+            "code" : "540525",
+            "name" : "曲松县"
+          },
+          {
+            "code" : "540526",
+            "name" : "措美县"
+          },
+          {
+            "code" : "540527",
+            "name" : "洛扎县"
+          },
+          {
+            "code" : "540528",
+            "name" : "加查县"
+          },
+          {
+            "code" : "540529",
+            "name" : "隆子县"
+          },
+          {
+            "code" : "540530",
+            "name" : "错那市"
+          },
+          {
+            "code" : "540531",
+            "name" : "浪卡子县"
+          }
+        ]
+      },
+      {
+        "code" : "540600",
+        "name" : "那曲市",
+        "areaList" : [
+          {
+            "code" : "540602",
+            "name" : "色尼区"
+          },
+          {
+            "code" : "540621",
+            "name" : "嘉黎县"
+          },
+          {
+            "code" : "540622",
+            "name" : "比如县"
+          },
+          {
+            "code" : "540623",
+            "name" : "聂荣县"
+          },
+          {
+            "code" : "540624",
+            "name" : "安多县"
+          },
+          {
+            "code" : "540625",
+            "name" : "申扎县"
+          },
+          {
+            "code" : "540626",
+            "name" : "索县"
+          },
+          {
+            "code" : "540627",
+            "name" : "班戈县"
+          },
+          {
+            "code" : "540628",
+            "name" : "巴青县"
+          },
+          {
+            "code" : "540629",
+            "name" : "尼玛县"
+          },
+          {
+            "code" : "540630",
+            "name" : "双湖县"
+          }
+        ]
+      },
+      {
+        "code" : "542500",
+        "name" : "阿里地区",
+        "areaList" : [
+          {
+            "code" : "542521",
+            "name" : "普兰县"
+          },
+          {
+            "code" : "542522",
+            "name" : "札达县"
+          },
+          {
+            "code" : "542523",
+            "name" : "噶尔县"
+          },
+          {
+            "code" : "542524",
+            "name" : "日土县"
+          },
+          {
+            "code" : "542525",
+            "name" : "革吉县"
+          },
+          {
+            "code" : "542526",
+            "name" : "改则县"
+          },
+          {
+            "code" : "542527",
+            "name" : "措勤县"
+          }
+        ]
+      }
+    ]
+  },
+  {
+    "code" : "610000",
+    "name" : "陕西省",
+    "cityList" : [
+      {
+        "code" : "610100",
+        "name" : "西安市",
+        "areaList" : [
+          {
+            "code" : "610102",
+            "name" : "新城区"
+          },
+          {
+            "code" : "610103",
+            "name" : "碑林区"
+          },
+          {
+            "code" : "610104",
+            "name" : "莲湖区"
+          },
+          {
+            "code" : "610111",
+            "name" : "灞桥区"
+          },
+          {
+            "code" : "610112",
+            "name" : "未央区"
+          },
+          {
+            "code" : "610113",
+            "name" : "雁塔区"
+          },
+          {
+            "code" : "610114",
+            "name" : "阎良区"
+          },
+          {
+            "code" : "610115",
+            "name" : "临潼区"
+          },
+          {
+            "code" : "610116",
+            "name" : "长安区"
+          },
+          {
+            "code" : "610117",
+            "name" : "高陵区"
+          },
+          {
+            "code" : "610118",
+            "name" : "鄠邑区"
+          },
+          {
+            "code" : "610122",
+            "name" : "蓝田县"
+          },
+          {
+            "code" : "610124",
+            "name" : "周至县"
+          }
+        ]
+      },
+      {
+        "code" : "610200",
+        "name" : "铜川市",
+        "areaList" : [
+          {
+            "code" : "610202",
+            "name" : "王益区"
+          },
+          {
+            "code" : "610203",
+            "name" : "印台区"
+          },
+          {
+            "code" : "610204",
+            "name" : "耀州区"
+          },
+          {
+            "code" : "610222",
+            "name" : "宜君县"
+          }
+        ]
+      },
+      {
+        "code" : "610300",
+        "name" : "宝鸡市",
+        "areaList" : [
+          {
+            "code" : "610302",
+            "name" : "渭滨区"
+          },
+          {
+            "code" : "610303",
+            "name" : "金台区"
+          },
+          {
+            "code" : "610304",
+            "name" : "陈仓区"
+          },
+          {
+            "code" : "610305",
+            "name" : "凤翔区"
+          },
+          {
+            "code" : "610323",
+            "name" : "岐山县"
+          },
+          {
+            "code" : "610324",
+            "name" : "扶风县"
+          },
+          {
+            "code" : "610326",
+            "name" : "眉县"
+          },
+          {
+            "code" : "610327",
+            "name" : "陇县"
+          },
+          {
+            "code" : "610328",
+            "name" : "千阳县"
+          },
+          {
+            "code" : "610329",
+            "name" : "麟游县"
+          },
+          {
+            "code" : "610330",
+            "name" : "凤县"
+          },
+          {
+            "code" : "610331",
+            "name" : "太白县"
+          }
+        ]
+      },
+      {
+        "code" : "610400",
+        "name" : "咸阳市",
+        "areaList" : [
+          {
+            "code" : "610402",
+            "name" : "秦都区"
+          },
+          {
+            "code" : "610403",
+            "name" : "杨陵区"
+          },
+          {
+            "code" : "610404",
+            "name" : "渭城区"
+          },
+          {
+            "code" : "610422",
+            "name" : "三原县"
+          },
+          {
+            "code" : "610423",
+            "name" : "泾阳县"
+          },
+          {
+            "code" : "610424",
+            "name" : "乾县"
+          },
+          {
+            "code" : "610425",
+            "name" : "礼泉县"
+          },
+          {
+            "code" : "610426",
+            "name" : "永寿县"
+          },
+          {
+            "code" : "610428",
+            "name" : "长武县"
+          },
+          {
+            "code" : "610429",
+            "name" : "旬邑县"
+          },
+          {
+            "code" : "610430",
+            "name" : "淳化县"
+          },
+          {
+            "code" : "610431",
+            "name" : "武功县"
+          },
+          {
+            "code" : "610481",
+            "name" : "兴平市"
+          },
+          {
+            "code" : "610482",
+            "name" : "彬州市"
+          }
+        ]
+      },
+      {
+        "code" : "610500",
+        "name" : "渭南市",
+        "areaList" : [
+          {
+            "code" : "610502",
+            "name" : "临渭区"
+          },
+          {
+            "code" : "610503",
+            "name" : "华州区"
+          },
+          {
+            "code" : "610522",
+            "name" : "潼关县"
+          },
+          {
+            "code" : "610523",
+            "name" : "大荔县"
+          },
+          {
+            "code" : "610524",
+            "name" : "合阳县"
+          },
+          {
+            "code" : "610525",
+            "name" : "澄城县"
+          },
+          {
+            "code" : "610526",
+            "name" : "蒲城县"
+          },
+          {
+            "code" : "610527",
+            "name" : "白水县"
+          },
+          {
+            "code" : "610528",
+            "name" : "富平县"
+          },
+          {
+            "code" : "610581",
+            "name" : "韩城市"
+          },
+          {
+            "code" : "610582",
+            "name" : "华阴市"
+          }
+        ]
+      },
+      {
+        "code" : "610600",
+        "name" : "延安市",
+        "areaList" : [
+          {
+            "code" : "610602",
+            "name" : "宝塔区"
+          },
+          {
+            "code" : "610603",
+            "name" : "安塞区"
+          },
+          {
+            "code" : "610621",
+            "name" : "延长县"
+          },
+          {
+            "code" : "610622",
+            "name" : "延川县"
+          },
+          {
+            "code" : "610625",
+            "name" : "志丹县"
+          },
+          {
+            "code" : "610626",
+            "name" : "吴起县"
+          },
+          {
+            "code" : "610627",
+            "name" : "甘泉县"
+          },
+          {
+            "code" : "610628",
+            "name" : "富县"
+          },
+          {
+            "code" : "610629",
+            "name" : "洛川县"
+          },
+          {
+            "code" : "610630",
+            "name" : "宜川县"
+          },
+          {
+            "code" : "610631",
+            "name" : "黄龙县"
+          },
+          {
+            "code" : "610632",
+            "name" : "黄陵县"
+          },
+          {
+            "code" : "610681",
+            "name" : "子长市"
+          }
+        ]
+      },
+      {
+        "code" : "610700",
+        "name" : "汉中市",
+        "areaList" : [
+          {
+            "code" : "610702",
+            "name" : "汉台区"
+          },
+          {
+            "code" : "610703",
+            "name" : "南郑区"
+          },
+          {
+            "code" : "610722",
+            "name" : "城固县"
+          },
+          {
+            "code" : "610723",
+            "name" : "洋县"
+          },
+          {
+            "code" : "610724",
+            "name" : "西乡县"
+          },
+          {
+            "code" : "610725",
+            "name" : "勉县"
+          },
+          {
+            "code" : "610726",
+            "name" : "宁强县"
+          },
+          {
+            "code" : "610727",
+            "name" : "略阳县"
+          },
+          {
+            "code" : "610728",
+            "name" : "镇巴县"
+          },
+          {
+            "code" : "610729",
+            "name" : "留坝县"
+          },
+          {
+            "code" : "610730",
+            "name" : "佛坪县"
+          }
+        ]
+      },
+      {
+        "code" : "610800",
+        "name" : "榆林市",
+        "areaList" : [
+          {
+            "code" : "610802",
+            "name" : "榆阳区"
+          },
+          {
+            "code" : "610803",
+            "name" : "横山区"
+          },
+          {
+            "code" : "610822",
+            "name" : "府谷县"
+          },
+          {
+            "code" : "610824",
+            "name" : "靖边县"
+          },
+          {
+            "code" : "610825",
+            "name" : "定边县"
+          },
+          {
+            "code" : "610826",
+            "name" : "绥德县"
+          },
+          {
+            "code" : "610827",
+            "name" : "米脂县"
+          },
+          {
+            "code" : "610828",
+            "name" : "佳县"
+          },
+          {
+            "code" : "610829",
+            "name" : "吴堡县"
+          },
+          {
+            "code" : "610830",
+            "name" : "清涧县"
+          },
+          {
+            "code" : "610831",
+            "name" : "子洲县"
+          },
+          {
+            "code" : "610881",
+            "name" : "神木市"
+          }
+        ]
+      },
+      {
+        "code" : "610900",
+        "name" : "安康市",
+        "areaList" : [
+          {
+            "code" : "610902",
+            "name" : "汉滨区"
+          },
+          {
+            "code" : "610921",
+            "name" : "汉阴县"
+          },
+          {
+            "code" : "610922",
+            "name" : "石泉县"
+          },
+          {
+            "code" : "610923",
+            "name" : "宁陕县"
+          },
+          {
+            "code" : "610924",
+            "name" : "紫阳县"
+          },
+          {
+            "code" : "610925",
+            "name" : "岚皋县"
+          },
+          {
+            "code" : "610926",
+            "name" : "平利县"
+          },
+          {
+            "code" : "610927",
+            "name" : "镇坪县"
+          },
+          {
+            "code" : "610929",
+            "name" : "白河县"
+          },
+          {
+            "code" : "610981",
+            "name" : "旬阳市"
+          }
+        ]
+      },
+      {
+        "code" : "611000",
+        "name" : "商洛市",
+        "areaList" : [
+          {
+            "code" : "611002",
+            "name" : "商州区"
+          },
+          {
+            "code" : "611021",
+            "name" : "洛南县"
+          },
+          {
+            "code" : "611022",
+            "name" : "丹凤县"
+          },
+          {
+            "code" : "611023",
+            "name" : "商南县"
+          },
+          {
+            "code" : "611024",
+            "name" : "山阳县"
+          },
+          {
+            "code" : "611025",
+            "name" : "镇安县"
+          },
+          {
+            "code" : "611026",
+            "name" : "柞水县"
+          }
+        ]
+      }
+    ]
+  },
+  {
+    "code" : "620000",
+    "name" : "甘肃省",
+    "cityList" : [
+      {
+        "code" : "620100",
+        "name" : "兰州市",
+        "areaList" : [
+          {
+            "code" : "620102",
+            "name" : "城关区"
+          },
+          {
+            "code" : "620103",
+            "name" : "七里河区"
+          },
+          {
+            "code" : "620104",
+            "name" : "西固区"
+          },
+          {
+            "code" : "620105",
+            "name" : "安宁区"
+          },
+          {
+            "code" : "620111",
+            "name" : "红古区"
+          },
+          {
+            "code" : "620121",
+            "name" : "永登县"
+          },
+          {
+            "code" : "620122",
+            "name" : "皋兰县"
+          },
+          {
+            "code" : "620123",
+            "name" : "榆中县"
+          }
+        ]
+      },
+      {
+        "code" : "620200",
+        "name" : "嘉峪关市",
+        "areaList" : [
+          {
+            "code" : "620200",
+            "name" : "峪泉镇"
+          },
+          {
+            "code" : "620200",
+            "name" : "新城镇"
+          },
+          {
+            "code" : "620200",
+            "name" : "文殊镇"
+          },
+          {
+            "code" : "620200",
+            "name" : "雄关街道"
+          },
+          {
+            "code" : "620200",
+            "name" : "钢城街道"
+          }
+        ]
+      },
+      {
+        "code" : "620300",
+        "name" : "金昌市",
+        "areaList" : [
+          {
+            "code" : "620302",
+            "name" : "金川区"
+          },
+          {
+            "code" : "620321",
+            "name" : "永昌县"
+          }
+        ]
+      },
+      {
+        "code" : "620400",
+        "name" : "白银市",
+        "areaList" : [
+          {
+            "code" : "620402",
+            "name" : "白银区"
+          },
+          {
+            "code" : "620403",
+            "name" : "平川区"
+          },
+          {
+            "code" : "620421",
+            "name" : "靖远县"
+          },
+          {
+            "code" : "620422",
+            "name" : "会宁县"
+          },
+          {
+            "code" : "620423",
+            "name" : "景泰县"
+          }
+        ]
+      },
+      {
+        "code" : "620500",
+        "name" : "天水市",
+        "areaList" : [
+          {
+            "code" : "620502",
+            "name" : "秦州区"
+          },
+          {
+            "code" : "620503",
+            "name" : "麦积区"
+          },
+          {
+            "code" : "620521",
+            "name" : "清水县"
+          },
+          {
+            "code" : "620522",
+            "name" : "秦安县"
+          },
+          {
+            "code" : "620523",
+            "name" : "甘谷县"
+          },
+          {
+            "code" : "620524",
+            "name" : "武山县"
+          },
+          {
+            "code" : "620525",
+            "name" : "张家川回族自治县"
+          }
+        ]
+      },
+      {
+        "code" : "620600",
+        "name" : "武威市",
+        "areaList" : [
+          {
+            "code" : "620602",
+            "name" : "凉州区"
+          },
+          {
+            "code" : "620621",
+            "name" : "民勤县"
+          },
+          {
+            "code" : "620622",
+            "name" : "古浪县"
+          },
+          {
+            "code" : "620623",
+            "name" : "天祝藏族自治县"
+          }
+        ]
+      },
+      {
+        "code" : "620700",
+        "name" : "张掖市",
+        "areaList" : [
+          {
+            "code" : "620702",
+            "name" : "甘州区"
+          },
+          {
+            "code" : "620721",
+            "name" : "肃南裕固族自治县"
+          },
+          {
+            "code" : "620722",
+            "name" : "民乐县"
+          },
+          {
+            "code" : "620723",
+            "name" : "临泽县"
+          },
+          {
+            "code" : "620724",
+            "name" : "高台县"
+          },
+          {
+            "code" : "620725",
+            "name" : "山丹县"
+          }
+        ]
+      },
+      {
+        "code" : "620800",
+        "name" : "平凉市",
+        "areaList" : [
+          {
+            "code" : "620802",
+            "name" : "崆峒区"
+          },
+          {
+            "code" : "620821",
+            "name" : "泾川县"
+          },
+          {
+            "code" : "620822",
+            "name" : "灵台县"
+          },
+          {
+            "code" : "620823",
+            "name" : "崇信县"
+          },
+          {
+            "code" : "620825",
+            "name" : "庄浪县"
+          },
+          {
+            "code" : "620826",
+            "name" : "静宁县"
+          },
+          {
+            "code" : "620881",
+            "name" : "华亭市"
+          }
+        ]
+      },
+      {
+        "code" : "620900",
+        "name" : "酒泉市",
+        "areaList" : [
+          {
+            "code" : "620902",
+            "name" : "肃州区"
+          },
+          {
+            "code" : "620921",
+            "name" : "金塔县"
+          },
+          {
+            "code" : "620922",
+            "name" : "瓜州县"
+          },
+          {
+            "code" : "620923",
+            "name" : "肃北蒙古族自治县"
+          },
+          {
+            "code" : "620924",
+            "name" : "阿克塞哈萨克族自治县"
+          },
+          {
+            "code" : "620981",
+            "name" : "玉门市"
+          },
+          {
+            "code" : "620982",
+            "name" : "敦煌市"
+          }
+        ]
+      },
+      {
+        "code" : "621000",
+        "name" : "庆阳市",
+        "areaList" : [
+          {
+            "code" : "621002",
+            "name" : "西峰区"
+          },
+          {
+            "code" : "621021",
+            "name" : "庆城县"
+          },
+          {
+            "code" : "621022",
+            "name" : "环县"
+          },
+          {
+            "code" : "621023",
+            "name" : "华池县"
+          },
+          {
+            "code" : "621024",
+            "name" : "合水县"
+          },
+          {
+            "code" : "621025",
+            "name" : "正宁县"
+          },
+          {
+            "code" : "621026",
+            "name" : "宁县"
+          },
+          {
+            "code" : "621027",
+            "name" : "镇原县"
+          }
+        ]
+      },
+      {
+        "code" : "621100",
+        "name" : "定西市",
+        "areaList" : [
+          {
+            "code" : "621102",
+            "name" : "安定区"
+          },
+          {
+            "code" : "621121",
+            "name" : "通渭县"
+          },
+          {
+            "code" : "621122",
+            "name" : "陇西县"
+          },
+          {
+            "code" : "621123",
+            "name" : "渭源县"
+          },
+          {
+            "code" : "621124",
+            "name" : "临洮县"
+          },
+          {
+            "code" : "621125",
+            "name" : "漳县"
+          },
+          {
+            "code" : "621126",
+            "name" : "岷县"
+          }
+        ]
+      },
+      {
+        "code" : "621200",
+        "name" : "陇南市",
+        "areaList" : [
+          {
+            "code" : "621202",
+            "name" : "武都区"
+          },
+          {
+            "code" : "621221",
+            "name" : "成县"
+          },
+          {
+            "code" : "621222",
+            "name" : "文县"
+          },
+          {
+            "code" : "621223",
+            "name" : "宕昌县"
+          },
+          {
+            "code" : "621224",
+            "name" : "康县"
+          },
+          {
+            "code" : "621225",
+            "name" : "西和县"
+          },
+          {
+            "code" : "621226",
+            "name" : "礼县"
+          },
+          {
+            "code" : "621227",
+            "name" : "徽县"
+          },
+          {
+            "code" : "621228",
+            "name" : "两当县"
+          }
+        ]
+      },
+      {
+        "code" : "622900",
+        "name" : "临夏回族自治州",
+        "areaList" : [
+          {
+            "code" : "622901",
+            "name" : "临夏市"
+          },
+          {
+            "code" : "622921",
+            "name" : "临夏县"
+          },
+          {
+            "code" : "622922",
+            "name" : "康乐县"
+          },
+          {
+            "code" : "622923",
+            "name" : "永靖县"
+          },
+          {
+            "code" : "622924",
+            "name" : "广河县"
+          },
+          {
+            "code" : "622925",
+            "name" : "和政县"
+          },
+          {
+            "code" : "622926",
+            "name" : "东乡族自治县"
+          },
+          {
+            "code" : "622927",
+            "name" : "积石山保安族东乡族撒拉族自治县"
+          }
+        ]
+      },
+      {
+        "code" : "623000",
+        "name" : "甘南藏族自治州",
+        "areaList" : [
+          {
+            "code" : "623001",
+            "name" : "合作市"
+          },
+          {
+            "code" : "623021",
+            "name" : "临潭县"
+          },
+          {
+            "code" : "623022",
+            "name" : "卓尼县"
+          },
+          {
+            "code" : "623023",
+            "name" : "舟曲县"
+          },
+          {
+            "code" : "623024",
+            "name" : "迭部县"
+          },
+          {
+            "code" : "623025",
+            "name" : "玛曲县"
+          },
+          {
+            "code" : "623026",
+            "name" : "碌曲县"
+          },
+          {
+            "code" : "623027",
+            "name" : "夏河县"
+          }
+        ]
+      }
+    ]
+  },
+  {
+    "code" : "630000",
+    "name" : "青海省",
+    "cityList" : [
+      {
+        "code" : "630100",
+        "name" : "西宁市",
+        "areaList" : [
+          {
+            "code" : "630102",
+            "name" : "城东区"
+          },
+          {
+            "code" : "630103",
+            "name" : "城中区"
+          },
+          {
+            "code" : "630104",
+            "name" : "城西区"
+          },
+          {
+            "code" : "630105",
+            "name" : "城北区"
+          },
+          {
+            "code" : "630106",
+            "name" : "湟中区"
+          },
+          {
+            "code" : "630121",
+            "name" : "大通回族土族自治县"
+          },
+          {
+            "code" : "630123",
+            "name" : "湟源县"
+          }
+        ]
+      },
+      {
+        "code" : "630200",
+        "name" : "海东市",
+        "areaList" : [
+          {
+            "code" : "630202",
+            "name" : "乐都区"
+          },
+          {
+            "code" : "630203",
+            "name" : "平安区"
+          },
+          {
+            "code" : "630222",
+            "name" : "民和回族土族自治县"
+          },
+          {
+            "code" : "630223",
+            "name" : "互助土族自治县"
+          },
+          {
+            "code" : "630224",
+            "name" : "化隆回族自治县"
+          },
+          {
+            "code" : "630225",
+            "name" : "循化撒拉族自治县"
+          }
+        ]
+      },
+      {
+        "code" : "632200",
+        "name" : "海北藏族自治州",
+        "areaList" : [
+          {
+            "code" : "632221",
+            "name" : "门源回族自治县"
+          },
+          {
+            "code" : "632222",
+            "name" : "祁连县"
+          },
+          {
+            "code" : "632223",
+            "name" : "海晏县"
+          },
+          {
+            "code" : "632224",
+            "name" : "刚察县"
+          }
+        ]
+      },
+      {
+        "code" : "632300",
+        "name" : "黄南藏族自治州",
+        "areaList" : [
+          {
+            "code" : "632301",
+            "name" : "同仁市"
+          },
+          {
+            "code" : "632322",
+            "name" : "尖扎县"
+          },
+          {
+            "code" : "632323",
+            "name" : "泽库县"
+          },
+          {
+            "code" : "632324",
+            "name" : "河南蒙古族自治县"
+          }
+        ]
+      },
+      {
+        "code" : "632500",
+        "name" : "海南藏族自治州",
+        "areaList" : [
+          {
+            "code" : "632521",
+            "name" : "共和县"
+          },
+          {
+            "code" : "632522",
+            "name" : "同德县"
+          },
+          {
+            "code" : "632523",
+            "name" : "贵德县"
+          },
+          {
+            "code" : "632524",
+            "name" : "兴海县"
+          },
+          {
+            "code" : "632525",
+            "name" : "贵南县"
+          }
+        ]
+      },
+      {
+        "code" : "632600",
+        "name" : "果洛藏族自治州",
+        "areaList" : [
+          {
+            "code" : "632621",
+            "name" : "玛沁县"
+          },
+          {
+            "code" : "632622",
+            "name" : "班玛县"
+          },
+          {
+            "code" : "632623",
+            "name" : "甘德县"
+          },
+          {
+            "code" : "632624",
+            "name" : "达日县"
+          },
+          {
+            "code" : "632625",
+            "name" : "久治县"
+          },
+          {
+            "code" : "632626",
+            "name" : "玛多县"
+          }
+        ]
+      },
+      {
+        "code" : "632700",
+        "name" : "玉树藏族自治州",
+        "areaList" : [
+          {
+            "code" : "632701",
+            "name" : "玉树市"
+          },
+          {
+            "code" : "632722",
+            "name" : "杂多县"
+          },
+          {
+            "code" : "632723",
+            "name" : "称多县"
+          },
+          {
+            "code" : "632724",
+            "name" : "治多县"
+          },
+          {
+            "code" : "632725",
+            "name" : "囊谦县"
+          },
+          {
+            "code" : "632726",
+            "name" : "曲麻莱县"
+          }
+        ]
+      },
+      {
+        "code" : "632800",
+        "name" : "海西蒙古族藏族自治州",
+        "areaList" : [
+          {
+            "code" : "632801",
+            "name" : "格尔木市"
+          },
+          {
+            "code" : "632802",
+            "name" : "德令哈市"
+          },
+          {
+            "code" : "632803",
+            "name" : "茫崖市"
+          },
+          {
+            "code" : "632821",
+            "name" : "乌兰县"
+          },
+          {
+            "code" : "632822",
+            "name" : "都兰县"
+          },
+          {
+            "code" : "632823",
+            "name" : "天峻县"
+          },
+          {
+            "code" : "632825",
+            "name" : "海西蒙古族藏族自治州直辖"
+          }
+        ]
+      }
+    ]
+  },
+  {
+    "code" : "640000",
+    "name" : "宁夏回族自治区",
+    "cityList" : [
+      {
+        "code" : "640100",
+        "name" : "银川市",
+        "areaList" : [
+          {
+            "code" : "640104",
+            "name" : "兴庆区"
+          },
+          {
+            "code" : "640105",
+            "name" : "西夏区"
+          },
+          {
+            "code" : "640106",
+            "name" : "金凤区"
+          },
+          {
+            "code" : "640121",
+            "name" : "永宁县"
+          },
+          {
+            "code" : "640122",
+            "name" : "贺兰县"
+          },
+          {
+            "code" : "640181",
+            "name" : "灵武市"
+          }
+        ]
+      },
+      {
+        "code" : "640200",
+        "name" : "石嘴山市",
+        "areaList" : [
+          {
+            "code" : "640202",
+            "name" : "大武口区"
+          },
+          {
+            "code" : "640205",
+            "name" : "惠农区"
+          },
+          {
+            "code" : "640221",
+            "name" : "平罗县"
+          }
+        ]
+      },
+      {
+        "code" : "640300",
+        "name" : "吴忠市",
+        "areaList" : [
+          {
+            "code" : "640302",
+            "name" : "利通区"
+          },
+          {
+            "code" : "640303",
+            "name" : "红寺堡区"
+          },
+          {
+            "code" : "640323",
+            "name" : "盐池县"
+          },
+          {
+            "code" : "640324",
+            "name" : "同心县"
+          },
+          {
+            "code" : "640381",
+            "name" : "青铜峡市"
+          }
+        ]
+      },
+      {
+        "code" : "640400",
+        "name" : "固原市",
+        "areaList" : [
+          {
+            "code" : "640402",
+            "name" : "原州区"
+          },
+          {
+            "code" : "640422",
+            "name" : "西吉县"
+          },
+          {
+            "code" : "640423",
+            "name" : "隆德县"
+          },
+          {
+            "code" : "640424",
+            "name" : "泾源县"
+          },
+          {
+            "code" : "640425",
+            "name" : "彭阳县"
+          }
+        ]
+      },
+      {
+        "code" : "640500",
+        "name" : "中卫市",
+        "areaList" : [
+          {
+            "code" : "640502",
+            "name" : "沙坡头区"
+          },
+          {
+            "code" : "640521",
+            "name" : "中宁县"
+          },
+          {
+            "code" : "640522",
+            "name" : "海原县"
+          }
+        ]
+      }
+    ]
+  },
+  {
+    "code" : "650000",
+    "name" : "新疆维吾尔自治区",
+    "cityList" : [
+      {
+        "code" : "650100",
+        "name" : "乌鲁木齐市",
+        "areaList" : [
+          {
+            "code" : "650102",
+            "name" : "天山区"
+          },
+          {
+            "code" : "650103",
+            "name" : "沙依巴克区"
+          },
+          {
+            "code" : "650104",
+            "name" : "新市区"
+          },
+          {
+            "code" : "650105",
+            "name" : "水磨沟区"
+          },
+          {
+            "code" : "650106",
+            "name" : "头屯河区"
+          },
+          {
+            "code" : "650107",
+            "name" : "达坂城区"
+          },
+          {
+            "code" : "650109",
+            "name" : "米东区"
+          },
+          {
+            "code" : "650121",
+            "name" : "乌鲁木齐县"
+          }
+        ]
+      },
+      {
+        "code" : "650200",
+        "name" : "克拉玛依市",
+        "areaList" : [
+          {
+            "code" : "650202",
+            "name" : "独山子区"
+          },
+          {
+            "code" : "650203",
+            "name" : "克拉玛依区"
+          },
+          {
+            "code" : "650204",
+            "name" : "白碱滩区"
+          },
+          {
+            "code" : "650205",
+            "name" : "乌尔禾区"
+          }
+        ]
+      },
+      {
+        "code" : "650400",
+        "name" : "吐鲁番市",
+        "areaList" : [
+          {
+            "code" : "650402",
+            "name" : "高昌区"
+          },
+          {
+            "code" : "650421",
+            "name" : "鄯善县"
+          },
+          {
+            "code" : "650422",
+            "name" : "托克逊县"
+          }
+        ]
+      },
+      {
+        "code" : "650500",
+        "name" : "哈密市",
+        "areaList" : [
+          {
+            "code" : "650502",
+            "name" : "伊州区"
+          },
+          {
+            "code" : "650521",
+            "name" : "巴里坤哈萨克自治县"
+          },
+          {
+            "code" : "650522",
+            "name" : "伊吾县"
+          }
+        ]
+      },
+      {
+        "code" : "652300",
+        "name" : "昌吉回族自治州",
+        "areaList" : [
+          {
+            "code" : "652301",
+            "name" : "昌吉市"
+          },
+          {
+            "code" : "652302",
+            "name" : "阜康市"
+          },
+          {
+            "code" : "652323",
+            "name" : "呼图壁县"
+          },
+          {
+            "code" : "652324",
+            "name" : "玛纳斯县"
+          },
+          {
+            "code" : "652325",
+            "name" : "奇台县"
+          },
+          {
+            "code" : "652327",
+            "name" : "吉木萨尔县"
+          },
+          {
+            "code" : "652328",
+            "name" : "木垒哈萨克自治县"
+          }
+        ]
+      },
+      {
+        "code" : "652700",
+        "name" : "博尔塔拉蒙古自治州",
+        "areaList" : [
+          {
+            "code" : "652701",
+            "name" : "博乐市"
+          },
+          {
+            "code" : "652702",
+            "name" : "阿拉山口市"
+          },
+          {
+            "code" : "652722",
+            "name" : "精河县"
+          },
+          {
+            "code" : "652723",
+            "name" : "温泉县"
+          }
+        ]
+      },
+      {
+        "code" : "652800",
+        "name" : "巴音郭楞蒙古自治州",
+        "areaList" : [
+          {
+            "code" : "652801",
+            "name" : "库尔勒市"
+          },
+          {
+            "code" : "652822",
+            "name" : "轮台县"
+          },
+          {
+            "code" : "652823",
+            "name" : "尉犁县"
+          },
+          {
+            "code" : "652824",
+            "name" : "若羌县"
+          },
+          {
+            "code" : "652825",
+            "name" : "且末县"
+          },
+          {
+            "code" : "652826",
+            "name" : "焉耆回族自治县"
+          },
+          {
+            "code" : "652827",
+            "name" : "和静县"
+          },
+          {
+            "code" : "652828",
+            "name" : "和硕县"
+          },
+          {
+            "code" : "652829",
+            "name" : "博湖县"
+          }
+        ]
+      },
+      {
+        "code" : "652900",
+        "name" : "阿克苏地区",
+        "areaList" : [
+          {
+            "code" : "652901",
+            "name" : "阿克苏市"
+          },
+          {
+            "code" : "652902",
+            "name" : "库车市"
+          },
+          {
+            "code" : "652922",
+            "name" : "温宿县"
+          },
+          {
+            "code" : "652924",
+            "name" : "沙雅县"
+          },
+          {
+            "code" : "652925",
+            "name" : "新和县"
+          },
+          {
+            "code" : "652926",
+            "name" : "拜城县"
+          },
+          {
+            "code" : "652927",
+            "name" : "乌什县"
+          },
+          {
+            "code" : "652928",
+            "name" : "阿瓦提县"
+          },
+          {
+            "code" : "652929",
+            "name" : "柯坪县"
+          }
+        ]
+      },
+      {
+        "code" : "653000",
+        "name" : "克孜勒苏柯尔克孜自治州",
+        "areaList" : [
+          {
+            "code" : "653001",
+            "name" : "阿图什市"
+          },
+          {
+            "code" : "653022",
+            "name" : "阿克陶县"
+          },
+          {
+            "code" : "653023",
+            "name" : "阿合奇县"
+          },
+          {
+            "code" : "653024",
+            "name" : "乌恰县"
+          }
+        ]
+      },
+      {
+        "code" : "653100",
+        "name" : "喀什地区",
+        "areaList" : [
+          {
+            "code" : "653101",
+            "name" : "喀什市"
+          },
+          {
+            "code" : "653121",
+            "name" : "疏附县"
+          },
+          {
+            "code" : "653122",
+            "name" : "疏勒县"
+          },
+          {
+            "code" : "653123",
+            "name" : "英吉沙县"
+          },
+          {
+            "code" : "653124",
+            "name" : "泽普县"
+          },
+          {
+            "code" : "653125",
+            "name" : "莎车县"
+          },
+          {
+            "code" : "653126",
+            "name" : "叶城县"
+          },
+          {
+            "code" : "653127",
+            "name" : "麦盖提县"
+          },
+          {
+            "code" : "653128",
+            "name" : "岳普湖县"
+          },
+          {
+            "code" : "653129",
+            "name" : "伽师县"
+          },
+          {
+            "code" : "653130",
+            "name" : "巴楚县"
+          },
+          {
+            "code" : "653131",
+            "name" : "塔什库尔干塔吉克自治县"
+          }
+        ]
+      },
+      {
+        "code" : "653200",
+        "name" : "和田地区",
+        "areaList" : [
+          {
+            "code" : "653201",
+            "name" : "和田市"
+          },
+          {
+            "code" : "653221",
+            "name" : "和田县"
+          },
+          {
+            "code" : "653222",
+            "name" : "墨玉县"
+          },
+          {
+            "code" : "653223",
+            "name" : "皮山县"
+          },
+          {
+            "code" : "653224",
+            "name" : "洛浦县"
+          },
+          {
+            "code" : "653225",
+            "name" : "策勒县"
+          },
+          {
+            "code" : "653226",
+            "name" : "于田县"
+          },
+          {
+            "code" : "653227",
+            "name" : "民丰县"
+          }
+        ]
+      },
+      {
+        "code" : "654000",
+        "name" : "伊犁哈萨克自治州",
+        "areaList" : [
+          {
+            "code" : "654002",
+            "name" : "伊宁市"
+          },
+          {
+            "code" : "654003",
+            "name" : "奎屯市"
+          },
+          {
+            "code" : "654004",
+            "name" : "霍尔果斯市"
+          },
+          {
+            "code" : "654021",
+            "name" : "伊宁县"
+          },
+          {
+            "code" : "654022",
+            "name" : "察布查尔锡伯自治县"
+          },
+          {
+            "code" : "654023",
+            "name" : "霍城县"
+          },
+          {
+            "code" : "654024",
+            "name" : "巩留县"
+          },
+          {
+            "code" : "654025",
+            "name" : "新源县"
+          },
+          {
+            "code" : "654026",
+            "name" : "昭苏县"
+          },
+          {
+            "code" : "654027",
+            "name" : "特克斯县"
+          },
+          {
+            "code" : "654028",
+            "name" : "尼勒克县"
+          }
+        ]
+      },
+      {
+        "code" : "654200",
+        "name" : "塔城地区",
+        "areaList" : [
+          {
+            "code" : "654201",
+            "name" : "塔城市"
+          },
+          {
+            "code" : "654202",
+            "name" : "乌苏市"
+          },
+          {
+            "code" : "654203",
+            "name" : "沙湾市"
+          },
+          {
+            "code" : "654221",
+            "name" : "额敏县"
+          },
+          {
+            "code" : "654224",
+            "name" : "托里县"
+          },
+          {
+            "code" : "654225",
+            "name" : "裕民县"
+          },
+          {
+            "code" : "654226",
+            "name" : "和布克赛尔蒙古自治县"
+          }
+        ]
+      },
+      {
+        "code" : "654300",
+        "name" : "阿勒泰地区",
+        "areaList" : [
+          {
+            "code" : "654301",
+            "name" : "阿勒泰市"
+          },
+          {
+            "code" : "654321",
+            "name" : "布尔津县"
+          },
+          {
+            "code" : "654322",
+            "name" : "富蕴县"
+          },
+          {
+            "code" : "654323",
+            "name" : "福海县"
+          },
+          {
+            "code" : "654324",
+            "name" : "哈巴河县"
+          },
+          {
+            "code" : "654325",
+            "name" : "青河县"
+          },
+          {
+            "code" : "654326",
+            "name" : "吉木乃县"
+          }
+        ]
+      },
+      {
+        "code" : "659001",
+        "name" : "石河子市",
+        "areaList" : [
+          {
+            "code" : "659001",
+            "name" : "兵团一五二团"
+          },
+          {
+            "code" : "659001",
+            "name" : "红山街道"
+          },
+          {
+            "code" : "659001",
+            "name" : "向阳街道"
+          },
+          {
+            "code" : "659001",
+            "name" : "兵团一四四团"
+          },
+          {
+            "code" : "659001",
+            "name" : "东城街道"
+          },
+          {
+            "code" : "659001",
+            "name" : "老街街道"
+          },
+          {
+            "code" : "659001",
+            "name" : "石河子镇"
+          },
+          {
+            "code" : "659001",
+            "name" : "北泉镇"
+          },
+          {
+            "code" : "659001",
+            "name" : "新城街道"
+          }
+        ]
+      },
+      {
+        "code" : "659002",
+        "name" : "阿拉尔市",
+        "areaList" : [
+          {
+            "code" : "659002",
+            "name" : "玛滩镇"
+          },
+          {
+            "code" : "659002",
+            "name" : "花桥镇"
+          },
+          {
+            "code" : "659002",
+            "name" : "沙河镇"
+          },
+          {
+            "code" : "659002",
+            "name" : "青松路街道"
+          },
+          {
+            "code" : "659002",
+            "name" : "托喀依乡"
+          },
+          {
+            "code" : "659002",
+            "name" : "塔门镇"
+          },
+          {
+            "code" : "659002",
+            "name" : "南口街道"
+          },
+          {
+            "code" : "659002",
+            "name" : "金杨镇"
+          },
+          {
+            "code" : "659002",
+            "name" : "新井子镇"
+          },
+          {
+            "code" : "659002",
+            "name" : "金银川镇"
+          },
+          {
+            "code" : "659002",
+            "name" : "甘泉镇"
+          },
+          {
+            "code" : "659002",
+            "name" : "兵团农一师沙井子水利管理处"
+          },
+          {
+            "code" : "659002",
+            "name" : "新开岭镇"
+          },
+          {
+            "code" : "659002",
+            "name" : "幸福镇"
+          },
+          {
+            "code" : "659002",
+            "name" : "塔南镇"
+          },
+          {
+            "code" : "659002",
+            "name" : "金银川路街道"
+          },
+          {
+            "code" : "659002",
+            "name" : "昌安镇"
+          },
+          {
+            "code" : "659002",
+            "name" : "幸福路街道"
+          },
+          {
+            "code" : "659002",
+            "name" : "双城镇"
+          }
+        ]
+      },
+      {
+        "code" : "659003",
+        "name" : "图木舒克市",
+        "areaList" : [
+          {
+            "code" : "659003",
+            "name" : "海安镇"
+          },
+          {
+            "code" : "659003",
+            "name" : "唐驿镇"
+          },
+          {
+            "code" : "659003",
+            "name" : "前海街道"
+          },
+          {
+            "code" : "659003",
+            "name" : "喀拉拜勒镇"
+          },
+          {
+            "code" : "659003",
+            "name" : "齐干却勒街道"
+          },
+          {
+            "code" : "659003",
+            "name" : "金胡杨镇"
+          },
+          {
+            "code" : "659003",
+            "name" : "夏河镇"
+          },
+          {
+            "code" : "659003",
+            "name" : "永安镇"
+          },
+          {
+            "code" : "659003",
+            "name" : "草湖镇"
+          },
+          {
+            "code" : "659003",
+            "name" : "永安坝街道"
+          }
+        ]
+      },
+      {
+        "code" : "659004",
+        "name" : "五家渠市",
+        "areaList" : [
+          {
+            "code" : "659004",
+            "name" : "梧桐镇"
+          },
+          {
+            "code" : "659004",
+            "name" : "人民路街道"
+          },
+          {
+            "code" : "659004",
+            "name" : "兵团一零一团"
+          },
+          {
+            "code" : "659004",
+            "name" : "蔡家湖镇"
+          },
+          {
+            "code" : "659004",
+            "name" : "青湖路街道"
+          },
+          {
+            "code" : "659004",
+            "name" : "军垦路街道"
+          }
+        ]
+      },
+      {
+        "code" : "659005",
+        "name" : "北屯市",
+        "areaList" : [
+          {
+            "code" : "659005",
+            "name" : "海川镇"
+          },
+          {
+            "code" : "659005",
+            "name" : "丰庆镇"
+          },
+          {
+            "code" : "659005",
+            "name" : "双渠镇"
+          },
+          {
+            "code" : "659005",
+            "name" : "北屯镇"
+          }
+        ]
+      },
+      {
+        "code" : "659006",
+        "name" : "铁门关市",
+        "areaList" : [
+          {
+            "code" : "659006",
+            "name" : "博古其镇"
+          },
+          {
+            "code" : "659006",
+            "name" : "双丰镇"
+          }
+        ]
+      },
+      {
+        "code" : "659007",
+        "name" : "双河市",
+        "areaList" : [
+          {
+            "code" : "659007",
+            "name" : "兵团八十九团"
+          },
+          {
+            "code" : "659007",
+            "name" : "博河镇"
+          },
+          {
+            "code" : "659007",
+            "name" : "双桥镇"
+          },
+          {
+            "code" : "659007",
+            "name" : "石峪镇"
+          },
+          {
+            "code" : "659007",
+            "name" : "双乐镇"
+          }
+        ]
+      },
+      {
+        "code" : "659008",
+        "name" : "可克达拉市",
+        "areaList" : [
+          {
+            "code" : "659008",
+            "name" : "长丰镇"
+          },
+          {
+            "code" : "659008",
+            "name" : "金屯镇"
+          },
+          {
+            "code" : "659008",
+            "name" : "苇湖镇"
+          },
+          {
+            "code" : "659008",
+            "name" : "都拉塔口岸"
+          },
+          {
+            "code" : "659008",
+            "name" : "榆树庄镇"
+          },
+          {
+            "code" : "659008",
+            "name" : "金梁镇"
+          }
+        ]
+      },
+      {
+        "code" : "659009",
+        "name" : "昆玉市",
+        "areaList" : [
+          {
+            "code" : "659009",
+            "name" : "老兵镇"
+          },
+          {
+            "code" : "659009",
+            "name" : "昆牧镇"
+          },
+          {
+            "code" : "659009",
+            "name" : "昆泉镇"
+          },
+          {
+            "code" : "659009",
+            "name" : "兵团二二四团"
+          }
+        ]
+      },
+      {
+        "code" : "659010",
+        "name" : "胡杨河市",
+        "areaList" : [
+          {
+            "code" : "659010",
+            "name" : "兵团一三零团"
+          },
+          {
+            "code" : "659010",
+            "name" : "兵团一二九团"
+          }
+        ]
+      },
+      {
+        "code" : "659011",
+        "name" : "新星市",
+        "areaList" : [
+          {
+            "code" : "659011",
+            "name" : "兵团红星四场"
+          },
+          {
+            "code" : "659011",
+            "name" : "兵团红星一场"
+          },
+          {
+            "code" : "659011",
+            "name" : "兵团黄田农场"
+          }
+        ]
+      }
+    ]
+  },
+  {
+    "code" : "710000",
+    "name" : "台湾省",
+    "cityList" : [
+
+    ]
+  },
+  {
+    "code" : "810000",
+    "name" : "香港特别行政区",
+    "cityList" : [
+      {
+        "code" : "810001",
+        "name" : "中西区"
+      },
+      {
+        "code" : "810002",
+        "name" : "湾仔区"
+      },
+      {
+        "code" : "810003",
+        "name" : "东区"
+      },
+      {
+        "code" : "810004",
+        "name" : "南区"
+      },
+      {
+        "code" : "810005",
+        "name" : "油尖旺区"
+      },
+      {
+        "code" : "810006",
+        "name" : "深水埗区"
+      },
+      {
+        "code" : "810007",
+        "name" : "九龙城区"
+      },
+      {
+        "code" : "810008",
+        "name" : "黄大仙区"
+      },
+      {
+        "code" : "810009",
+        "name" : "观塘区"
+      },
+      {
+        "code" : "810010",
+        "name" : "荃湾区"
+      },
+      {
+        "code" : "810011",
+        "name" : "屯门区"
+      },
+      {
+        "code" : "810012",
+        "name" : "元朗区"
+      },
+      {
+        "code" : "810013",
+        "name" : "北区"
+      },
+      {
+        "code" : "810014",
+        "name" : "大埔区"
+      },
+      {
+        "code" : "810015",
+        "name" : "西贡区"
+      },
+      {
+        "code" : "810016",
+        "name" : "沙田区"
+      },
+      {
+        "code" : "810017",
+        "name" : "葵青区"
+      },
+      {
+        "code" : "810018",
+        "name" : "离岛区"
+      }
+    ]
+  },
+  {
+    "code" : "820000",
+    "name" : "澳门特别行政区",
+    "cityList" : [
+      {
+        "code" : "820001",
+        "name" : "花地玛堂区"
+      },
+      {
+        "code" : "820002",
+        "name" : "花王堂区"
+      },
+      {
+        "code" : "820003",
+        "name" : "望德堂区"
+      },
+      {
+        "code" : "820004",
+        "name" : "大堂区"
+      },
+      {
+        "code" : "820005",
+        "name" : "风顺堂区"
+      },
+      {
+        "code" : "820006",
+        "name" : "嘉模堂区"
+      },
+      {
+        "code" : "820007",
+        "name" : "路氹填海区"
+      },
+      {
+        "code" : "820008",
+        "name" : "圣方济各堂区"
+      }
+    ]
+  }
+]
+

+ 134 - 0
Pods/BRPickerView/BRPickerView/Deprecated/AddressPickerView/BRAddressPickerView.h

@@ -0,0 +1,134 @@
+//
+//  BRAddressPickerView.h
+//  BRPickerViewDemo
+//
+//  Created by renbo on 2017/8/11.
+//  Copyright © 2017 irenb. All rights reserved.
+//
+//  最新代码下载地址:https://github.com/agiapp/BRPickerView
+
+#import "BRBaseView.h"
+#import "BRAddressModel.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+/// 地址选择器类型
+typedef NS_ENUM(NSInteger, BRAddressPickerMode) {
+    /** 显示【省市区】(默认) */
+    BRAddressPickerModeArea,
+    /** 显示【省市】 */
+    BRAddressPickerModeCity,
+    /** 显示【省】 */
+    BRAddressPickerModeProvince
+};
+
+typedef void(^BRAddressResultBlock)(BRProvinceModel * _Nullable province, BRCityModel * _Nullable city, BRAreaModel * _Nullable area);
+
+// BRAddressPickerView 组件已废弃,请使用 BRTextPickerView 组件进行替换,具体使用请参见 README.md
+//__attribute__((deprecated("Use 'BRTextPickerView' instead.")))
+@interface BRAddressPickerView : BRBaseView
+
+/**
+ //////////////////////////////////////////////////////////////////////////
+ ///
+ ///   【用法一】
+ ///    特点:灵活,扩展性强(推荐使用!)
+ ///
+ ////////////////////////////////////////////////////////////////////////*/
+
+/** 地址选择器显示类型 */
+@property (nonatomic, assign) BRAddressPickerMode pickerMode;
+
+/** 默认选中的位置(1.传索引数组,如:@[@10, @0, @4]) */
+@property (nullable, nonatomic, copy) NSArray <NSNumber *> *selectIndexs;
+/** 默认选中的位置(2.传值数组,如:@[@"浙江省", @"杭州市", @"西湖区"]) */
+@property (nullable, nonatomic, copy) NSArray <NSString *> *selectValues;
+
+/** 选择结果的回调 */
+@property (nullable, nonatomic, copy) BRAddressResultBlock resultBlock;
+
+/** 滚动选择时触发的回调 */
+@property (nullable, nonatomic, copy) BRAddressResultBlock changeBlock;
+
+/** 判断选择器是否处于滚动中。可以用于解决快速滑动选择器,在滚动结束前秒选确定按钮,出现显示不对的问题。*/
+@property (nonatomic, readonly, assign, getter=isRolling) BOOL rolling;
+
+/**
+ *  地区数据源(不传或为nil,默认就获取本地 BRCity.json 文件的数据)
+ *  本地 BRCity.json 文件的数据来源于高德地图:https://restapi.amap.com/v3/config/district?key=xxxxxxxxxxxxx&subdistrict=3
+ *
+ *  1.可以传 JSON数组,要注意 层级结构 和 key 要与 BRCity.json 保持一致
+ *  2.可以传 模型数组(NSArray <BRProvinceModel *> * 类型),自己解析数据源 只需要注意层级结构就行
+ */
+@property (nullable, nonatomic, copy) NSArray *dataSourceArr;
+
+/// 初始化地址选择器
+/// @param pickerMode 地址选择器显示类型
+- (instancetype)initWithPickerMode:(BRAddressPickerMode)pickerMode;
+
+/// 弹出选择器视图
+- (void)show;
+
+/// 关闭选择器视图
+- (void)dismiss;
+
+
+
+
+//================================================= 华丽的分割线 =================================================
+
+
+
+
+/**
+ //////////////////////////////////////////////////////////////////////////
+ ///
+ ///   【用法二】:快捷使用,直接选择下面其中的一个方法进行使用
+ ///    特点:快捷,方便
+ ///
+ ////////////////////////////////////////////////////////////////////////*/
+
+/**
+ *  1.显示地址选择器
+ *
+ *  @param selectIndexs             默认选中的值(传索引数组,如:@[@10, @0, @4])
+ *  @param resultBlock              选择后的回调
+ *
+ */
++ (void)showAddressPickerWithSelectIndexs:(nullable NSArray <NSNumber *> *)selectIndexs
+                              resultBlock:(nullable BRAddressResultBlock)resultBlock;
+
+/**
+ *  2.显示地址选择器
+ *
+ *  @param mode                     地址选择器显示类型
+ *  @param selectIndexs             默认选中的值(传索引数组,如:@[@10, @0, @4])
+ *  @param isAutoSelect             是否自动选择,即滚动选择器后就执行结果回调,默认为 NO
+ *  @param resultBlock              选择后的回调
+ *
+ */
++ (void)showAddressPickerWithMode:(BRAddressPickerMode)mode
+                     selectIndexs:(nullable NSArray <NSNumber *> *)selectIndexs
+                     isAutoSelect:(BOOL)isAutoSelect
+                      resultBlock:(nullable BRAddressResultBlock)resultBlock;
+
+/**
+ *  3.显示地址选择器
+ *
+ *  @param mode                     地址选择器显示类型
+ *  @param dataSource               地区数据源
+ *  @param selectIndexs             默认选中的值(传索引数组,如:@[@10, @0, @4])
+ *  @param isAutoSelect             是否自动选择,即滚动选择器后就执行结果回调,默认为 NO
+ *  @param resultBlock              选择后的回调
+ *
+ */
++ (void)showAddressPickerWithMode:(BRAddressPickerMode)mode
+                       dataSource:(nullable NSArray *)dataSource
+                     selectIndexs:(nullable NSArray <NSNumber *> *)selectIndexs
+                     isAutoSelect:(BOOL)isAutoSelect
+                      resultBlock:(nullable BRAddressResultBlock)resultBlock;
+
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 640 - 0
Pods/BRPickerView/BRPickerView/Deprecated/AddressPickerView/BRAddressPickerView.m

@@ -0,0 +1,640 @@
+//
+//  BRAddressPickerView.m
+//  BRPickerViewDemo
+//
+//  Created by renbo on 2017/8/11.
+//  Copyright © 2017 irenb. All rights reserved.
+//
+//  最新代码下载地址:https://github.com/agiapp/BRPickerView
+
+#import "BRAddressPickerView.h"
+#import "NSBundle+BRPickerView.h"
+
+@interface BRAddressPickerView ()<UIPickerViewDataSource, UIPickerViewDelegate>
+// 地址选择器
+@property (nonatomic, strong) UIPickerView *pickerView;
+// 省模型数组
+@property(nonatomic, copy) NSArray *provinceModelArr;
+// 市模型数组
+@property(nonatomic, copy) NSArray *cityModelArr;
+// 区模型数组
+@property(nonatomic, copy) NSArray *areaModelArr;
+// 选中的省
+@property(nonatomic, strong) BRProvinceModel *selectProvinceModel;
+// 选中的市
+@property(nonatomic, strong) BRCityModel *selectCityModel;
+// 选中的区
+@property(nonatomic, strong) BRAreaModel *selectAreaModel;
+// 记录省选中的位置
+@property(nonatomic, assign) NSInteger provinceIndex;
+// 记录市选中的位置
+@property(nonatomic, assign) NSInteger cityIndex;
+// 记录区选中的位置
+@property(nonatomic, assign) NSInteger areaIndex;
+
+// 记录滚动中的位置
+@property(nonatomic, assign) NSInteger rollingComponent;
+@property(nonatomic, assign) NSInteger rollingRow;
+
+@property (nonatomic, copy) NSArray <NSString *>* mSelectValues;
+
+@end
+
+@implementation BRAddressPickerView
+
+#pragma mark - 1.显示地址选择器
++ (void)showAddressPickerWithSelectIndexs:(NSArray <NSNumber *>*)selectIndexs
+                              resultBlock:(BRAddressResultBlock)resultBlock {
+    [self showAddressPickerWithMode:BRAddressPickerModeArea dataSource:nil selectIndexs:selectIndexs isAutoSelect:NO resultBlock:resultBlock];
+}
+
+#pragma mark - 2.显示地址选择器
++ (void)showAddressPickerWithMode:(BRAddressPickerMode)mode
+                     selectIndexs:(NSArray <NSNumber *>*)selectIndexs
+                     isAutoSelect:(BOOL)isAutoSelect
+                      resultBlock:(BRAddressResultBlock)resultBlock {
+    [self showAddressPickerWithMode:mode dataSource:nil selectIndexs:selectIndexs isAutoSelect:isAutoSelect resultBlock:resultBlock];
+}
+
+
+#pragma mark - 3.显示地址选择器
++ (void)showAddressPickerWithMode:(BRAddressPickerMode)mode
+                       dataSource:(NSArray *)dataSource
+                     selectIndexs:(NSArray <NSNumber *>*)selectIndexs
+                     isAutoSelect:(BOOL)isAutoSelect
+                      resultBlock:(BRAddressResultBlock)resultBlock {
+    // 创建地址选择器
+    BRAddressPickerView *addressPickerView = [[BRAddressPickerView alloc] initWithPickerMode:mode];
+    addressPickerView.dataSourceArr = dataSource;
+    addressPickerView.selectIndexs = selectIndexs;
+    addressPickerView.isAutoSelect = isAutoSelect;
+    addressPickerView.resultBlock = resultBlock;
+    // 显示
+    [addressPickerView show];
+}
+
+#pragma mark - 初始化地址选择器
+- (instancetype)initWithPickerMode:(BRAddressPickerMode)pickerMode {
+    if (self = [super init]) {
+        self.pickerMode = pickerMode;
+    }
+    return self;
+}
+
+#pragma mark - 处理选择器数据
+- (void)handlerPickerData {
+    if (self.dataSourceArr && self.dataSourceArr.count > 0) {
+        id item = [self.dataSourceArr firstObject];
+        // 如果传的值是解析好的模型数组
+        if ([item isKindOfClass:[BRProvinceModel class]]) {
+            self.provinceModelArr = self.dataSourceArr;
+        } else {
+            self.provinceModelArr = [self getProvinceModelArr:self.dataSourceArr];
+        }
+    } else {
+        // 如果外部没有传入地区数据源,就使用本地的数据源
+        NSArray *dataSource = [self br_addressJsonArray];
+        
+        if (!dataSource || dataSource.count == 0) {
+            return;
+        }
+        self.dataSourceArr = dataSource;
+        self.provinceModelArr = [self getProvinceModelArr:self.dataSourceArr];
+    }
+    
+    // 设置默认值
+    [self handlerDefaultSelectValue];
+}
+
+#pragma mark - 获取城市JSON数据
+- (NSArray *)br_addressJsonArray {
+    static NSArray *cityArray = nil;
+    if (!cityArray) {
+        // 获取 BRAddressPickerView.bundle
+        NSBundle *containnerBundle = [NSBundle bundleForClass:[BRAddressPickerView class]];
+        NSString *bundlePath = [containnerBundle pathForResource:@"BRAddressPickerView" ofType:@"bundle"];
+        NSBundle *addressPickerBundle = [NSBundle bundleWithPath:bundlePath];
+        
+        // 获取bundle中的JSON文件
+        NSString *filePath = [addressPickerBundle pathForResource:@"BRCity" ofType:@"json"];
+        NSData *data = [NSData dataWithContentsOfFile:filePath];
+        cityArray = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingAllowFragments error:nil];
+    }
+    return cityArray;
+}
+
+#pragma mark - 获取模型数组
+- (NSArray <BRProvinceModel *>*)getProvinceModelArr:(NSArray *)dataSourceArr {
+    NSMutableArray *tempArr1 = [NSMutableArray array];
+    for (NSDictionary *proviceDic in dataSourceArr) {
+        BRProvinceModel *proviceModel = [[BRProvinceModel alloc]init];
+        proviceModel.code = [proviceDic objectForKey:@"code"];
+        proviceModel.name = [proviceDic objectForKey:@"name"];
+        proviceModel.index = [dataSourceArr indexOfObject:proviceDic];
+        NSArray *cityList = [proviceDic.allKeys containsObject:@"cityList"] ? [proviceDic objectForKey:@"cityList"] : [proviceDic objectForKey:@"citylist"];
+        NSMutableArray *tempArr2 = [NSMutableArray array];
+        for (NSDictionary *cityDic in cityList) {
+            BRCityModel *cityModel = [[BRCityModel alloc]init];
+            cityModel.code = [cityDic objectForKey:@"code"];
+            cityModel.name = [cityDic objectForKey:@"name"];
+            cityModel.index = [cityList indexOfObject:cityDic];
+            NSArray *areaList = [cityDic.allKeys containsObject:@"areaList"] ? [cityDic objectForKey:@"areaList"] : [cityDic objectForKey:@"arealist"];
+            NSMutableArray *tempArr3 = [NSMutableArray array];
+            for (NSDictionary *areaDic in areaList) {
+                BRAreaModel *areaModel = [[BRAreaModel alloc]init];
+                areaModel.code = [areaDic objectForKey:@"code"];
+                areaModel.name = [areaDic objectForKey:@"name"];
+                areaModel.index = [areaList indexOfObject:areaDic];
+                [tempArr3 addObject:areaModel];
+            }
+            cityModel.arealist = [tempArr3 copy];
+            [tempArr2 addObject:cityModel];
+        }
+        proviceModel.citylist = [tempArr2 copy];
+        [tempArr1 addObject:proviceModel];
+    }
+    return [tempArr1 copy];
+}
+
+#pragma mark - 设置默认选择的值
+- (void)handlerDefaultSelectValue {
+    __block NSString *selectProvinceName = nil;
+    __block NSString *selectCityName = nil;
+    __block NSString *selectAreaName = nil;
+    
+    if (self.mSelectValues.count > 0) {
+        selectProvinceName = self.mSelectValues.count > 0 ? self.mSelectValues[0] : nil;
+        selectCityName = self.mSelectValues.count > 1 ? self.mSelectValues[1] : nil;
+        selectAreaName = self.mSelectValues.count > 2 ? self.mSelectValues[2] : nil;
+    }
+    
+    __weak typeof(self) weakSelf = self;
+    
+    if (self.pickerMode == BRAddressPickerModeProvince || self.pickerMode == BRAddressPickerModeCity || self.pickerMode == BRAddressPickerModeArea) {
+        if (self.selectIndexs.count > 0) {
+            NSInteger provinceIndex = [self.selectIndexs[0] integerValue];
+            self.provinceIndex = (provinceIndex > 0 && provinceIndex < self.provinceModelArr.count) ? provinceIndex : 0;
+            self.selectProvinceModel = self.provinceModelArr.count > self.provinceIndex ? self.provinceModelArr[self.provinceIndex] : nil;
+        } else {
+            self.provinceIndex = 0;
+            self.selectProvinceModel = self.provinceModelArr.count > 0 ? self.provinceModelArr[0] : nil;
+            [self.provinceModelArr enumerateObjectsUsingBlock:^(BRProvinceModel *  _Nonnull model, NSUInteger idx, BOOL * _Nonnull stop) {
+                if (selectProvinceName && [model.name isEqualToString:selectProvinceName]) {
+                    weakSelf.provinceIndex = idx;
+                    weakSelf.selectProvinceModel = model;
+                    *stop = YES;
+                }
+            }];
+        }
+    }
+    
+    if (self.pickerMode == BRAddressPickerModeCity || self.pickerMode == BRAddressPickerModeArea) {
+        self.cityModelArr = [self getCityModelArray:self.provinceIndex];
+        if (self.selectIndexs.count > 0) {
+            NSInteger cityIndex = self.selectIndexs.count > 1 ? [self.selectIndexs[1] integerValue] : 0;
+            self.cityIndex = (cityIndex > 0 && cityIndex < self.cityModelArr.count) ? cityIndex : 0;
+            self.selectCityModel = self.cityModelArr.count > self.cityIndex ? self.cityModelArr[self.cityIndex] : nil;
+        } else {
+            self.cityIndex = 0;
+            self.selectCityModel = self.cityModelArr.count > 0 ? self.cityModelArr[0] : nil;
+            [self.cityModelArr enumerateObjectsUsingBlock:^(BRCityModel *  _Nonnull model, NSUInteger idx, BOOL * _Nonnull stop) {
+                if (selectCityName && [model.name isEqualToString:selectCityName]) {
+                    weakSelf.cityIndex = idx;
+                    weakSelf.selectCityModel = model;
+                    *stop = YES;
+                }
+            }];
+        }
+    }
+    
+    if (self.pickerMode == BRAddressPickerModeArea) {
+        self.areaModelArr = [self getAreaModelArray:self.provinceIndex cityIndex:self.cityIndex];
+        if (self.selectIndexs.count > 0) {
+            NSInteger areaIndex = self.selectIndexs.count > 2 ? [self.selectIndexs[2] integerValue] : 0;
+            self.areaIndex = (areaIndex > 0 && areaIndex < self.areaModelArr.count) ? areaIndex : 0;
+            self.selectAreaModel = self.areaModelArr.count > self.areaIndex ? self.areaModelArr[self.areaIndex] : nil;
+        } else {
+            self.areaIndex = 0;
+            self.selectAreaModel = self.areaModelArr.count > 0 ? self.areaModelArr[0] : nil;
+            [self.areaModelArr enumerateObjectsUsingBlock:^(BRAreaModel *  _Nonnull model, NSUInteger idx, BOOL * _Nonnull stop) {
+                if (selectAreaName && [model.name isEqualToString:selectAreaName]) {
+                    weakSelf.areaIndex = idx;
+                    weakSelf.selectAreaModel = model;
+                    *stop = YES;
+                }
+            }];
+        }
+    }
+}
+
+// 根据 省索引 获取 城市模型数组
+- (NSArray *)getCityModelArray:(NSInteger)provinceIndex {
+    BRProvinceModel *provinceModel = self.provinceModelArr[provinceIndex];
+    // 返回城市模型数组
+    return provinceModel.citylist;
+}
+
+// 根据 省索引和城市索引 获取 区域模型数组
+- (NSArray *)getAreaModelArray:(NSInteger)provinceIndex cityIndex:(NSInteger)cityIndex {
+    BRProvinceModel *provinceModel = self.provinceModelArr[provinceIndex];
+    if (provinceModel.citylist && provinceModel.citylist.count > 0) {
+        BRCityModel *cityModel = provinceModel.citylist[cityIndex];
+        // 返回地区模型数组
+        return cityModel.arealist;
+    } else {
+        return nil;
+    }
+}
+
+#pragma mark - 地址选择器
+- (UIPickerView *)pickerView {
+    if (!_pickerView) {
+        CGFloat pickerHeaderViewHeight = self.pickerHeaderView ? self.pickerHeaderView.bounds.size.height : 0;
+        _pickerView = [[UIPickerView alloc]initWithFrame:CGRectMake(0, self.pickerStyle.titleBarHeight + pickerHeaderViewHeight, self.keyView.bounds.size.width, self.pickerStyle.pickerHeight)];
+        _pickerView.backgroundColor = self.pickerStyle.pickerColor;
+        _pickerView.autoresizingMask = UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth;
+        _pickerView.dataSource = self;
+        _pickerView.delegate = self;
+    }
+    return _pickerView;
+}
+
+#pragma mark - UIPickerViewDataSource
+// 1.返回组件数量
+- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView {
+    switch (self.pickerMode) {
+        case BRAddressPickerModeProvince:
+            return 1;
+            break;
+        case BRAddressPickerModeCity:
+            return 2;
+            break;
+        case BRAddressPickerModeArea:
+            return 3;
+            break;
+            
+        default:
+            break;
+    }
+}
+
+// 2.返回每个组件的行数
+- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component {
+    if (component == 0) {
+        // 返回省个数
+        return self.provinceModelArr.count;
+    }
+    if (component == 1) {
+        // 返回市个数
+        return self.cityModelArr.count;
+    }
+    if (component == 2) {
+        // 返回区个数
+        return self.areaModelArr.count;
+    }
+    return 0;
+}
+
+#pragma mark - UIPickerViewDelegate
+// 3.设置 pickerView 的显示内容
+- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(nullable UIView *)view {
+    // 1.自定义 row 的内容视图
+    UILabel *label = (UILabel *)view;
+    if (!label) {
+        label = [[UILabel alloc]init];
+        label.backgroundColor = [UIColor clearColor];
+        label.textAlignment = NSTextAlignmentCenter;
+        label.font = self.pickerStyle.pickerTextFont;
+        label.textColor = self.pickerStyle.pickerTextColor;
+        label.numberOfLines = self.pickerStyle.maxTextLines;
+        // 字体自适应属性
+        label.adjustsFontSizeToFitWidth = YES;
+        // 自适应最小字体缩放比例
+        label.minimumScaleFactor = 0.5f;
+    }
+    if (component == 0) {
+        BRProvinceModel *model = self.provinceModelArr[row];
+        label.text = model.name;
+    } else if (component == 1) {
+        BRCityModel *model = self.cityModelArr[row];
+        label.text = model.name;
+    } else if (component == 2) {
+        BRAreaModel *model = self.areaModelArr[row];
+        label.text = model.name;
+    }
+    
+    // 2.设置选择器中间选中行的样式
+    [self.pickerStyle setupPickerSelectRowStyle:pickerView titleForRow:row forComponent:component];
+    
+    // 3.记录选择器滚动过程中选中的列和行
+    [self handlePickerViewRollingStatus:pickerView component:component];
+    
+    return label;
+}
+
+#pragma mark - 处理选择器滚动状态
+- (void)handlePickerViewRollingStatus:(UIPickerView *)pickerView component:(NSInteger)component {
+    // 获取选择器组件滚动中选中的行
+    NSInteger selectRow = [pickerView selectedRowInComponent:component];
+    if (selectRow >= 0) {
+        self.rollingComponent = component;
+        // 根据滚动方向动态计算 rollingRow
+        NSInteger lastRow = self.rollingRow;
+        // 调整偏移量:当用户快速滚动并点击确定按钮时,可能导致选择不准确。这里简单的实现向前/向后多滚动一行(也可以根据滚动速度来调整偏移量)
+        NSInteger offset = 1;
+        if (lastRow >= 0) {
+            // 向上滚动
+            if (selectRow > lastRow) {
+                self.rollingRow = selectRow + offset;
+            } else if (selectRow < lastRow) {
+                // 向下滚动
+                self.rollingRow = selectRow - offset;
+            } else {
+                // 保持当前位置
+                self.rollingRow = selectRow;
+            }
+        } else {
+            // 首次滚动,默认向上滚动
+            self.rollingRow = selectRow + offset;
+        }
+    }
+}
+
+// 获取选择器是否滚动中状态
+- (BOOL)getRollingStatus:(UIView *)view {
+    if ([view isKindOfClass:[UIScrollView class]]) {
+        UIScrollView *scrollView = (UIScrollView *)view;
+        if (scrollView.dragging || scrollView.decelerating) {
+            // 如果 UIPickerView 正在拖拽或正在减速,返回YES
+            return YES;
+        }
+    }
+    
+    for (UIView *subView in view.subviews) {
+        if ([self getRollingStatus:subView]) {
+            return YES;
+        }
+    }
+    
+    return NO;
+}
+
+// 选择器是否正在滚动
+- (BOOL)isRolling {
+    return [self getRollingStatus:self.pickerView];
+}
+
+// 4.滚动 pickerView 执行的回调方法
+- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {
+    if (component == 0) { // 选择省
+        // 保存选择的省份的索引
+        self.provinceIndex = row;
+        switch (self.pickerMode) {
+            case BRAddressPickerModeProvince:
+            {
+                self.selectProvinceModel = self.provinceModelArr.count > self.provinceIndex ? self.provinceModelArr[self.provinceIndex] : nil;
+                self.selectCityModel = nil;
+                self.selectAreaModel = nil;
+            }
+                break;
+            case BRAddressPickerModeCity:
+            {
+                self.cityModelArr = [self getCityModelArray:self.provinceIndex];
+                [self.pickerView reloadComponent:1];
+                [self.pickerView selectRow:0 inComponent:1 animated:YES];
+                self.selectProvinceModel = self.provinceModelArr.count > self.provinceIndex ? self.provinceModelArr[self.provinceIndex] : nil;
+                self.selectCityModel = self.cityModelArr.count > 0 ? self.cityModelArr[0] : nil;
+                self.selectAreaModel = nil;
+            }
+                break;
+            case BRAddressPickerModeArea:
+            {
+                self.cityModelArr = [self getCityModelArray:self.provinceIndex];
+                self.areaModelArr = [self getAreaModelArray:self.provinceIndex cityIndex:0];
+                [self.pickerView reloadComponent:1];
+                [self.pickerView selectRow:0 inComponent:1 animated:YES];
+                [self.pickerView reloadComponent:2];
+                [self.pickerView selectRow:0 inComponent:2 animated:YES];
+                self.selectProvinceModel = self.provinceModelArr.count > self.provinceIndex ? self.provinceModelArr[self.provinceIndex] : nil;
+                self.selectCityModel = self.cityModelArr.count > 0 ? self.cityModelArr[0] : nil;
+                self.selectAreaModel = self.areaModelArr.count > 0 ? self.areaModelArr[0] : nil;
+            }
+                break;
+            default:
+                break;
+        }
+    }
+    if (component == 1) { // 选择市
+        // 保存选择的城市的索引
+        self.cityIndex = row;
+        switch (self.pickerMode) {
+            case BRAddressPickerModeCity:
+            {
+                self.selectCityModel = self.cityModelArr.count > self.cityIndex ? self.cityModelArr[self.cityIndex] : nil;
+                self.selectAreaModel = nil;
+            }
+                break;
+            case BRAddressPickerModeArea:
+            {
+                self.areaModelArr = [self getAreaModelArray:self.provinceIndex cityIndex:self.cityIndex];
+                [self.pickerView reloadComponent:2];
+                [self.pickerView selectRow:0 inComponent:2 animated:YES];
+                self.selectCityModel = self.cityModelArr.count > self.cityIndex ? self.cityModelArr[self.cityIndex] : nil;
+                self.selectAreaModel = self.areaModelArr.count > 0 ? self.areaModelArr[0] : nil;
+            }
+                break;
+            default:
+                break;
+        }
+    }
+    if (component == 2) { // 选择区
+        // 保存选择的地区的索引
+        self.areaIndex = row;
+        if (self.pickerMode == BRAddressPickerModeArea) {
+            self.selectAreaModel = self.areaModelArr.count > self.areaIndex ? self.areaModelArr[self.areaIndex] : nil;
+        }
+    }
+    
+    // 滚动选择时执行 changeBlock
+    if (self.changeBlock) {
+        self.changeBlock(self.selectProvinceModel, self.selectCityModel, self.selectAreaModel);
+    }
+    
+    // 设置自动选择时,滚动选择时就执行 resultBlock
+    if (self.isAutoSelect) {
+        if (self.resultBlock) {
+            self.resultBlock(self.selectProvinceModel, self.selectCityModel, self.selectAreaModel);
+        }
+    }
+}
+
+// 设置行高
+- (CGFloat)pickerView:(UIPickerView *)pickerView rowHeightForComponent:(NSInteger)component {
+    return self.pickerStyle.rowHeight;
+}
+
+// 设置列宽
+- (CGFloat)pickerView:(UIPickerView *)pickerView widthForComponent:(NSInteger)component {
+    NSInteger columnCount = [self numberOfComponentsInPickerView:pickerView];
+    CGFloat columnWidth = self.pickerView.bounds.size.width / columnCount;
+    if (self.pickerStyle.columnWidth > 0 && self.pickerStyle.columnWidth <= columnWidth) {
+        return self.pickerStyle.columnWidth;
+    }
+    return columnWidth;
+}
+
+#pragma mark - 重写父类方法
+- (void)reloadData {
+    // 1.处理数据源
+    [self handlerPickerData];
+    // 2.刷新选择器
+    [self.pickerView reloadAllComponents];
+    // 3.滚动到选择的地区
+    if (self.pickerMode == BRAddressPickerModeProvince) {
+        [self.pickerView selectRow:self.provinceIndex inComponent:0 animated:YES];
+    } else if (self.pickerMode == BRAddressPickerModeCity) {
+        [self.pickerView selectRow:self.provinceIndex inComponent:0 animated:YES];
+        [self.pickerView selectRow:self.cityIndex inComponent:1 animated:YES];
+    } else if (self.pickerMode == BRAddressPickerModeArea) {
+        [self.pickerView selectRow:self.provinceIndex inComponent:0 animated:YES];
+        [self.pickerView selectRow:self.cityIndex inComponent:1 animated:YES];
+        [self.pickerView selectRow:self.areaIndex inComponent:2 animated:YES];
+    }
+}
+
+- (void)addPickerToView:(UIView *)view {
+    // 1.添加地址选择器
+    if (view) {
+        // 立即刷新容器视图 view 的布局(防止 view 使用自动布局时,选择器视图无法正常显示)
+        [view setNeedsLayout];
+        [view layoutIfNeeded];
+        
+        self.frame = view.bounds;
+        CGFloat pickerHeaderViewHeight = self.pickerHeaderView ? self.pickerHeaderView.bounds.size.height : 0;
+        CGFloat pickerFooterViewHeight = self.pickerFooterView ? self.pickerFooterView.bounds.size.height : 0;
+        self.pickerView.frame = CGRectMake(0, pickerHeaderViewHeight, view.bounds.size.width, view.bounds.size.height - pickerHeaderViewHeight - pickerFooterViewHeight);
+        [self addSubview:self.pickerView];
+    } else {
+        // iOS16:重新设置 pickerView 高度(解决懒加载设置frame不生效问题)
+        CGFloat pickerHeaderViewHeight = self.pickerHeaderView ? self.pickerHeaderView.bounds.size.height : 0;
+        self.pickerView.frame = CGRectMake(0, self.pickerStyle.titleBarHeight + pickerHeaderViewHeight, self.keyView.bounds.size.width, self.pickerStyle.pickerHeight);
+        
+        [self.alertView addSubview:self.pickerView];
+    }
+    
+    // ③添加中间选择行的两条分割线
+    if (self.pickerStyle.clearPickerNewStyle) {
+        [self.pickerStyle addSeparatorLineView:self.pickerView];
+    }
+    
+    // 2.绑定数据
+    [self reloadData];
+    
+    __weak typeof(self) weakSelf = self;
+    // 点击确定按钮的回调:点击确定按钮后,执行这个block回调
+    self.doneBlock = ^{
+        if (weakSelf.isRolling) {
+            NSLog(@"选择器滚动还未结束");
+            // 问题:如果滚动选择器过快,然后在滚动过程中快速点击确定按钮,会导致 didSelectRow 代理方法还没有执行,出现没有选中的情况。
+            // 解决:这里手动处理一下,如果滚动还未结束,强制执行一次 didSelectRow 代理方法,选择当前滚动的行。
+            [weakSelf pickerView:weakSelf.pickerView didSelectRow:weakSelf.rollingRow inComponent:weakSelf.rollingComponent];
+        }
+    
+        // 执行选择结果回调
+        if (weakSelf.resultBlock) {
+            weakSelf.resultBlock(weakSelf.selectProvinceModel, weakSelf.selectCityModel, weakSelf.selectAreaModel);
+        }
+    };
+    
+    [super addPickerToView:view];
+}
+
+#pragma mark - 重写父类方法
+- (void)addSubViewToPicker:(UIView *)customView {
+    [self.pickerView addSubview:customView];
+}
+
+#pragma mark - 弹出选择器视图
+- (void)show {
+    [self addPickerToView:nil];
+}
+
+#pragma mark - 关闭选择器视图
+- (void)dismiss {
+    [self removePickerFromView:nil];
+}
+
+#pragma mark - setter方法
+- (void)setSelectValues:(NSArray<NSString *> *)selectValues {
+    self.mSelectValues = selectValues;
+}
+
+#pragma mark - getter方法
+- (NSArray *)provinceModelArr {
+    if (!_provinceModelArr) {
+        _provinceModelArr = [NSArray array];
+    }
+    return _provinceModelArr;
+}
+
+- (NSArray *)cityModelArr {
+    if (!_cityModelArr) {
+        _cityModelArr = [NSArray array];
+    }
+    return _cityModelArr;
+}
+
+- (NSArray *)areaModelArr {
+    if (!_areaModelArr) {
+        _areaModelArr = [NSArray array];
+    }
+    return _areaModelArr;
+}
+
+- (BRProvinceModel *)selectProvinceModel {
+    if (!_selectProvinceModel) {
+        _selectProvinceModel = [[BRProvinceModel alloc]init];
+    }
+    return _selectProvinceModel;
+}
+
+- (BRCityModel *)selectCityModel {
+    if (!_selectCityModel) {
+        _selectCityModel = [[BRCityModel alloc]init];
+        _selectCityModel.code = @"";
+        _selectCityModel.name = @"";
+    }
+    return _selectCityModel;
+}
+
+- (BRAreaModel *)selectAreaModel {
+    if (!_selectAreaModel) {
+        _selectAreaModel = [[BRAreaModel alloc]init];
+        _selectAreaModel.code = @"";
+        _selectAreaModel.name = @"";
+    }
+    return _selectAreaModel;
+}
+
+- (NSArray *)dataSourceArr {
+    if (!_dataSourceArr) {
+        _dataSourceArr = [NSArray array];
+    }
+    return _dataSourceArr;
+}
+
+- (NSArray<NSString *> *)mSelectValues {
+    if (!_mSelectValues) {
+        _mSelectValues = [NSArray array];
+    }
+    return _mSelectValues;
+}
+
+- (NSArray<NSNumber *> *)selectIndexs {
+    if (!_selectIndexs) {
+        _selectIndexs = [NSArray array];
+    }
+    return _selectIndexs;
+}
+
+@end

+ 16 - 0
Pods/BRPickerView/BRPickerView/Deprecated/Base/BRBaseView.h

@@ -0,0 +1,16 @@
+//
+//  BaseView.h
+//  BRPickerViewDemo
+//
+//  Created by renbo on 2017/8/11.
+//  Copyright © 2017 irenb. All rights reserved.
+//
+//  最新代码下载地址:https://github.com/agiapp/BRPickerView
+
+#import "BRPickerAlertView.h"
+
+@interface BRBaseView : BRPickerAlertView
+/** 是否自动选择,即滚动选择器后就执行结果回调,默认为 NO */
+@property (nonatomic, assign) BOOL isAutoSelect;
+
+@end

+ 14 - 0
Pods/BRPickerView/BRPickerView/Deprecated/Base/BRBaseView.m

@@ -0,0 +1,14 @@
+//
+//  BaseView.m
+//  BRPickerViewDemo
+//
+//  Created by renbo on 2017/8/11.
+//  Copyright © 2017 irenb. All rights reserved.
+//
+//  最新代码下载地址:https://github.com/agiapp/BRPickerView
+
+#import "BRBaseView.h"
+
+@implementation BRBaseView
+
+@end

+ 36 - 0
Pods/BRPickerView/BRPickerView/Deprecated/StringPickerView/BRResultModel.h

@@ -0,0 +1,36 @@
+//
+//  BRResultModel.h
+//  BRPickerViewDemo
+//
+//  Created by renbo on 2019/10/2.
+//  Copyright © 2019 irenb. All rights reserved.
+//
+//  最新代码下载地址:https://github.com/agiapp/BRPickerView
+
+#import <Foundation/Foundation.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface BRResultModel : NSObject
+
+/** key */
+@property (nullable, nonatomic, copy) NSString *key;
+/** value */
+@property (nullable, nonatomic, copy) NSString *value;;
+/** 父级key(提示:联动时第一级数据,parentKey设置为:@"-1") */
+@property (nullable, nonatomic, copy) NSString *parentKey;
+/** 父级value */
+@property (nullable, nonatomic, copy) NSString *parentValue;
+/** 子级list */
+@property (nullable, nonatomic, copy) NSArray<BRResultModel *> *children;
+/** 记录选择的索引位置 */
+@property (nonatomic, assign) NSInteger index;
+
+/// 其它扩展字段
+@property (nullable, nonatomic, strong) id extras;
+@property (nullable, nonatomic, copy) NSString *level;
+@property (nullable, nonatomic, copy) NSString *remark;
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 41 - 0
Pods/BRPickerView/BRPickerView/Deprecated/StringPickerView/BRResultModel.m

@@ -0,0 +1,41 @@
+//
+//  BRResultModel.m
+//  BRPickerViewDemo
+//
+//  Created by renbo on 2019/10/2.
+//  Copyright © 2019 irenb. All rights reserved.
+//
+//  最新代码下载地址:https://github.com/agiapp/BRPickerView
+
+#import "BRResultModel.h"
+
+@implementation BRResultModel
+
+/// 判断两个对象是否相等
+/// @param object 目标对象
+- (BOOL)isEqual:(id)object {
+    // 1.对象的地址相同
+    if (self == object) {
+        return YES;
+    }
+    
+    if (![object isKindOfClass:[BRResultModel class]]) {
+        return NO;
+    }
+    
+    BRResultModel *model = (BRResultModel *)object;
+    if (!model) {
+        return NO;
+    }
+    // 2.对象的类型相同,且对象的各个属性相等
+    BOOL isSameKey = (!self.key && !model.key) || [self.key isEqualToString:model.key];
+    BOOL isSameValue = (!self.value && !model.value) || [self.value isEqualToString:model.value];
+    
+    return isSameKey && isSameValue;
+}
+
+- (NSUInteger)hash {
+    return [self.key hash] ^ [self.value hash];
+}
+
+@end

+ 199 - 0
Pods/BRPickerView/BRPickerView/Deprecated/StringPickerView/BRStringPickerView.h

@@ -0,0 +1,199 @@
+//
+//  BRStringPickerView.h
+//  BRPickerViewDemo
+//
+//  Created by renbo on 2017/8/11.
+//  Copyright © 2017 irenb. All rights reserved.
+//
+//  最新代码下载地址:https://github.com/agiapp/BRPickerView
+
+#import "BRBaseView.h"
+#import "BRResultModel.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+/// 字符串选择器类型
+typedef NS_ENUM(NSInteger, BRStringPickerMode) {
+    /** 单列选择器 */
+    BRStringPickerComponentSingle,
+    /** 多列选择器 */
+    BRStringPickerComponentMulti,
+    /** 多级联动选择器 */
+    BRStringPickerComponentLinkage
+};
+
+typedef void(^BRStringResultModelBlock)(BRResultModel * _Nullable resultModel);
+
+typedef void(^BRStringResultModelArrayBlock)(NSArray <BRResultModel *> * _Nullable resultModelArr);
+
+// BRStringPickerView 组件已废弃,请使用 BRTextPickerView 组件进行替换,具体使用请参见 README.md
+//__attribute__((deprecated("Use 'BRTextPickerView' instead.")))
+@interface BRStringPickerView : BRBaseView
+
+/**
+ //////////////////////////////////////////////////////////////////////////
+ ///
+ ///   【用法一】
+ ///    特点:灵活,扩展性强(推荐使用!)
+ ///
+ ////////////////////////////////////////////////////////////////////////*/
+
+/** 字符串选择器显示类型 */
+@property (nonatomic, assign) BRStringPickerMode pickerMode;
+
+/**
+ *  1.设置数据源
+ *    单列:@[@"男", @"女", @"其他"],或直接传一维模型数组(NSArray <BRResultModel *>*)
+ *    多列:@[@[@"语文", @"数学", @"英语"], @[@"优秀", @"良好"]],或直接传多维模型数组
+ *    联动:直接传一维模型数组(NSArray <BRResultModel *>*),要注意数据源联动格式,可参考Demo
+ */
+@property (nullable, nonatomic, copy) NSArray *dataSourceArr;
+/**
+ *  2.设置数据源
+ *    直接传plist文件名:NSString类型(如:@"test.plist"),要带后缀名
+ *    场景:可以将数据源数据(数组类型)放到plist文件中,直接传plist文件名更加简单
+ */
+@property (nullable, nonatomic, copy) NSString *plistName;
+
+/**
+ *  设置默认选中的位置【单列】
+ *  推荐使用 selectIndex,更加严谨,可以避免使用 selectValue 时,有名称相同的情况
+ */
+@property (nonatomic, assign) NSInteger selectIndex;
+@property (nullable, nonatomic, copy) NSString *selectValue;
+
+/**
+ *  设置默认选中的位置【多列】
+ *  推荐使用 selectIndexs,更加严谨,可以避免使用 selectValues 时,有名称相同的情况
+ */
+@property (nullable, nonatomic, copy) NSArray <NSNumber *> *selectIndexs;
+@property (nullable, nonatomic, copy) NSArray <NSString *> *selectValues;
+
+/** 选择结果的回调【单列】 */
+@property (nullable, nonatomic, copy) BRStringResultModelBlock resultModelBlock;
+/** 选择结果的回调【多列】 */
+@property (nullable, nonatomic, copy) BRStringResultModelArrayBlock resultModelArrayBlock;
+
+/** 滚动选择时触发的回调【单列】 */
+@property (nullable, nonatomic, copy) BRStringResultModelBlock changeModelBlock;
+/** 滚动选择时触发的回调【多列】 */
+@property (nullable, nonatomic, copy) BRStringResultModelArrayBlock changeModelArrayBlock;
+
+/** 判断选择器是否处于滚动中。可以用于解决快速滑动选择器,在滚动结束前秒选确定按钮,出现显示不对的问题。*/
+@property (nonatomic, readonly, assign, getter=isRolling) BOOL rolling;
+
+/**
+ *  最大层级数(列数) for `BRStringPickerComponentLinkage`, ignored otherwise.
+ *  使用场景:默认可选,当数据源中有 key 等于 parentKey 情况时,必须要设置
+ */
+@property (nonatomic, assign) NSInteger numberOfComponents;
+
+/** 滚动至选择行动画,默认为 NO */
+@property (nonatomic, assign) BOOL selectRowAnimated;
+
+/// 初始化字符串选择器
+/// @param pickerMode 字符串选择器显示类型
+- (instancetype)initWithPickerMode:(BRStringPickerMode)pickerMode;
+
+/// 弹出选择器视图
+- (void)show;
+
+/// 关闭选择器视图
+- (void)dismiss;
+
+
+
+
+//================================================= 华丽的分割线 =================================================
+
+
+
+
+/**
+ //////////////////////////////////////////////////////////////////////////
+ ///
+ ///   【用法二】:快捷使用,直接选择下面其中的一个方法进行使用
+ ///    特点:快捷,方便
+ ///
+ ////////////////////////////////////////////////////////////////////////*/
+
+/**
+ *  1.显示【单列】选择器
+ *
+ *  @param title               选择器标题
+ *  @param dataSourceArr       数据源,格式:@[@"男", @"女", @"其他"],或直接传一维模型数组(NSArray <BRResultModel *>*)
+ *  @param selectIndex         默认选中的位置
+ *  @param resultBlock         选择后的回调
+ *
+ */
++ (void)showPickerWithTitle:(nullable NSString *)title
+              dataSourceArr:(nullable NSArray *)dataSourceArr
+                selectIndex:(NSInteger)selectIndex
+                resultBlock:(nullable BRStringResultModelBlock)resultBlock;
+
+/**
+ *  2.显示【单列】选择器
+ *
+ *  @param title               选择器标题
+ *  @param dataSourceArr       数据源(如:@[@"男", @"女", @"其他"],或直接传模型数组)
+ *  @param selectIndex         默认选中的位置
+ *  @param isAutoSelect        是否自动选择,即滚动选择器后就执行结果回调,默认为 NO
+ *  @param resultBlock         选择后的回调
+ *
+ */
++ (void)showPickerWithTitle:(nullable NSString *)title
+              dataSourceArr:(nullable NSArray *)dataSourceArr
+                selectIndex:(NSInteger)selectIndex
+               isAutoSelect:(BOOL)isAutoSelect
+                resultBlock:(nullable BRStringResultModelBlock)resultBlock;
+
+/**
+ *  3.显示【多列】选择器
+ *
+ *  @param title               选择器标题
+ *  @param dataSourceArr       数据源,格式:@[@[@"语文", @"数学", @"英语"], @[@"优秀", @"良好"]],或直接传多维模型数组
+ *  @param selectIndexs        默认选中的位置(传索引数组,如:@[@2, @1])
+ *  @param resultBlock         选择后的回调
+ *
+ */
++ (void)showMultiPickerWithTitle:(nullable NSString *)title
+                   dataSourceArr:(nullable NSArray *)dataSourceArr
+                    selectIndexs:(nullable NSArray <NSNumber *> *)selectIndexs
+                     resultBlock:(nullable BRStringResultModelArrayBlock)resultBlock;
+
+/**
+ *  4.显示【多列】选择器
+ *
+ *  @param title               选择器标题
+ *  @param dataSourceArr       数据源,格式:@[@[@"语文", @"数学", @"英语"], @[@"优秀", @"良好"]],或直接传多维模型数组
+ *  @param selectIndexs        默认选中的位置(传索引数组,如:@[@2, @1])
+ *  @param isAutoSelect        是否自动选择,即滚动选择器后就执行结果回调,默认为 NO
+ *  @param resultBlock         选择后的回调
+ *
+ */
++ (void)showMultiPickerWithTitle:(nullable NSString *)title
+                   dataSourceArr:(nullable NSArray *)dataSourceArr
+                    selectIndexs:(nullable NSArray <NSNumber *> *)selectIndexs
+                    isAutoSelect:(BOOL)isAutoSelect
+                     resultBlock:(nullable BRStringResultModelArrayBlock)resultBlock;
+
+/**
+ *  5.显示【联动】选择器
+ *
+ *  @param title               选择器标题
+ *  @param dataSourceArr       数据源,格式:直接传一维模型数组(NSArray <BRResultModel *>*)
+ *  @param selectIndexs        默认选中的位置(传索引数组,如:@[@2, @1])
+ *  @param isAutoSelect        是否自动选择,即滚动选择器后就执行结果回调,默认为 NO
+ *  @param resultBlock         选择后的回调
+ *
+ */
++ (void)showLinkagePickerWithTitle:(nullable NSString *)title
+                     dataSourceArr:(nullable NSArray *)dataSourceArr
+                      selectIndexs:(nullable NSArray <NSNumber *> *)selectIndexs
+                      isAutoSelect:(BOOL)isAutoSelect
+                       resultBlock:(nullable BRStringResultModelArrayBlock)resultBlock;
+
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 695 - 0
Pods/BRPickerView/BRPickerView/Deprecated/StringPickerView/BRStringPickerView.m

@@ -0,0 +1,695 @@
+//
+//  BRStringPickerView.m
+//  BRPickerViewDemo
+//
+//  Created by renbo on 2017/8/11.
+//  Copyright © 2017 irenb. All rights reserved.
+//
+//  最新代码下载地址:https://github.com/agiapp/BRPickerView
+
+#import "BRStringPickerView.h"
+
+@interface BRStringPickerView ()<UIPickerViewDelegate, UIPickerViewDataSource>
+{
+    BOOL _dataSourceException; // 数据源格式是否有误
+}
+/** 选择器 */
+@property (nonatomic, strong) UIPickerView *pickerView;
+/** 单列选择的值 */
+@property (nonatomic, copy) NSString *mSelectValue;
+/** 多列选择的值 */
+@property (nonatomic, copy) NSArray <NSString *>* mSelectValues;
+
+// 记录滚动中的位置
+@property(nonatomic, assign) NSInteger rollingComponent;
+@property(nonatomic, assign) NSInteger rollingRow;
+
+/** 数据源 */
+@property (nullable, nonatomic, copy) NSArray *mDataSourceArr;
+
+@end
+
+@implementation BRStringPickerView
+
+#pragma mark - 1.显示【单列】选择器
++ (void)showPickerWithTitle:(NSString *)title
+              dataSourceArr:(NSArray *)dataSourceArr
+                selectIndex:(NSInteger)selectIndex
+                resultBlock:(BRStringResultModelBlock)resultBlock {
+    [self showPickerWithTitle:title dataSourceArr:dataSourceArr selectIndex:selectIndex isAutoSelect:NO resultBlock:resultBlock];
+}
+
+#pragma mark - 2.显示【单列】选择器
++ (void)showPickerWithTitle:(NSString *)title
+              dataSourceArr:(NSArray *)dataSourceArr
+                selectIndex:(NSInteger)selectIndex
+               isAutoSelect:(BOOL)isAutoSelect
+                resultBlock:(BRStringResultModelBlock)resultBlock {
+    // 创建选择器
+    BRStringPickerView *strPickerView = [[BRStringPickerView alloc]init];
+    strPickerView.pickerMode = BRStringPickerComponentSingle;
+    strPickerView.title = title;
+    strPickerView.dataSourceArr = dataSourceArr;
+    strPickerView.selectIndex = selectIndex;
+    strPickerView.isAutoSelect = isAutoSelect;
+    strPickerView.resultModelBlock = resultBlock;
+    
+    // 显示
+    [strPickerView show];
+}
+
+#pragma mark - 3.显示【多列】选择器
++ (void)showMultiPickerWithTitle:(NSString *)title
+                   dataSourceArr:(NSArray *)dataSourceArr
+                    selectIndexs:(NSArray <NSNumber *>*)selectIndexs
+                     resultBlock:(BRStringResultModelArrayBlock)resultBlock {
+    [self showMultiPickerWithTitle:title dataSourceArr:dataSourceArr selectIndexs:selectIndexs isAutoSelect:NO resultBlock:resultBlock];
+}
+
+#pragma mark - 4.显示【多列】选择器
++ (void)showMultiPickerWithTitle:(NSString *)title
+                   dataSourceArr:(NSArray *)dataSourceArr
+                    selectIndexs:(NSArray <NSNumber *>*)selectIndexs
+                    isAutoSelect:(BOOL)isAutoSelect
+                     resultBlock:(BRStringResultModelArrayBlock)resultBlock {
+    // 创建选择器
+    BRStringPickerView *strPickerView = [[BRStringPickerView alloc]init];
+    strPickerView.pickerMode = BRStringPickerComponentMulti;
+    strPickerView.title = title;
+    strPickerView.dataSourceArr = dataSourceArr;
+    strPickerView.selectIndexs = selectIndexs;
+    strPickerView.isAutoSelect = isAutoSelect;
+    strPickerView.resultModelArrayBlock = resultBlock;
+    
+    // 显示
+    [strPickerView show];
+}
+
+#pragma mark - 5.显示【联动】选择器
++ (void)showLinkagePickerWithTitle:(nullable NSString *)title
+                     dataSourceArr:(nullable NSArray *)dataSourceArr
+                      selectIndexs:(nullable NSArray <NSNumber *> *)selectIndexs
+                      isAutoSelect:(BOOL)isAutoSelect
+                       resultBlock:(nullable BRStringResultModelArrayBlock)resultBlock {
+    // 创建选择器
+    BRStringPickerView *strPickerView = [[BRStringPickerView alloc]init];
+    strPickerView.pickerMode = BRStringPickerComponentLinkage;
+    strPickerView.title = title;
+    strPickerView.dataSourceArr = dataSourceArr;
+    strPickerView.selectIndexs = selectIndexs;
+    strPickerView.isAutoSelect = isAutoSelect;
+    strPickerView.resultModelArrayBlock = resultBlock;
+    
+    // 显示
+    [strPickerView show];
+}
+
+#pragma mark - 初始化自定义选择器
+- (instancetype)initWithPickerMode:(BRStringPickerMode)pickerMode {
+    if (self = [super init]) {
+        self.pickerMode = pickerMode;
+    }
+    return self;
+}
+
+#pragma mark - 处理选择器数据
+- (void)handlerPickerData {
+    if (self.dataSourceArr.count == 0) {
+        _dataSourceException = YES;
+    }
+    id item = [self.dataSourceArr firstObject];
+    if (self.pickerMode == BRStringPickerComponentSingle) {
+        _dataSourceException = [item isKindOfClass:[NSArray class]];
+    } else if (self.pickerMode == BRStringPickerComponentMulti) {
+        _dataSourceException = [item isKindOfClass:[NSString class]];
+    } else if (self.pickerMode == BRStringPickerComponentLinkage) {
+        _dataSourceException = ![item isKindOfClass:[BRResultModel class]];
+    }
+    if (_dataSourceException) {
+        BRErrorLog(@"数据源异常!请检查选择器数据源的格式");
+        return;
+    }
+    
+    // 处理选择器当前选择的值
+    if (self.pickerMode == BRStringPickerComponentSingle) {
+        self.mDataSourceArr = self.dataSourceArr;
+        NSInteger selectIndex = 0;
+        if (self.selectIndex > 0 && self.selectIndex < self.mDataSourceArr.count) {
+            selectIndex = self.selectIndex;
+        } else {
+            if (self.mSelectValue) {
+                id item = [self.mDataSourceArr firstObject];
+                if ([item isKindOfClass:[BRResultModel class]]) {
+                    for (NSInteger i = 0; i < self.mDataSourceArr.count; i++) {
+                        BRResultModel *model = self.mDataSourceArr[i];
+                        if ([model.value isEqualToString:self.mSelectValue]) {
+                            selectIndex = i;
+                            break;
+                        }
+                    }
+                } else {
+                    if ([self.mDataSourceArr containsObject:self.mSelectValue]) {
+                        selectIndex = [self.mDataSourceArr indexOfObject:self.mSelectValue];
+                    }
+                }
+            }
+        }
+        self.selectIndex = selectIndex;
+        
+    } else if (self.pickerMode == BRStringPickerComponentMulti) {
+        self.mDataSourceArr = self.dataSourceArr;
+        NSMutableArray *selectIndexs = [[NSMutableArray alloc]init];
+        for (NSInteger i = 0; i < self.mDataSourceArr.count; i++) {
+            NSArray *itemArr = self.mDataSourceArr[i];
+            NSInteger row = 0;
+            if (self.selectIndexs.count > 0) {
+                if (i < self.selectIndexs.count) {
+                    NSInteger index = [self.selectIndexs[i] integerValue];
+                    row = ((index > 0 && index < itemArr.count) ? index : 0);
+                }
+            } else {
+                if (self.mSelectValues.count > 0 && i < self.mSelectValues.count) {
+                    NSString *value = self.mSelectValues[i];
+                    id item = [itemArr firstObject];
+                    if ([item isKindOfClass:[BRResultModel class]]) {
+                        for (NSInteger j = 0; j < itemArr.count; j++) {
+                            BRResultModel *model = itemArr[j];
+                            if ([model.value isEqualToString:value]) {
+                                row = j;
+                                break;
+                            }
+                        }
+                    } else {
+                        if ([itemArr containsObject:value]) {
+                            row = [itemArr indexOfObject:value];
+                        }
+                    }
+                }
+            }
+            [selectIndexs addObject:@(row)];
+        }
+        self.selectIndexs = [selectIndexs copy];
+        
+    } else if (self.pickerMode == BRStringPickerComponentLinkage) {
+        
+        NSMutableArray *selectIndexs = [[NSMutableArray alloc]init];
+        NSMutableArray *mDataSourceArr = [[NSMutableArray alloc]init];
+        
+        BRResultModel *selectModel = nil;
+        BOOL hasNext = YES;
+        NSInteger i = 0;
+
+        NSMutableArray *dataArr = [self.dataSourceArr mutableCopy];
+        
+        do {
+            NSArray *nextArr = [self getNextDataArr:dataArr selectModel:selectModel];
+            // 设置 numberOfComponents,防止 key 等于 parentKey 时进入死循环
+            if (nextArr.count == 0 || i > self.numberOfComponents - 1) {
+                hasNext = NO;
+                break;
+            }
+            
+            NSInteger selectIndex = 0;
+            if (self.selectIndexs.count > i && [self.selectIndexs[i] integerValue] < nextArr.count) {
+                selectIndex = [self.selectIndexs[i] integerValue];
+            }
+            selectModel = nextArr[selectIndex];
+            
+            [selectIndexs addObject:@(selectIndex)];
+            [mDataSourceArr addObject:nextArr];
+
+            i++;
+            
+        } while (hasNext);
+        
+        self.selectIndexs = [selectIndexs copy];
+        self.mDataSourceArr = [mDataSourceArr copy];
+    }
+}
+
+- (NSArray <BRResultModel *>*)getNextDataArr:(NSArray *)dataArr selectModel:(BRResultModel *)selectModel {
+    NSMutableArray *tempArr = [[NSMutableArray alloc]init];
+    // parentKey = @"-1",表示是第一列数据
+    NSString *key = selectModel ? selectModel.key : @"-1";
+    for (BRResultModel *model in dataArr) {
+        if ([model.parentKey isEqualToString:key]) {
+            [tempArr addObject:model];
+        }
+    }
+    return [tempArr copy];
+}
+
+#pragma mark - 选择器
+- (UIPickerView *)pickerView {
+    if (!_pickerView) {
+        CGFloat pickerHeaderViewHeight = self.pickerHeaderView ? self.pickerHeaderView.bounds.size.height : 0;
+        _pickerView = [[UIPickerView alloc]initWithFrame:CGRectMake(0, self.pickerStyle.titleBarHeight + pickerHeaderViewHeight, self.keyView.bounds.size.width, self.pickerStyle.pickerHeight)];
+        _pickerView.backgroundColor = self.pickerStyle.pickerColor;
+        _pickerView.autoresizingMask = UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth;
+        _pickerView.dataSource = self;
+        _pickerView.delegate = self;
+    }
+    return _pickerView;
+}
+
+#pragma mark - UIPickerViewDataSource
+// 1.返回组件数量
+- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView {
+    switch (self.pickerMode) {
+        case BRStringPickerComponentSingle:
+            return 1;
+        case BRStringPickerComponentMulti:
+        case BRStringPickerComponentLinkage:
+            if (self.pickerStyle.columnSpacing > 0) {
+                return self.mDataSourceArr.count * 2 - 1;
+            }
+            return self.mDataSourceArr.count;
+            
+        default:
+            break;
+    }
+}
+
+// 2.返回每个组件的行数
+- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component {
+    switch (self.pickerMode) {
+        case BRStringPickerComponentSingle:
+            return self.mDataSourceArr.count;
+            break;
+        case BRStringPickerComponentMulti:
+        case BRStringPickerComponentLinkage:
+        {
+            if (self.pickerStyle.columnSpacing > 0) {
+                if (component % 2 == 1) {
+                    return 1;
+                } else {
+                    component = component / 2;
+                }
+            }
+            NSArray *itemArr = self.mDataSourceArr[component];
+            return itemArr.count;
+        }
+            break;
+            
+        default:
+            break;
+    }
+}
+
+#pragma mark - UIPickerViewDelegate
+// 3.设置 pickerView 的显示内容
+- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(nullable UIView *)view {
+    // 1.自定义 row 的内容视图
+    UILabel *label = (UILabel *)view;
+    if (!label) {
+        label = [[UILabel alloc]init];
+        label.backgroundColor = [UIColor clearColor];
+        label.textAlignment = NSTextAlignmentCenter;
+        label.font = self.pickerStyle.pickerTextFont;
+        label.textColor = self.pickerStyle.pickerTextColor;
+        label.numberOfLines = self.pickerStyle.maxTextLines;
+        // 字体自适应属性
+        label.adjustsFontSizeToFitWidth = YES;
+        // 自适应最小字体缩放比例
+        label.minimumScaleFactor = 0.5f;
+    }
+    
+    // 2.设置选择器中间选中行的样式
+    [self.pickerStyle setupPickerSelectRowStyle:pickerView titleForRow:row forComponent:component];
+    
+    // 3.记录选择器滚动过程中选中的列和行
+    [self handlePickerViewRollingStatus:pickerView component:component];
+
+    // 设置文本
+    if (self.pickerMode == BRStringPickerComponentSingle) {
+        id item = self.mDataSourceArr[row];
+        if ([item isKindOfClass:[BRResultModel class]]) {
+            BRResultModel *model = (BRResultModel *)item;
+            label.text = model.value;
+        } else {
+            label.text = item;
+        }
+    } else if (self.pickerMode == BRStringPickerComponentMulti || self.pickerMode == BRStringPickerComponentLinkage) {
+        
+        // 如果有设置列间距,且是第奇数列,则不显示内容(即空白间隔列)
+        if (self.pickerStyle.columnSpacing > 0) {
+            if (component % 2 == 1) {
+                label.text = @"";
+                return label;
+            } else {
+                component = component / 2;
+            }
+        }
+        
+        NSArray *itemArr = self.mDataSourceArr[component];
+        id item = [itemArr objectAtIndex:row];
+        if ([item isKindOfClass:[BRResultModel class]]) {
+            BRResultModel *model = (BRResultModel *)item;
+            label.text = model.value;
+        } else {
+            label.text = item;
+        }
+    }
+    
+    return label;
+}
+
+#pragma mark - 处理选择器滚动状态
+- (void)handlePickerViewRollingStatus:(UIPickerView *)pickerView component:(NSInteger)component {
+    // 获取选择器组件滚动中选中的行
+    NSInteger selectRow = [pickerView selectedRowInComponent:component];
+    if (selectRow >= 0) {
+        self.rollingComponent = component;
+        // 根据滚动方向动态计算 rollingRow
+        NSInteger lastRow = self.rollingRow;
+        // 调整偏移量:当用户快速滚动并点击确定按钮时,可能导致选择不准确。这里简单的实现向前/向后多滚动一行(也可以根据滚动速度来调整偏移量)
+        NSInteger offset = 1;
+        if (lastRow >= 0) {
+            // 向上滚动
+            if (selectRow > lastRow) {
+                self.rollingRow = selectRow + offset;
+            } else if (selectRow < lastRow) {
+                // 向下滚动
+                self.rollingRow = selectRow - offset;
+            } else {
+                // 保持当前位置
+                self.rollingRow = selectRow;
+            }
+        } else {
+            // 首次滚动,默认向上滚动
+            self.rollingRow = selectRow + offset;
+        }
+    }
+}
+
+// 获取选择器是否滚动中状态
+- (BOOL)getRollingStatus:(UIView *)view {
+    if ([view isKindOfClass:[UIScrollView class]]) {
+        UIScrollView *scrollView = (UIScrollView *)view;
+        if (scrollView.dragging || scrollView.decelerating) {
+            // 如果 UIPickerView 正在拖拽或正在减速,返回YES
+            return YES;
+        }
+    }
+    
+    for (UIView *subView in view.subviews) {
+        if ([self getRollingStatus:subView]) {
+            return YES;
+        }
+    }
+    
+    return NO;
+}
+
+// 选择器是否正在滚动
+- (BOOL)isRolling {
+    return [self getRollingStatus:self.pickerView];
+}
+
+// 4.滚动 pickerView 执行的回调方法
+- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {
+    switch (self.pickerMode) {
+        case BRStringPickerComponentSingle:
+        {
+            self.selectIndex = row;
+            
+            // 滚动选择时执行 changeModelBlock
+            if (self.changeModelBlock) {
+                self.changeModelBlock([self getResultModel]);
+            }
+            
+            // 设置自动选择时,滚动选择时就执行 resultModelBlock
+            if (self.isAutoSelect) {
+                if (self.resultModelBlock) {
+                    self.resultModelBlock([self getResultModel]);
+                }
+            }
+        }
+            break;
+        case BRStringPickerComponentMulti:
+        {
+            // 处理选择器有设置列间距时,选择器的滚动问题
+            if (self.pickerStyle.columnSpacing > 0) {
+                if (component % 2 == 1) {
+                    return;
+                } else {
+                    component = component / 2;
+                }
+            }
+            
+            if (component < self.selectIndexs.count) {
+                NSMutableArray *mutableArr = [self.selectIndexs mutableCopy];
+                [mutableArr replaceObjectAtIndex:component withObject:@(row)];
+                self.selectIndexs = [mutableArr copy];
+            }
+            
+            // 滚动选择时执行 changeModelArrayBlock
+            if (self.changeModelArrayBlock) {
+                self.changeModelArrayBlock([self getResultModelArr]);
+            }
+            
+            // 设置自动选择时,滚动选择时就执行 resultModelArrayBlock
+            if (self.isAutoSelect) {
+                if (self.resultModelArrayBlock) {
+                    self.resultModelArrayBlock([self getResultModelArr]);
+                }
+            }
+        }
+            break;
+        case BRStringPickerComponentLinkage:
+        {
+            // 处理选择器有设置列间距时,选择器的滚动问题
+            if (self.pickerStyle.columnSpacing > 0) {
+                if (component % 2 == 1) {
+                    return;
+                } else {
+                    component = component / 2;
+                }
+            }
+            
+            if (component < self.selectIndexs.count) {
+                NSMutableArray *selectIndexs = [[NSMutableArray alloc]init];
+                for (NSInteger i = 0; i < self.selectIndexs.count; i++) {
+                    if (i < component) {
+                        [selectIndexs addObject:self.selectIndexs[i]];
+                    } else if (i == component) {
+                        [selectIndexs addObject:@(row)];
+                    } else {
+                        [selectIndexs addObject:@(0)];
+                    }
+                }
+                self.selectIndexs = [selectIndexs copy];
+            }
+            
+            // 刷新选择器数据
+            [self reloadData];
+            
+            // 滚动选择时执行 changeModelArrayBlock
+            if (self.changeModelArrayBlock) {
+                self.changeModelArrayBlock([self getResultModelArr]);
+            }
+            
+            // 设置自动选择时,滚动选择时就执行 resultModelArrayBlock
+            if (self.isAutoSelect) {
+                if (self.resultModelArrayBlock) {
+                    self.resultModelArrayBlock([self getResultModelArr]);
+                }
+            }
+        }
+            break;
+            
+        default:
+            break;
+    }
+}
+
+#pragma mark - 获取【单列】选择器选择的值
+- (BRResultModel *)getResultModel {
+    id item = self.selectIndex < self.mDataSourceArr.count ? self.mDataSourceArr[self.selectIndex] : nil;
+    if ([item isKindOfClass:[BRResultModel class]]) {
+        BRResultModel *model = (BRResultModel *)item;
+        model.index = self.selectIndex;
+        return model;
+    } else {
+        BRResultModel *model = [[BRResultModel alloc]init];
+        model.index = self.selectIndex;
+        model.value = item;
+        return model;
+    }
+}
+
+#pragma mark - 获取【多列】选择器选择的值
+- (NSArray *)getResultModelArr {
+    NSMutableArray *resultModelArr = [[NSMutableArray alloc]init];
+    for (NSInteger i = 0; i < self.mDataSourceArr.count; i++) {
+        NSInteger index = [self.selectIndexs[i] integerValue];
+        NSArray *dataArr = self.mDataSourceArr[i];
+        
+        id item = index < dataArr.count ? dataArr[index] : nil;
+        if ([item isKindOfClass:[BRResultModel class]]) {
+            BRResultModel *model = (BRResultModel *)item;
+            model.index = index;
+            [resultModelArr addObject:model];
+        } else {
+            BRResultModel *model = [[BRResultModel alloc]init];
+            model.index = index;
+            model.value = item;
+            [resultModelArr addObject:model];
+        }
+    }
+    return [resultModelArr copy];
+}
+
+// 设置行高
+- (CGFloat)pickerView:(UIPickerView *)pickerView rowHeightForComponent:(NSInteger)component {
+    return self.pickerStyle.rowHeight;
+}
+
+// 设置列宽
+- (CGFloat)pickerView:(UIPickerView *)pickerView widthForComponent:(NSInteger)component {
+    if (self.pickerStyle.columnSpacing > 0 && component % 2 == 1) {
+        return self.pickerStyle.columnSpacing;
+    }
+    NSInteger columnCount = [self numberOfComponentsInPickerView:pickerView];
+    CGFloat columnWidth = self.pickerView.bounds.size.width / columnCount;
+    if (self.pickerStyle.columnWidth > 0 && self.pickerStyle.columnWidth <= columnWidth) {
+        return self.pickerStyle.columnWidth;
+    }
+    return columnWidth;
+}
+
+#pragma mark - 重写父类方法
+- (void)reloadData {
+    // 1.处理数据源
+    [self handlerPickerData];
+    // 2.刷新选择器
+    [self.pickerView reloadAllComponents];
+    // 3.滚动到选择的值
+    if (self.pickerMode == BRStringPickerComponentSingle) {
+        [self.pickerView selectRow:self.selectIndex inComponent:0 animated:self.selectRowAnimated];
+    } else if (self.pickerMode == BRStringPickerComponentMulti || self.pickerMode == BRStringPickerComponentLinkage) {
+        for (NSInteger i = 0; i < self.selectIndexs.count; i++) {
+            NSNumber *row = [self.selectIndexs objectAtIndex:i];
+            NSInteger component = i;
+            if (self.pickerStyle.columnSpacing > 0) {
+                component = i * 2;
+            }
+            [self.pickerView selectRow:[row integerValue] inComponent:component animated:self.selectRowAnimated];
+        }
+    }
+}
+
+- (void)addPickerToView:(UIView *)view {
+    // 1.添加选择器
+    if (view) {
+        // 立即刷新容器视图 view 的布局(防止 view 使用自动布局时,选择器视图无法正常显示)
+        [view setNeedsLayout];
+        [view layoutIfNeeded];
+        
+        self.frame = view.bounds;
+        CGFloat pickerHeaderViewHeight = self.pickerHeaderView ? self.pickerHeaderView.bounds.size.height : 0;
+        CGFloat pickerFooterViewHeight = self.pickerFooterView ? self.pickerFooterView.bounds.size.height : 0;
+        self.pickerView.frame = CGRectMake(0, pickerHeaderViewHeight, view.bounds.size.width, view.bounds.size.height - pickerHeaderViewHeight - pickerFooterViewHeight);
+        [self addSubview:self.pickerView];
+    } else {
+        // iOS16:重新设置 pickerView 高度(解决懒加载设置frame不生效问题)
+        CGFloat pickerHeaderViewHeight = self.pickerHeaderView ? self.pickerHeaderView.bounds.size.height : 0;
+        self.pickerView.frame = CGRectMake(0, self.pickerStyle.titleBarHeight + pickerHeaderViewHeight, self.keyView.bounds.size.width, self.pickerStyle.pickerHeight);
+        
+        [self.alertView addSubview:self.pickerView];
+    }
+    
+    // ③添加中间选择行的两条分割线
+    if (self.pickerStyle.clearPickerNewStyle) {
+        [self.pickerStyle addSeparatorLineView:self.pickerView];
+    }
+    
+    // 2.绑定数据
+    [self reloadData];
+    
+    __weak typeof(self) weakSelf = self;
+    // 点击确定按钮的回调:点击确定按钮后,执行这个block回调
+    self.doneBlock = ^{
+        if (weakSelf.isRolling) {
+            NSLog(@"选择器滚动还未结束");
+            // 问题:如果滚动选择器过快,然后在滚动过程中快速点击确定按钮,会导致 didSelectRow 代理方法还没有执行,出现没有选中的情况。
+            // 解决:这里手动处理一下,如果滚动还未结束,强制执行一次 didSelectRow 代理方法,选择当前滚动的行。
+            [weakSelf pickerView:weakSelf.pickerView didSelectRow:weakSelf.rollingRow inComponent:weakSelf.rollingComponent];
+        }
+    
+        // 执行选择结果回调
+        if (weakSelf.pickerMode == BRStringPickerComponentSingle) {
+            if (weakSelf.resultModelBlock) {
+                weakSelf.resultModelBlock([weakSelf getResultModel]);
+            }
+        } else if (weakSelf.pickerMode == BRStringPickerComponentMulti || weakSelf.pickerMode == BRStringPickerComponentLinkage) {
+            if (weakSelf.resultModelArrayBlock) {
+                weakSelf.resultModelArrayBlock([weakSelf getResultModelArr]);
+            }
+        }
+    };
+    
+    [super addPickerToView:view];
+}
+
+#pragma mark - 重写父类方法
+- (void)addSubViewToPicker:(UIView *)customView {
+    [self.pickerView addSubview:customView];
+}
+
+#pragma mark - 弹出选择器视图
+- (void)show {
+    [self addPickerToView:nil];
+}
+
+#pragma mark - 关闭选择器视图
+- (void)dismiss {
+    [self removePickerFromView:nil];
+}
+
+#pragma mark - setter 方法
+- (void)setPlistName:(NSString *)plistName {
+    NSString *path = [[NSBundle mainBundle] pathForResource:plistName ofType:nil];
+    if (path && path.length > 0) {
+        self.dataSourceArr = [[NSArray alloc] initWithContentsOfFile:path];
+    }
+}
+
+- (void)setSelectValue:(NSString *)selectValue {
+    self.mSelectValue = selectValue;
+}
+
+- (void)setSelectValues:(NSArray<NSString *> *)selectValues {
+    self.mSelectValues = selectValues;
+}
+
+#pragma mark - getter 方法
+- (NSArray *)mDataSourceArr {
+    if (!_mDataSourceArr) {
+        _mDataSourceArr = [NSArray array];
+    }
+    return _mDataSourceArr;
+}
+
+- (NSArray<NSNumber *> *)selectIndexs {
+    if (!_selectIndexs) {
+        _selectIndexs = [NSArray array];
+    }
+    return _selectIndexs;
+}
+
+- (NSArray<NSString *> *)mSelectValues {
+    if (!_mSelectValues) {
+        _mSelectValues = [NSArray array];
+    }
+    return _mSelectValues;
+}
+
+- (NSInteger)numberOfComponents {
+    if (_numberOfComponents <= 0) {
+        _numberOfComponents = 3;
+    }
+    return _numberOfComponents;
+}
+
+@end

+ 14 - 0
Pods/BRPickerView/BRPickerView/PrivacyInfo.xcprivacy

@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>NSPrivacyTracking</key>
+	<false/>
+	<key>NSPrivacyTrackingDomains</key>
+	<array/>
+	<key>NSPrivacyCollectedDataTypes</key>
+	<array/>
+	<key>NSPrivacyAccessedAPITypes</key>
+	<array/>
+</dict>
+</plist>

+ 62 - 0
Pods/BRPickerView/BRPickerView/TextPicker/BRTextModel.h

@@ -0,0 +1,62 @@
+//
+//  BRTextModel.h
+//  BRPickerViewDemo
+//
+//  Created by renbo on 2019/10/2.
+//  Copyright © 2019 irenb. All rights reserved.
+//
+//  最新代码下载地址:https://github.com/agiapp/BRPickerView
+
+#import <Foundation/Foundation.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface BRTextModel : NSObject
+/** code */
+@property (nullable, nonatomic, copy) NSString *code;
+/** text */
+@property (nullable, nonatomic, copy) NSString *text;
+/** 子级 list */
+@property (nullable, nonatomic, copy) NSArray<BRTextModel *> *children;
+/** 父级 code */
+@property (nonatomic, strong) NSString *parentCode;
+/** 其它扩展字段 */
+@property (nullable, nonatomic, strong) id extras;
+/** 记录选择的索引位置 */
+@property (nonatomic, assign) NSInteger index;
+
+/** 字典 转 模型 */
+- (instancetype)initWithDictionary:(NSDictionary *)dictionary;
+
+@end
+
+
+/// 工具方法
+@interface NSArray (BRPickerView)
+
+/// 数组 转 模型数组
+/// - Parameters:
+///   - dataArr: 字典数组
+///   - mapper: 指定 BRTextModel模型的属性 与 字典key 的映射关系
++ (NSArray *)br_modelArrayWithJson:(NSArray *)dataArr mapper:(nullable NSDictionary *)mapper;
+
+/// 获取模型数组元素,指定属性的值组成新数组
+/// - Parameter propertyName: 模型的属性名称
+- (NSArray *)br_getValueArr:(NSString *)propertyName;
+
+/// 将模型数组元素,指定属性连接成字符串
+/// - Parameters:
+///   - propertyName: 模型的属性名称
+///   - separator: 分隔符
+- (NSString *)br_joinValue:(NSString *)propertyName separator:(NSString *)separator;
+
+/// 将模型数组元素的 text 属性,连接成字符串
+/// - Parameter separator: 分隔符
+- (NSString *)br_joinText:(NSString *)separator;
+
+/// 将扁平结构模型数组 转换成 树状结构模型数组
+- (NSArray<BRTextModel *> *)br_buildTreeArray;
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 174 - 0
Pods/BRPickerView/BRPickerView/TextPicker/BRTextModel.m

@@ -0,0 +1,174 @@
+//
+//  BRTextModel.m
+//  BRPickerViewDemo
+//
+//  Created by renbo on 2019/10/2.
+//  Copyright © 2019 irenb. All rights reserved.
+//
+//  最新代码下载地址:https://github.com/agiapp/BRPickerView
+
+#import "BRTextModel.h"
+
+@implementation BRTextModel
+
+/// 字典 转 模型
+- (instancetype)initWithDictionary:(NSDictionary *)dictionary {
+    if (self = [super init]) {
+        self.code = dictionary[@"code"];
+        self.text = dictionary[@"text"];
+        self.parentCode = dictionary[@"parent_code"];
+        NSArray *childrenArray = dictionary[@"children"];
+        if (childrenArray) {
+            NSMutableArray *tempArr = [NSMutableArray array];
+            for (NSDictionary *childDict in childrenArray) {
+                BRTextModel *child = [[BRTextModel alloc] initWithDictionary:childDict];
+                [tempArr addObject:child];
+            }
+            self.children = [tempArr copy];
+        }
+    }
+    return self;
+}
+
+/// 判断两个对象是否相等
+/// @param object 目标对象
+- (BOOL)isEqual:(id)object {
+    // 1.对象的地址相同
+    if (self == object) {
+        return YES;
+    }
+    
+    if (![object isKindOfClass:[BRTextModel class]]) {
+        return NO;
+    }
+    
+    BRTextModel *model = (BRTextModel *)object;
+    if (!model) {
+        return NO;
+    }
+    // 2.对象的类型相同,且对象的各个属性相等
+    BOOL isSameCode = (!self.code && !model.code) || [self.code isEqualToString:model.code];
+    BOOL isSameText = (!self.text && !model.text) || [self.text isEqualToString:model.text];
+    
+    return isSameCode && isSameText;
+}
+
+- (NSUInteger)hash {
+    return [self.code hash] ^ [self.text hash];
+}
+
+
+- (void)setValue:(id)value forUndefinedKey:(NSString *)key {
+    
+}
+
+// value为nil,key不为nil的时候会调用
+- (void)setNilValueForKey:(NSString *)key {
+    
+}
+
+// 防止使用 valueForKey 获取值,key不存在时奔溃
+- (id)valueForUndefinedKey:(NSString *)key {
+    return nil;
+}
+
+@end
+
+
+/// 工具方法
+@implementation NSArray (BRPickerView)
+
+/// 数组 转 模型数组
++ (NSArray *)br_modelArrayWithJson:(NSArray *)dataArr mapper:(nullable NSDictionary *)mapper {
+    if (!mapper) {
+        // 如果属性映射字典为空,就使用下面默认的
+        mapper = @{
+            @"code": @"code",
+            @"text": @"text",
+            @"parentCode": @"parent_code",
+            @"extras": @"extras",
+            @"children": @"children"
+        };
+    }
+    NSMutableArray *tempArr = [NSMutableArray array];
+    for (NSDictionary *dic in dataArr) {
+        BRTextModel *model = [[BRTextModel alloc]init];
+        if (mapper[@"code"]) {
+            model.code = [NSString stringWithFormat:@"%@", dic[mapper[@"code"]]];
+        }
+        if (mapper[@"text"]) {
+            model.text = dic[mapper[@"text"]];
+        }
+        if (mapper[@"parentCode"]) {
+            model.parentCode = [NSString stringWithFormat:@"%@", dic[mapper[@"parentCode"]]];
+        }
+        if (mapper[@"extras"]) {
+            model.extras = dic[mapper[@"extras"]];
+        }
+        if (dic[mapper[@"children"]]) {
+            model.children = [self br_modelArrayWithJson:dic[mapper[@"children"]] mapper:mapper]; // 递归处理子list
+        }
+        [tempArr addObject:model];
+    }
+
+    return [tempArr copy];
+}
+
+/// 获取模型数组元素,指定属性的值组成新数组
+- (NSArray *)br_getValueArr:(NSString *)propertyName {
+    NSMutableArray *valueArr = [[NSMutableArray alloc]init];
+    for (BRTextModel *model in self) {
+        id propertyValue = [model valueForKey:propertyName];
+        if (propertyValue) {
+            [valueArr addObject:propertyValue];
+        }
+    }
+    return [valueArr copy];
+}
+
+/// 将模型数组元素,指定属性连接成字符串
+- (NSString *)br_joinValue:(NSString *)propertyName separator:(NSString *)separator {
+    NSArray *valueArr = [self br_getValueArr:propertyName];
+    if (valueArr && valueArr.count > 0) {
+        return [valueArr componentsJoinedByString:separator];
+    }
+    return @"";
+}
+
+/// 将模型数组元素的 text 属性,连接成字符串
+- (NSString *)br_joinText:(NSString *)separator {
+    NSArray *valueArr = [self br_getValueArr:@"text"];
+    if (valueArr && valueArr.count > 0) {
+        return [valueArr componentsJoinedByString:separator];
+    }
+    return @"";
+}
+
+/// 将扁平结构模型数组 转换成 树状结构模型数组
+- (NSArray<BRTextModel *> *)br_buildTreeArray {
+    NSMutableArray<BRTextModel *> *treeModels = [NSMutableArray array];
+    NSMutableDictionary<NSString *, BRTextModel *> *allItemDic = [NSMutableDictionary dictionary];
+
+    // 将所有模型对象以 code 作为 key 存入字典
+    for (BRTextModel *model in self) {
+        allItemDic[model.code] = model;
+    }
+    
+    for (BRTextModel *model in self) {
+        NSString *parentCode = model.parentCode;
+        BRTextModel *parentModel = allItemDic[parentCode];
+        if (parentModel) {
+            if (!parentModel.children) {
+                parentModel.children = [NSArray array];
+            }
+            parentModel.children = [parentModel.children arrayByAddingObject:model];
+        } else {
+            // 没有找到对应的父级模型,即该模型为根节点
+            [treeModels addObject:model];
+        }
+    }
+    
+    return treeModels;
+}
+
+@end

+ 172 - 0
Pods/BRPickerView/BRPickerView/TextPicker/BRTextPickerView.h

@@ -0,0 +1,172 @@
+//
+//  BRTextPickerView.h
+//  BRPickerViewDemo
+//
+//  Created by renbo on 2017/8/11.
+//  Copyright © 2017 irenb. All rights reserved.
+//
+//  最新代码下载地址:https://github.com/agiapp/BRPickerView
+
+#import "BRPickerAlertView.h"
+#import "BRTextModel.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+/// 文本选择器类型
+typedef NS_ENUM(NSInteger, BRTextPickerMode) {
+    /** 单列选择器 */
+    BRTextPickerComponentSingle,
+    /** 多列选择器 */
+    BRTextPickerComponentMulti,
+    /** 多列联动选择器 */
+    BRTextPickerComponentCascade
+};
+
+typedef void(^BRSingleResultBlock)(BRTextModel * _Nullable model, NSInteger index);
+
+typedef void(^BRMultiResultBlock)(NSArray <BRTextModel *> * _Nullable models, NSArray<NSNumber *> * _Nullable indexs);
+
+@interface BRTextPickerView : BRPickerAlertView
+
+/**
+ ////////////////////////////////////////////////////////////////////////// *
+ ///
+ ///   【用法一】
+ ///    特点:灵活,扩展性强(推荐使用!)
+ ///
+ ////////////////////////////////////////////////////////////////////////*/
+
+/** 文本选择器显示类型 */
+@property (nonatomic, assign) BRTextPickerMode pickerMode;
+
+/**
+ *  1.设置数据源
+ *    单列:@[@"男", @"女", @"其他"],或直接传一维模型数组(NSArray <BRTextModel *>*)
+ *    多列:@[@[@"语文", @"数学", @"英语"], @[@"优秀", @"良好"]],或直接传多维模型数组
+ *
+ *    联动:传树状结构模型数组(NSArray <BRTextModel *>*),对应的 JSON 基本数据格式如下:
+ 
+     [
+       {
+         "text" : "北京市",
+         "children" : [
+             { "text": "北京城区", "children": [{ "text": "东城区" }, { "text": "西城区" }] }
+         ]
+       },
+       {
+         "text" : "浙江省",
+         "children" : [
+             { "text": "杭州市", "children": [{ "text": "西湖区" }, { "text": "滨江区" }] },
+             { "text": "宁波市", "children": [{ "text": "海曙区" }, { "text": "江北区" }] }
+         ]
+       }
+     ]
+
+    提示:可以使用下面方法,把上面的 JSON 数据 转成 模型数组
+    dataSourceArr = [NSArray br_modelArrayWithJson:dataArr mapper:nil];
+ */
+@property (nullable, nonatomic, copy) NSArray *dataSourceArr;
+/**
+ *  2.设置数据源(传本地文件名,支持 plist/json 文件)
+ *    ① 对于单列/多列选择器:可以直接传 plist 文件名(如:@"education_data.plist",要带后缀名)
+ *    ② 对于多列联动选择器:可以直接传 JSON 文件名(如:@"region_tree_data.json",要带后缀名),另外要注意JSON数据源的格式(参考上面设置数据源)
+ *
+ *    场景:可以将数据源数据(数组/JSON格式数据)放到 plist/json 文件中,直接传文件名更加简单
+ */
+@property (nullable, nonatomic, copy) NSString *fileName;
+
+/** 设置默认选中的位置【单列】*/
+@property (nonatomic, assign) NSInteger selectIndex;
+/** 设置默认选中的位置【多列】*/
+@property (nullable, nonatomic, copy) NSArray <NSNumber *> *selectIndexs;
+
+/** 滚动选择时,触发的回调【单列】 */
+@property (nullable, nonatomic, copy) BRSingleResultBlock singleChangeBlock;
+/** 滚动选择时,触发的回调【多列】 */
+@property (nullable, nonatomic, copy) BRMultiResultBlock multiChangeBlock;
+
+/** 点击确定时,触发的回调【单列】 */
+@property (nullable, nonatomic, copy) BRSingleResultBlock singleResultBlock;
+/** 点击确定时,触发的回调【多列】 */
+@property (nullable, nonatomic, copy) BRMultiResultBlock multiResultBlock;
+
+/** 判断选择器是否处于滚动中。可以用于解决快速滑动选择器,在滚动结束前秒选确定按钮,出现显示不对的问题 */
+@property (nonatomic, readonly, assign, getter=isRolling) BOOL rolling;
+
+/** 设置选择器显示的列数(即层级数),默认是根据数据源层级动态计算显示 */
+@property (nonatomic, assign) NSUInteger showColumnNum;
+
+/** 滚动至选择行动画,默认为 NO */
+@property (nonatomic, assign) BOOL selectRowAnimated;
+
+/// 初始化文本选择器
+/// @param pickerMode 文本选择器显示类型
+- (instancetype)initWithPickerMode:(BRTextPickerMode)pickerMode;
+
+/// 弹出选择器视图
+- (void)show;
+
+/// 关闭选择器视图
+- (void)dismiss;
+
+
+
+
+//================================================= 华丽的分割线 =================================================
+
+
+
+
+/**
+ //////////////////////////////////////////////////////////////////////////
+ ///
+ ///   【用法二】:快捷使用,直接选择下面其中的一个方法进行使用
+ ///    特点:快捷,方便
+ ///
+ ////////////////////////////////////////////////////////////////////////*/
+
+/**
+ *  1.显示【单列】选择器
+ *
+ *  @param title               选择器标题
+ *  @param dataSourceArr       数据源(如:@[@"男", @"女", @"其他"],或直接传模型数组)
+ *  @param selectIndex         默认选中的位置
+ *  @param resultBlock         选择后的回调
+ *
+ */
++ (void)showPickerWithTitle:(nullable NSString *)title
+              dataSourceArr:(nullable NSArray *)dataSourceArr
+                selectIndex:(NSInteger)selectIndex
+                 resultBlock:(nullable BRSingleResultBlock)resultBlock;
+
+/**
+ *  2.显示【多列】选择器
+ *
+ *  @param title               选择器标题
+ *  @param dataSourceArr       数据源,格式:@[@[@"语文", @"数学", @"英语"], @[@"优秀", @"良好"]],或直接传多维模型数组
+ *  @param selectIndexs        默认选中的位置(传索引数组,如:@[@2, @1])
+ *  @param resultBlock         选择后的回调
+ *
+ */
++ (void)showMultiPickerWithTitle:(nullable NSString *)title
+                   dataSourceArr:(nullable NSArray *)dataSourceArr
+                    selectIndexs:(nullable NSArray <NSNumber *> *)selectIndexs
+                     resultBlock:(nullable BRMultiResultBlock)resultBlock;
+
+/**
+ *  3.显示【联动】选择器
+ *
+ *  @param title               选择器标题
+ *  @param dataSourceArr       数据源,格式:直接传一维模型数组(NSArray <BRTextModel *>*)
+ *  @param selectIndexs        默认选中的位置(传索引数组,如:@[@2, @1])
+ *  @param resultBlock         选择后的回调
+ *
+ */
++ (void)showCascadePickerWithTitle:(nullable NSString *)title
+                     dataSourceArr:(nullable NSArray *)dataSourceArr
+                      selectIndexs:(nullable NSArray <NSNumber *> *)selectIndexs
+                       resultBlock:(nullable BRMultiResultBlock)resultBlock;
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 568 - 0
Pods/BRPickerView/BRPickerView/TextPicker/BRTextPickerView.m

@@ -0,0 +1,568 @@
+//
+//  BRTextPickerView.m
+//  BRPickerViewDemo
+//
+//  Created by renbo on 2017/8/11.
+//  Copyright © 2017 irenb. All rights reserved.
+//
+//  最新代码下载地址:https://github.com/agiapp/BRPickerView
+
+#import "BRTextPickerView.h"
+
+@interface BRTextPickerView ()<UIPickerViewDelegate, UIPickerViewDataSource>
+/** 选择器 */
+@property (nonatomic, strong) UIPickerView *pickerView;
+/** 当前显示的数据源 */
+@property (nonatomic, copy) NSArray *dataList;
+
+// 记录滚动中的位置
+@property(nonatomic, assign) NSInteger rollingComponent;
+@property(nonatomic, assign) NSInteger rollingRow;
+
+@end
+
+@implementation BRTextPickerView
+
+#pragma mark - 1.显示【单列】选择器
++ (void)showPickerWithTitle:(NSString *)title
+              dataSourceArr:(NSArray *)dataSourceArr
+                selectIndex:(NSInteger)selectIndex
+                resultBlock:(BRSingleResultBlock)resultBlock {
+    // 创建选择器
+    BRTextPickerView *strPickerView = [[BRTextPickerView alloc]init];
+    strPickerView.pickerMode = BRTextPickerComponentSingle;
+    strPickerView.title = title;
+    strPickerView.dataSourceArr = dataSourceArr;
+    strPickerView.selectIndex = selectIndex;
+    strPickerView.singleResultBlock = resultBlock;
+    
+    // 显示
+    [strPickerView show];
+}
+
+#pragma mark - 2.显示【多列】选择器
++ (void)showMultiPickerWithTitle:(NSString *)title
+                   dataSourceArr:(NSArray *)dataSourceArr
+                    selectIndexs:(NSArray <NSNumber *>*)selectIndexs
+                     resultBlock:(BRMultiResultBlock)resultBlock {
+    // 创建选择器
+    BRTextPickerView *strPickerView = [[BRTextPickerView alloc]init];
+    strPickerView.pickerMode = BRTextPickerComponentMulti;
+    strPickerView.title = title;
+    strPickerView.dataSourceArr = dataSourceArr;
+    strPickerView.selectIndexs = selectIndexs;
+    strPickerView.multiResultBlock = resultBlock;
+    
+    // 显示
+    [strPickerView show];
+}
+
+#pragma mark - 3.显示【联动】选择器
++ (void)showCascadePickerWithTitle:(nullable NSString *)title
+                     dataSourceArr:(nullable NSArray *)dataSourceArr
+                      selectIndexs:(nullable NSArray <NSNumber *> *)selectIndexs
+                       resultBlock:(nullable BRMultiResultBlock)resultBlock {
+    // 创建选择器
+    BRTextPickerView *strPickerView = [[BRTextPickerView alloc]init];
+    strPickerView.pickerMode = BRTextPickerComponentCascade;
+    strPickerView.title = title;
+    strPickerView.dataSourceArr = dataSourceArr;
+    strPickerView.selectIndexs = selectIndexs;
+    strPickerView.multiResultBlock = resultBlock;
+    
+    // 显示
+    [strPickerView show];
+}
+
+#pragma mark - 初始化自定义选择器
+- (instancetype)initWithPickerMode:(BRTextPickerMode)pickerMode {
+    if (self = [super init]) {
+        self.pickerMode = pickerMode;
+    }
+    return self;
+}
+
+#pragma mark - 处理选择器数据 和 默认选择状态
+- (void)handlerPickerData {
+    // 1.检查数据源数据格式是否有误
+    BOOL dataSourceError = NO;
+    if (self.dataSourceArr.count == 0) {
+        dataSourceError = YES;
+    }
+    id item = [self.dataSourceArr firstObject];
+    if (self.pickerMode == BRTextPickerComponentSingle) {
+        dataSourceError = !([item isKindOfClass:[NSString class]] || [item isKindOfClass:[BRTextModel class]]);
+    } else if (self.pickerMode == BRTextPickerComponentMulti) {
+        dataSourceError = ![item isKindOfClass:[NSArray class]];
+    } else if (self.pickerMode == BRTextPickerComponentCascade) {
+        dataSourceError = ![item isKindOfClass:[BRTextModel class]];
+    }
+    if (dataSourceError) {
+        BRErrorLog(@"数据源异常!请检查选择器数据源的格式");
+        return;
+    }
+    
+    // 2.处理默认选择状态
+    if (self.pickerMode == BRTextPickerComponentSingle) {
+        self.dataList = self.dataSourceArr;
+        if (self.selectIndex < 0 || self.selectIndex >= self.dataList.count) {
+            self.selectIndex = 0;
+        }
+    } else if (self.pickerMode == BRTextPickerComponentMulti) {
+        self.dataList = self.dataSourceArr;
+        NSMutableArray *selectIndexs = [[NSMutableArray alloc]init];
+        for (NSInteger component = 0; component < self.dataList.count; component++) {
+            NSArray *itemArr = self.dataList[component];
+            NSInteger row = 0;
+            if (self.selectIndexs.count > 0 && component < self.selectIndexs.count) {
+                NSInteger index = [self.selectIndexs[component] integerValue];
+                row = ((index > 0 && index < itemArr.count) ? index : 0);
+            }
+            [selectIndexs addObject:@(row)];
+        }
+        self.selectIndexs = [selectIndexs copy];
+    } else if (self.pickerMode == BRTextPickerComponentCascade) {
+        NSMutableArray *dataList = [[NSMutableArray alloc]init];
+        [dataList addObject:self.dataSourceArr];
+        NSMutableArray *selectIndexs = [[NSMutableArray alloc]init];
+        
+        BOOL hasNext = self.dataSourceArr.count > 0;
+        NSInteger i = 0;
+        NSInteger selectIndex = self.selectIndexs.count > 0 && i < self.selectIndexs.count ? [self.selectIndexs[i] integerValue] : 0;
+        [selectIndexs addObject:@(selectIndex)];
+        BRTextModel *selectModel = self.dataSourceArr[selectIndex];
+        while (hasNext) {
+            NSArray *nextArr = selectModel.children;
+            if (!nextArr || nextArr.count == 0) {
+                hasNext = NO;
+                break;
+            }
+            [dataList addObject:nextArr];
+            
+            i++;
+            selectIndex = self.selectIndexs.count > 0 && i < self.selectIndexs.count ? [self.selectIndexs[i] integerValue] : 0;
+            [selectIndexs addObject:@(selectIndex)];
+            selectModel = nextArr[selectIndex];
+        }
+        
+        // 控制选择器固定显示的列数
+        if (self.showColumnNum > 0) {
+            NSInteger dataListCount = dataList.count;
+            if (self.showColumnNum < dataListCount) {
+                // 显示子集数据
+                dataList = [[dataList subarrayWithRange:NSMakeRange(0, self.showColumnNum)] mutableCopy];
+                selectIndexs = [[selectIndexs subarrayWithRange:NSMakeRange(0, self.showColumnNum)] mutableCopy];
+            } else {
+                // 补全占位数据
+                for (NSInteger i = 0; i < self.showColumnNum - dataListCount; i++) {
+                    // 添加空白占位数据
+                    BRTextModel *placeholderModel = [[BRTextModel alloc]init];
+                    NSArray *placeholderArr = @[placeholderModel];
+                    [dataList addObject:placeholderArr];
+                    [selectIndexs addObject:@(0)];
+                }
+            }
+        }
+        self.dataList = [dataList copy];
+        self.selectIndexs = [selectIndexs copy];
+    }
+}
+
+#pragma mark - 选择器
+- (UIPickerView *)pickerView {
+    if (!_pickerView) {
+        CGFloat pickerHeaderViewHeight = self.pickerHeaderView ? self.pickerHeaderView.bounds.size.height : 0;
+        _pickerView = [[UIPickerView alloc]initWithFrame:CGRectMake(0, self.pickerStyle.titleBarHeight + pickerHeaderViewHeight, self.keyView.bounds.size.width, self.pickerStyle.pickerHeight)];
+        _pickerView.backgroundColor = self.pickerStyle.pickerColor;
+        _pickerView.autoresizingMask = UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth;
+        _pickerView.dataSource = self;
+        _pickerView.delegate = self;
+    }
+    return _pickerView;
+}
+
+#pragma mark - UIPickerViewDataSource
+// 1.返回组件数量
+- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView {
+    switch (self.pickerMode) {
+        case BRTextPickerComponentSingle:
+            return 1;
+        case BRTextPickerComponentMulti:
+        case BRTextPickerComponentCascade:
+        {
+            if (self.pickerStyle.columnSpacing > 0) {
+                return self.dataList.count * 2 - 1;
+            }
+            return self.dataList.count;
+        }
+            
+        default:
+            break;
+    }
+}
+
+// 2.返回每个组件的行数
+- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component {
+    switch (self.pickerMode) {
+        case BRTextPickerComponentSingle:
+            return self.dataList.count;
+        case BRTextPickerComponentMulti:
+        case BRTextPickerComponentCascade:
+        {
+            if (self.pickerStyle.columnSpacing > 0) {
+                if (component % 2 == 1) {
+                    return 1;
+                } else {
+                    component = component / 2;
+                }
+            }
+            NSArray *itemArr = self.dataList[component];
+            return itemArr.count;
+        }
+            break;
+            
+        default:
+            break;
+    }
+}
+
+#pragma mark - UIPickerViewDelegate
+// 3.设置 pickerView 的显示内容
+- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(nullable UIView *)view {
+    // 1.自定义 row 的内容视图
+    UILabel *label = (UILabel *)view;
+    if (!label) {
+        label = [[UILabel alloc]init];
+        label.backgroundColor = [UIColor clearColor];
+        label.textAlignment = NSTextAlignmentCenter;
+        label.font = self.pickerStyle.pickerTextFont;
+        label.textColor = self.pickerStyle.pickerTextColor;
+        label.numberOfLines = self.pickerStyle.maxTextLines;
+        // 字体自适应属性
+        label.adjustsFontSizeToFitWidth = YES;
+        // 自适应最小字体缩放比例
+        label.minimumScaleFactor = 0.5f;
+    }
+    
+    // 2.设置选择器中间选中行的样式
+    [self.pickerStyle setupPickerSelectRowStyle:pickerView titleForRow:row forComponent:component];
+    
+    // 3.记录选择器滚动过程中选中的列和行
+    [self handlePickerViewRollingStatus:pickerView component:component];
+
+    // 设置文本
+    if (self.pickerMode == BRTextPickerComponentSingle) {
+        id item = self.dataList[row];
+        if ([item isKindOfClass:[BRTextModel class]]) {
+            BRTextModel *model = (BRTextModel *)item;
+            label.text = model.text;
+        } else {
+            label.text = item;
+        }
+    } else if (self.pickerMode == BRTextPickerComponentMulti || self.pickerMode == BRTextPickerComponentCascade) {
+        // 如果有设置列间距,且是第奇数列,则不显示内容(即空白间隔列)
+        if (self.pickerStyle.columnSpacing > 0) {
+            if (component % 2 == 1) {
+                label.text = @"";
+                return label;
+            } else {
+                component = component / 2;
+            }
+        }
+        
+        NSArray *itemArr = self.dataList[component];
+        id item = [itemArr objectAtIndex:row];
+        if ([item isKindOfClass:[BRTextModel class]]) {
+            BRTextModel *model = (BRTextModel *)item;
+            label.text = model.text;
+        } else {
+            label.text = item;
+        }
+    }
+    
+    return label;
+}
+
+#pragma mark - 处理选择器滚动状态
+- (void)handlePickerViewRollingStatus:(UIPickerView *)pickerView component:(NSInteger)component {
+    // 获取选择器组件滚动中选中的行
+    NSInteger selectRow = [pickerView selectedRowInComponent:component];
+    if (selectRow >= 0) {
+        self.rollingComponent = component;
+        // 根据滚动方向动态计算 rollingRow
+        NSInteger lastRow = self.rollingRow;
+        // 调整偏移量:当用户快速滚动并点击确定按钮时,可能导致选择不准确。这里简单的实现向前/向后多滚动一行(也可以根据滚动速度来调整偏移量)
+        NSInteger offset = 1;
+        if (lastRow >= 0) {
+            // 向上滚动
+            if (selectRow > lastRow) {
+                self.rollingRow = selectRow + offset;
+            } else if (selectRow < lastRow) {
+                // 向下滚动
+                self.rollingRow = selectRow - offset;
+            } else {
+                // 保持当前位置
+                self.rollingRow = selectRow;
+            }
+        } else {
+            // 首次滚动,默认向上滚动
+            self.rollingRow = selectRow + offset;
+        }
+    }
+}
+
+// 获取选择器是否滚动中状态
+- (BOOL)getRollingStatus:(UIView *)view {
+    if ([view isKindOfClass:[UIScrollView class]]) {
+        UIScrollView *scrollView = (UIScrollView *)view;
+        if (scrollView.dragging || scrollView.decelerating) {
+            // 如果 UIPickerView 正在拖拽或正在减速,返回YES
+            return YES;
+        }
+    }
+    
+    for (UIView *subView in view.subviews) {
+        if ([self getRollingStatus:subView]) {
+            return YES;
+        }
+    }
+    
+    return NO;
+}
+
+// 选择器是否正在滚动
+- (BOOL)isRolling {
+    return [self getRollingStatus:self.pickerView];
+}
+
+// 4.滚动 pickerView 执行的回调方法
+- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {
+    switch (self.pickerMode) {
+        case BRTextPickerComponentSingle:
+        {
+            self.selectIndex = row;
+            // 滚动选择时执行 singleChangeBlock
+            self.singleChangeBlock ? self.singleChangeBlock([self getSingleSelectModel], self.selectIndex): nil;
+        }
+            break;
+        case BRTextPickerComponentMulti:
+        {
+            // 处理选择器有设置列间距时,选择器的滚动问题
+            if (self.pickerStyle.columnSpacing > 0) {
+                if (component % 2 == 1) {
+                    return;
+                } else {
+                    component = component / 2;
+                }
+            }
+            
+            if (component < self.selectIndexs.count) {
+                NSMutableArray *mutableArr = [self.selectIndexs mutableCopy];
+                [mutableArr replaceObjectAtIndex:component withObject:@(row)];
+                self.selectIndexs = [mutableArr copy];
+            }
+            
+            // 滚动选择时执行 multiChangeBlock
+            self.multiChangeBlock ? self.multiChangeBlock([self getMultiSelectModels], self.selectIndexs): nil;
+        }
+            break;
+        case BRTextPickerComponentCascade:
+        {
+            // 处理选择器有设置列间距时,选择器的滚动问题
+            if (self.pickerStyle.columnSpacing > 0) {
+                if (component % 2 == 1) {
+                    return;
+                } else {
+                    component = component / 2;
+                }
+            }
+            
+            if (component < self.selectIndexs.count) {
+                NSMutableArray *selectIndexs = [[NSMutableArray alloc]init];
+                for (NSInteger i = 0; i < self.selectIndexs.count; i++) {
+                    if (i < component) {
+                        [selectIndexs addObject:self.selectIndexs[i]];
+                    } else if (i == component) {
+                        [selectIndexs addObject:@(row)];
+                    } else {
+                        [selectIndexs addObject:@(0)];
+                    }
+                }
+                self.selectIndexs = [selectIndexs copy];
+            }
+            
+            // 刷新选择器数据
+            [self reloadData];
+            
+            // 滚动选择时执行 multiChangeBlock
+            self.multiChangeBlock ? self.multiChangeBlock([self getMultiSelectModels], self.selectIndexs): nil;
+        }
+            break;
+            
+        default:
+            break;
+    }
+}
+
+#pragma mark - 获取【单列】选择器选择的值
+- (BRTextModel *)getSingleSelectModel {
+    id item = self.selectIndex < self.dataList.count ? self.dataList[self.selectIndex] : nil;
+    if ([item isKindOfClass:[BRTextModel class]]) {
+        BRTextModel *model = (BRTextModel *)item;
+        model.index = self.selectIndex;
+        return model;
+    } else {
+        BRTextModel *model = [[BRTextModel alloc]init];
+        model.index = self.selectIndex;
+        model.text = item;
+        return model;
+    }
+}
+
+#pragma mark - 获取【多列】选择器选择的值
+- (NSArray *)getMultiSelectModels {
+    NSMutableArray *modelArr = [[NSMutableArray alloc]init];
+    for (NSInteger i = 0; i < self.dataList.count; i++) {
+        NSInteger index = [self.selectIndexs[i] integerValue];
+        NSArray *dataArr = self.dataList[i];
+        
+        id item = index < dataArr.count ? dataArr[index] : nil;
+        if ([item isKindOfClass:[BRTextModel class]]) {
+            BRTextModel *model = (BRTextModel *)item;
+            model.index = index;
+            [modelArr addObject:model];
+        } else {
+            BRTextModel *model = [[BRTextModel alloc]init];
+            model.index = index;
+            model.text = item;
+            [modelArr addObject:model];
+        }
+    }
+    return [modelArr copy];
+}
+
+// 设置行高
+- (CGFloat)pickerView:(UIPickerView *)pickerView rowHeightForComponent:(NSInteger)component {
+    return self.pickerStyle.rowHeight;
+}
+
+// 设置列宽
+- (CGFloat)pickerView:(UIPickerView *)pickerView widthForComponent:(NSInteger)component {
+    if (self.pickerStyle.columnSpacing > 0 && component % 2 == 1) {
+        return self.pickerStyle.columnSpacing;
+    }
+    NSInteger columnCount = [self numberOfComponentsInPickerView:pickerView];
+    CGFloat columnWidth = self.pickerView.bounds.size.width / columnCount;
+    if (self.pickerStyle.columnWidth > 0 && self.pickerStyle.columnWidth <= columnWidth) {
+        return self.pickerStyle.columnWidth;
+    }
+    return columnWidth;
+}
+
+#pragma mark - 重写父类方法
+- (void)reloadData {
+    // 1.处理数据源
+    [self handlerPickerData];
+    // 2.刷新选择器
+    [self.pickerView reloadAllComponents];
+    // 3.滚动到选择的值
+    if (self.pickerMode == BRTextPickerComponentSingle) {
+        [self.pickerView selectRow:self.selectIndex inComponent:0 animated:self.selectRowAnimated];
+    } else if (self.pickerMode == BRTextPickerComponentMulti || self.pickerMode == BRTextPickerComponentCascade) {
+        for (NSInteger i = 0; i < self.selectIndexs.count; i++) {
+            NSNumber *row = [self.selectIndexs objectAtIndex:i];
+            NSInteger component = i;
+            if (self.pickerStyle.columnSpacing > 0) {
+                component = i * 2;
+            }
+            [self.pickerView selectRow:[row integerValue] inComponent:component animated:self.selectRowAnimated];
+        }
+    }
+}
+
+- (void)addPickerToView:(UIView *)view {
+    // 1.添加选择器
+    if (view) {
+        // 立即刷新容器视图 view 的布局(防止 view 使用自动布局时,选择器视图无法正常显示)
+        [view setNeedsLayout];
+        [view layoutIfNeeded];
+        
+        self.frame = view.bounds;
+        CGFloat pickerHeaderViewHeight = self.pickerHeaderView ? self.pickerHeaderView.bounds.size.height : 0;
+        CGFloat pickerFooterViewHeight = self.pickerFooterView ? self.pickerFooterView.bounds.size.height : 0;
+        self.pickerView.frame = CGRectMake(0, pickerHeaderViewHeight, view.bounds.size.width, view.bounds.size.height - pickerHeaderViewHeight - pickerFooterViewHeight);
+        [self addSubview:self.pickerView];
+    } else {
+        // iOS16:重新设置 pickerView 高度(解决懒加载设置frame不生效问题)
+        CGFloat pickerHeaderViewHeight = self.pickerHeaderView ? self.pickerHeaderView.bounds.size.height : 0;
+        self.pickerView.frame = CGRectMake(0, self.pickerStyle.titleBarHeight + pickerHeaderViewHeight, self.keyView.bounds.size.width, self.pickerStyle.pickerHeight);
+        
+        [self.alertView addSubview:self.pickerView];
+    }
+    
+    // ③添加中间选择行的两条分割线
+    if (self.pickerStyle.clearPickerNewStyle) {
+        [self.pickerStyle addSeparatorLineView:self.pickerView];
+    }
+    
+    // 2.绑定数据
+    [self reloadData];
+    
+    __weak typeof(self) weakSelf = self;
+    // 点击确定按钮的回调:点击确定按钮后,执行这个block回调
+    self.doneBlock = ^{
+        if (weakSelf.isRolling) {
+            NSLog(@"选择器滚动还未结束");
+            // 问题:如果滚动选择器过快,然后在滚动过程中快速点击确定按钮,会导致 didSelectRow 代理方法还没有执行,出现没有选中的情况。
+            // 解决:这里手动处理一下,如果滚动还未结束,强制执行一次 didSelectRow 代理方法,选择当前滚动的行。
+            [weakSelf pickerView:weakSelf.pickerView didSelectRow:weakSelf.rollingRow inComponent:weakSelf.rollingComponent];
+        }
+    
+        // 点击确定,执行选择结果回调
+        if (weakSelf.pickerMode == BRTextPickerComponentSingle) {
+            weakSelf.singleResultBlock ? weakSelf.singleResultBlock([weakSelf getSingleSelectModel], weakSelf.selectIndex): nil;
+        } else if (weakSelf.pickerMode == BRTextPickerComponentMulti || weakSelf.pickerMode == BRTextPickerComponentCascade) {
+            weakSelf.multiResultBlock ? weakSelf.multiResultBlock([weakSelf getMultiSelectModels], weakSelf.selectIndexs): nil;
+        }
+    };
+    
+    [super addPickerToView:view];
+}
+
+#pragma mark - 重写父类方法
+- (void)addSubViewToPicker:(UIView *)customView {
+    [self.pickerView addSubview:customView];
+}
+
+#pragma mark - 弹出选择器视图
+- (void)show {
+    [self addPickerToView:nil];
+}
+
+#pragma mark - 关闭选择器视图
+- (void)dismiss {
+    [self removePickerFromView:nil];
+}
+
+#pragma mark - setter 方法
+- (void)setFileName:(NSString *)fileName {
+    NSString *filePath = [[NSBundle mainBundle] pathForResource:fileName ofType:nil];
+    if (filePath && filePath.length > 0) {
+        if ([fileName hasSuffix:@".plist"]) {
+            // 获取本地 plist文件 数据源
+            NSArray *dataArr = [[NSArray alloc] initWithContentsOfFile:filePath];
+            if (dataArr && dataArr.count > 0) {
+                self.dataSourceArr = dataArr;
+            }
+        } else if ([fileName hasSuffix:@".json"]) {
+            // 获取本地 JSON文件 数据源
+            NSData *jsonData = [NSData dataWithContentsOfFile:filePath];
+            NSArray *dataArr = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableContainers error:nil];
+            if (dataArr && dataArr.count > 0) {
+                self.dataSourceArr = [NSArray br_modelArrayWithJson:dataArr mapper:nil];
+            }
+        }
+    }
+}
+
+@end

+ 21 - 0
Pods/BRPickerView/LICENSE

@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2019 91renb
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.

+ 913 - 0
Pods/BRPickerView/README.md

@@ -0,0 +1,913 @@
+# BRPickerView
+
+BRPickerView 封装的是iOS中常用的选择器组件,主要包括:**`BRDatePickerView`** 日期选择器(支持年月日、年月等15种日期样式选择,支持设置星期、至今等)、**`BRTextPickerView`** 文本选择器(支持单列、多列、省市区、省市、省、自定义多级联动选择)。支持自定义主题样式,适配深色模式,支持将选择器组件添加到指定容器视图。
+
+⚠️【特别说明】
+
+>- 从 `V2.9.0` 版本起,新增了`BRTextPickerView` 组件,用于替代 `BRAddressPickerView` 和 `BRStringPickerView` 两个旧组件(目前这两个旧组件做了兼容,可以继续使用,后续会废弃掉,建议使用 `BRTextPickerView` 新组件进行替代)
+>- `V2.8.8`之前老版本,在iOS18+系统上,会因 `maskView` 命名出现崩溃问题,请及时升级到最新版本。
+>- 如果不能找到最新版本,请先执行一下 `pod repo update ` 更新本地仓库,使 CocoaPods 能识别最新可用的库版本。 
+
+#### 📒 稀土掘金:https://juejin.cn/post/6844903605468676104
+
+
+
+# 效果演示
+
+查看并运行 `BRPickerViewDemo.xcodeproj`
+
+| ![效果图1](https://github.com/agiapp/BRPickerView/blob/master/BRPickerViewDemo/images/a.gif?raw=true) | ![效果图2](https://github.com/agiapp/BRPickerView/blob/master/BRPickerViewDemo/images/b.gif?raw=true) |
+| :----------------------------------------------------------: | :----------------------------------------------------------: |
+|                     框架Demo运行效果图1                      |                     框架Demo运行效果图2                      |
+
+# 安装
+
+#### CocoaPods
+
+1. 在 Podfile 中添加 `pod 'BRPickerView'`
+2. 执行 `pod install` 或 `pod update` 
+3. 导入头文件 ` #import <BRPickerView.h>`
+
+>安装说明:
+>
+>**pod 'BRPickerView'** :默认是安装全部组件(包含:`BRDatePickerView` 、 `BRTextPickerView` ,和废弃的`BRAddressPickerView` 、`BRStringPickerView` 组件),等价于:`pod 'BRPickerView/All'`
+>
+>**pod 'BRPickerView/Default'** :仅安装`BRDatePickerView` 和 `BRTextPickerView` 组件
+
+
+#### 手动导入
+
+1. 将与 `README.md` 同级目录下的 `BRPickerView` 文件夹拽入项目中
+
+2. 导入头文件 ` #import "BRPickerView.h"`。
+
+
+# 系统要求
+
+- iOS 9.0+
+- ARC
+
+# 使用
+
+### 时间选择器:`BRDatePickerView`
+
+查看 BRDatePickerView.h 头文件,里面提供了两种使用方式,参见源码。
+
+```objective-c
+/// 日期选择器格式
+typedef NS_ENUM(NSInteger, BRDatePickerMode) {
+    // ----- 以下4种是系统样式(兼容国际化日期格式) -----
+    /** 【yyyy-MM-dd】UIDatePickerModeDate(美式日期:MM-dd-yyyy;英式日期:dd-MM-yyyy)*/
+    BRDatePickerModeDate,
+    /** 【yyyy-MM-dd HH:mm】 UIDatePickerModeDateAndTime */
+    BRDatePickerModeDateAndTime,
+    /** 【HH:mm】UIDatePickerModeTime */
+    BRDatePickerModeTime,
+    /** 【HH:mm】UIDatePickerModeCountDownTimer */
+    BRDatePickerModeCountDownTimer,
+    
+    // ----- 以下14种是自定义样式 -----
+    /** 【yyyy-MM-dd HH:mm:ss】年月日时分秒 */
+    BRDatePickerModeYMDHMS,
+    /** 【yyyy-MM-dd HH:mm】年月日时分 */
+    BRDatePickerModeYMDHM,
+    /** 【yyyy-MM-dd HH】年月日时 */
+    BRDatePickerModeYMDH,
+    /** 【MM-dd HH:mm】月日时分 */
+    BRDatePickerModeMDHM,
+    /** 【yyyy-MM-dd】年月日(兼容国际化日期:dd-MM-yyyy)*/
+    BRDatePickerModeYMD,
+    /** 【yyyy-MM】年月(兼容国际化日期:MM-yyyy)*/
+    BRDatePickerModeYM,
+    /** 【yyyy】年 */
+    BRDatePickerModeY,
+    /** 【MM-dd】月日 */
+    BRDatePickerModeMD,
+    /** 【HH:mm:ss】时分秒 */
+    BRDatePickerModeHMS,
+    /** 【HH:mm】时分 */
+    BRDatePickerModeHM,
+    /** 【mm:ss】分秒 */
+    BRDatePickerModeMS,
+    
+    /** 【yyyy-qq】年季度 */
+    BRDatePickerModeYQ,
+    /** 【yyyy-MM-ww】年月周 */
+    BRDatePickerModeYMW,
+    /** 【yyyy-ww】年周 */
+    BRDatePickerModeYW
+};
+```
+
+- 使用示例(参考Demo):
+
+```objective-c
+// 1.创建日期选择器
+BRDatePickerView *datePickerView = [[BRDatePickerView alloc]init];
+// 2.设置属性
+datePickerView.pickerMode = BRDatePickerModeYMD;
+datePickerView.title = @"选择年月日";
+// datePickerView.selectValue = @"2019-10-30";
+datePickerView.selectDate = [NSDate br_setYear:2019 month:10 day:30];
+datePickerView.minDate = [NSDate br_setYear:1949 month:3 day:12];
+datePickerView.maxDate = [NSDate date];
+datePickerView.isAutoSelect = YES;
+datePickerView.resultBlock = ^(NSDate *selectDate, NSString *selectValue) {
+    NSLog(@"选择的值:%@", selectValue);
+};
+// 设置自定义样式
+BRPickerStyle *customStyle = [[BRPickerStyle alloc]init];
+customStyle.pickerColor = BR_RGB_HEX(0xd9dbdf, 1.0f);
+customStyle.pickerTextColor = [UIColor redColor];
+customStyle.separatorColor = [UIColor redColor];
+datePickerView.pickerStyle = customStyle;
+
+// 3.显示
+[datePickerView show];
+```
+
+**时间选择器显示类型的效果图(默认样式):**
+
+- 以下4种样式是使用 UIDatePicker 类 进行封装的,支持循环滚动
+
+| ![样式1:BRDatePickerModeTime](https://github.com/agiapp/BRPickerView/blob/master/BRPickerViewDemo/images/date_type1.png?raw=true) | ![样式2:BRDatePickerModeDate](https://github.com/agiapp/BRPickerView/blob/master/BRPickerViewDemo/images/date_type2.png?raw=true) |
+| :----------------------------------------------------------: | :----------------------------------------------------------: |
+|                 样式1:BRDatePickerModeDate                  |              样式2:BRDatePickerModeDateAndTime              |
+|                                                              |                                                              |
+| ![样式3:BRDatePickerModeDateAndTime](https://github.com/agiapp/BRPickerView/blob/master/BRPickerViewDemo/images/date_type3.png?raw=true) | ![样式4:BRDatePickerModeCountDownTimer](https://github.com/agiapp/BRPickerView/blob/master/BRPickerViewDemo/images/date_type4.png?raw=true) |
+|                 样式3:BRDatePickerModeTime                  |            样式4:BRDatePickerModeCountDownTimer             |
+
+- 以下11种样式是使用 UIPickerView 类进行封装的。
+
+| ![样式5:BRDatePickerModeYMDHMS](https://github.com/agiapp/BRPickerView/blob/master/BRPickerViewDemo/images/date_type5.png?raw=true) | ![样式6:BRDatePickerModeYMDHM](https://github.com/agiapp/BRPickerView/blob/master/BRPickerViewDemo/images/date_type6.png?raw=true) |
+| :----------------------------------------------------------: | :----------------------------------------------------------: |
+|                样式5:BRDatePickerModeYMDHMS                 |                 样式6:BRDatePickerModeYMDHM                 |
+|                                                              |                                                              |
+| ![样式7:BRDatePickerModeYMDH](https://github.com/agiapp/BRPickerView/blob/master/BRPickerViewDemo/images/date_type7.png?raw=true) | ![样式8:BRDatePickerModeMDHM](https://github.com/agiapp/BRPickerView/blob/master/BRPickerViewDemo/images/date_type8.png?raw=true) |
+|                 样式7:BRDatePickerModeYMDH                  |                 样式8:BRDatePickerModeMDHM                  |
+|                                                              |                                                              |
+| ![样式9:BRDatePickerModeYMDE](https://github.com/agiapp/BRPickerView/blob/master/BRPickerViewDemo/images/date_type9.png?raw=true) | ![样式10:BRDatePickerModeYMD](https://github.com/agiapp/BRPickerView/blob/master/BRPickerViewDemo/images/date_type10.png?raw=true) |
+|                  样式9:BRDatePickerModeYMD                  |                  样式10:BRDatePickerModeYM                  |
+|                                                              |                                                              |
+| ![样式11:BRDatePickerModeYM](https://github.com/agiapp/BRPickerView/blob/master/BRPickerViewDemo/images/date_type11.png?raw=true) | ![样式12:BRDatePickerModeY](https://github.com/agiapp/BRPickerView/blob/master/BRPickerViewDemo/images/date_type12.png?raw=true) |
+|                  样式11:BRDatePickerModeY                   |                  样式12:BRDatePickerModeMD                  |
+|                                                              |                                                              |
+| ![样式13:BRDatePickerModeMD](https://github.com/agiapp/BRPickerView/blob/master/BRPickerViewDemo/images/date_type13.png?raw=true) | ![样式14:BRDatePickerModeHMS](https://github.com/agiapp/BRPickerView/blob/master/BRPickerViewDemo/images/date_type14.png?raw=true) |
+|                 样式13:BRDatePickerModeHMS                  |                  样式14:BRDatePickerModeHM                  |
+|                                                              |                                                              |
+| ![样式15:BRDatePickerModeHM](https://github.com/agiapp/BRPickerView/blob/master/BRPickerViewDemo/images/date_type15.png?raw=true) |                                                              |
+|                  样式15:BRDatePickerModeMS                  |                                                              |
+
+- 其它日期样式
+
+| ![设置显示星期](https://github.com/agiapp/BRPickerView/blob/master/BRPickerViewDemo/images/date_type_week1.png?raw=true) | ![设置显示星期](https://github.com/agiapp/BRPickerView/blob/master/BRPickerViewDemo/images/date_type_week2.png?raw=true) |
+| ------------------------------------------------------------ | ------------------------------------------------------------ |
+| 设置显示星期:datePickerView.showWeek = YES;                 | 设置显示星期:datePickerView.showWeek = YES;                 |
+|                                                              |                                                              |
+| ![设置添加至今](https://github.com/agiapp/BRPickerView/blob/master/BRPickerViewDemo/images/date_type_now.png?raw=true) | ![设置显示今天](https://github.com/agiapp/BRPickerView/blob/master/BRPickerViewDemo/images/date_type_today.png?raw=true) |
+| 设置添加至今:datePickerView.addToNow = YES;                 | 设置显示今天:datePickerView.showToday = YES;                |
+|                                                              |                                                              |
+| ![日期单位单行显示样式](https://github.com/agiapp/BRPickerView/blob/master/BRPickerViewDemo/images/date_type_unit.png?raw=true) | ![自定义选择器选中行颜色](https://github.com/agiapp/BRPickerView/blob/master/BRPickerViewDemo/images/date_type_row.png?raw=true) |
+| 日期单位显示样式:datePickerView.showUnitType = BRShowUnitTypeOnlyCenter; | 设置选择器中间选中行的背景颜色:selectRowColor               |
+
+```objective-c
+// 设置选择器中间选中行的样式
+BRPickerStyle *customStyle = [[BRPickerStyle alloc]init];
+customStyle.selectRowColor = [UIColor blueColor];
+customStyle.selectRowTextFont = [UIFont boldSystemFontOfSize:20.0f];
+customStyle.selectRowTextColor = [UIColor redColor];
+datePickerView.pickerStyle = customStyle;
+```
+
+| ![英式日期年月日](https://github.com/agiapp/BRPickerView/blob/master/BRPickerViewDemo/images/date_type_en1.png?raw=true) | ![英式日期年月](https://github.com/agiapp/BRPickerView/blob/master/BRPickerViewDemo/images/date_type_en2.png?raw=true) |
+| ------------------------------------------------------------ | ------------------------------------------------------------ |
+| 样式:BRDatePickerModeYMD (默认非中文环境显示英式日期)     | 样式:BRDatePickerModeYM (默认非中文环境显示英式日期)      |
+
+- 几种常见的弹框样式模板
+
+| ![模板样式1](https://github.com/agiapp/BRPickerView/blob/master/BRPickerViewDemo/images/template_style1.png?raw=true) | ![模板样式2](https://github.com/agiapp/BRPickerView/blob/master/BRPickerViewDemo/images/template_style2.png?raw=true) |
+| ------------------------------------------------------------ | ------------------------------------------------------------ |
+| 弹框样式模板1:datePickerView.pickerStyle = [BRPickerStyle pickerStyleWithThemeColor:[UIColor blueColor]]; | 弹框样式模板2:datePickerView.pickerStyle = [BRPickerStyle pickerStyleWithDoneTextColor:[UIColor blueColor]]; |
+|                                                              |                                                              |
+| ![模板样式3](https://github.com/agiapp/BRPickerView/blob/master/BRPickerViewDemo/images/template_style3.png?raw=true) | ![添加选择器的头视图](https://github.com/agiapp/BRPickerView/blob/master/BRPickerViewDemo/images/date_type_top.png?raw=true) |
+| 弹框样式模板3:datePickerView.pickerStyle = [BRPickerStyle pickerStyleWithDoneBtnImage:[UIImage imageNamed:@"icon_close"]]; | 添加选择器的头视图:pickerHeaderView                         |
+
+```objective-c
+// 添加选择器头视图(pickerHeaderView)
+UIView *headerView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 36)];
+headerView.backgroundColor = [[UIColor grayColor] colorWithAlphaComponent:0.1f];
+NSArray *unitArr = @[@"年", @"月", @"日"];
+for (NSInteger i = 0; i < unitArr.count; i++) {
+    CGFloat width = SCREEN_WIDTH / unitArr.count;
+    CGFloat orginX = i * (SCREEN_WIDTH / unitArr.count);
+    UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(orginX, 0, width, 36)];
+    label.backgroundColor = [UIColor clearColor];
+    label.textAlignment = NSTextAlignmentCenter;
+    label.font = [UIFont systemFontOfSize:16.0f];
+    label.textColor = [UIColor darkGrayColor];
+    label.text = unitArr[i];
+    [headerView addSubview:label];
+}
+datePickerView.pickerHeaderView = headerView;
+```
+
+
+
+### 文本选择器:`BRTextPickerView`
+
+查看 BRTextPickerView.h 头文件,提供了三种类型:
+
+```objective-c
+/// 文本选择器类型
+typedef NS_ENUM(NSInteger, BRTextPickerMode) {
+    /** 单列选择器 */
+    BRTextPickerComponentSingle,
+    /** 多列选择器 */
+    BRTextPickerComponentMulti,
+    /** 多列联动选择器 */
+    BRTextPickerComponentCascade
+};
+```
+
+#### 1. 单列文本选择器
+
+- 使用示例:
+
+```objective-c
+/// 单列文本选择器
+BRTextPickerView *textPickerView = [[BRTextPickerView alloc]initWithPickerMode:BRTextPickerComponentSingle];
+textPickerView.title = @"学历";
+// 设置数据源
+textPickerView.dataSourceArr = @[@"大专以下", @"大专", @"本科", @"硕士", @"博士", @"博士后"];
+textPickerView.selectIndex = self.mySelectIndex;
+textPickerView.singleResultBlock = ^(BRTextModel * _Nullable model, NSInteger index) {
+  	NSLog(@"选择的值:%@", model.text);
+    self.mySelectIndex = index;
+    textField.text = model.text;
+};
+[textPickerView show];
+```
+
+- 设置数据源有3种方式
+
+```objective-c
+// 方式1:传字符串数组
+textPickerView.dataSourceArr = @[@"大专以下", @"大专", @"本科", @"硕士", @"博士", @"博士后"];
+```
+
+```objective-c
+// 方式2:直接传入 plist 文件名(可以将上面的字符串数组放到本地plist文件中,如:education_data.plist)
+textPickerView.fileName = @"education_data.plist";
+```
+
+```objective-c
+// 方式3:传入一维模型数组(NSArray <BRTextModel *>*)
+NSArray *dataArr = @[@{@"code": @"1", @"text": @"大专以下"},
+                     @{@"code": @"2", @"text": @"大专"},
+                     @{@"code": @"3", @"text": @"本科"},
+                     @{@"code": @"4", @"text": @"硕士"},
+                     @{@"code": @"5", @"text": @"博士"},
+                     @{@"code": @"6", @"text": @"博士后"}];
+// 将上面数组 转为 模型数组(组件内封装的工具方法)
+NSArray<BRTextModel *> *modelArr = [NSArray br_modelArrayWithJson:dataArr mapper:nil];
+textPickerView.dataSourceArr = modelArr;
+```
+
+说明:当字典key 与 BRTextModel模型的属性不匹配时,需要指定模型属性与字典key的映射关系
+
+```objective-c
+/// 单列文本选择器
+BRTextPickerView *textPickerView = [[BRTextPickerView alloc]initWithPickerMode:BRTextPickerComponentSingle];
+textPickerView.title = @"融资情况";
+// 方式3:传入一维模型数组(NSArray <BRTextModel *>*)
+NSArray *dataArr = @[@{@"key": @"1001", @"value": @"无融资", @"remark": @""},
+                     @{@"key": @"2001", @"value": @"天使轮", @"remark": @""},
+                     @{@"key": @"3001", @"value": @"A轮", @"remark": @""},
+                     @{@"key": @"4001", @"value": @"B轮", @"remark": @""},
+                     @{@"key": @"5001", @"value": @"C轮以后", @"remark": @""},
+                     @{@"key": @"6001", @"value": @"已上市", @"remark": @""}];
+// 指定 BRTextModel模型的属性 与 字典key 的映射关系
+NSDictionary *mapper = @{ @"code": @"key", @"text": @"value", @"extras": @"remark" };
+// 将上面数组 转为 模型数组(组件内封装的工具方法)
+NSArray<BRTextModel *> *modelArr = [NSArray br_modelArrayWithJson:dataArr mapper:mapper];
+textPickerView.dataSourceArr = modelArr;
+textPickerView.singleResultBlock = ^(BRTextModel * _Nullable model, NSInteger index) {
+  	NSLog(@"选择的值:%@", model.text);
+};
+[textPickerView show];
+```
+
+- 单列文本选择器效果图:
+
+| ![自定义单列字符串](https://github.com/agiapp/BRPickerView/blob/master/BRPickerViewDemo/images/text_single_xueli.png?raw=true) | ![融资情况](https://github.com/agiapp/BRPickerView/blob/master/BRPickerViewDemo/images/text_single_rongzi.png?raw=true) |
+| :----------------------------------------------------------: | :----------------------------------------------------------: |
+
+
+
+#### 2. 多列文本选择器
+
+- 使用示例:
+
+```objective-c
+/// 多列文本选择器
+BRTextPickerView *textPickerView = [[BRTextPickerView alloc]initWithPickerMode:BRTextPickerComponentMulti];
+textPickerView.title = @"多列文本选择器";
+// 设置数据源
+textPickerView.dataSourceArr = @[@[@"语文", @"数学", @"英语"], @[@"优秀", @"良好"]];
+textPickerView.selectIndexs = self.mySelectIndexs;
+textPickerView.multiResultBlock = ^(NSArray<BRTextModel *> * _Nullable models, NSArray<NSNumber *> * _Nullable indexs) {
+		self.mySelectIndexs = indexs;
+    // 将模型数组元素的 text 属性值,通过分隔符-连接成字符串(组件内封装的工具方法)
+    NSString *selectText = [models br_joinText:@"-"];
+    NSLog(@"选择的结果:%@", selectText);
+};
+[textPickerView show];
+```
+
+- 多列文本选择器设置数据源同单列一样,也有3种方式:
+
+```objective-c
+// 方式1:多维字符串数组
+textPickerView.dataSourceArr = @[@[@"语文", @"数学", @"英语"], @[@"优秀", @"良好"]];
+```
+
+```objective-c
+// 方式2:直接传入 plist 文件名(可以将上面的数组放到本地plist文件中,如:grade_level_data.plist)
+textPickerView.fileName = @"grade_level_data.plist";
+```
+
+```objective-c
+// 方式3:传入多维模型数组
+NSArray *subjectDataArr = @[@{@"subject_id": @"11", @"subject": @"语文"}, @{@"subject_id": @"12", @"subject": @"数学"}, @{@"subject_id": @"13", @"subject": @"英语"}];
+NSArray *gradeDataArr = @[@{@"grade_id": @"1", @"grade": @"优秀"}, @{@"grade_id": @"2", @"grade": @"良好"}];
+// 将上面数组 转为 模型数组(组件内封装的工具方法)
+NSArray *subjectModelArr = [NSArray br_modelArrayWithJson:subjectDataArr mapper:@{ @"code": @"subject_id", @"text": @"subject" }];
+NSArray *gradeModelArr = [NSArray br_modelArrayWithJson:gradeDataArr mapper:@{ @"code": @"grade_id", @"text": @"grade" }];
+textPickerView.dataSourceArr = @[subjectModelArr, gradeModelArr];
+```
+
+- 另外还可以设置更多自定义样式
+
+```objective-c
+/// 多列文本选择器
+BRTextPickerView *textPickerView = [[BRTextPickerView alloc]initWithPickerMode:BRTextPickerComponentMulti];
+textPickerView.title = @"自定义多列字符串";
+textPickerView.dataSourceArr = @[@[@"01", @"02", @"03", @"04", @"05", @"06", @"07", @"08", @"09", @"10", @"11", @"12"], @[@"00", @"10", @"20", @"30", @"40", @"50"]];
+textPickerView.selectIndexs = self.mySelectIndexs;
+textPickerView.multiResultBlock = ^(NSArray<BRTextModel *> * _Nullable models, NSArray<NSNumber *> * _Nullable indexs) {
+  	self.mySelectIndexs = indexs;
+    // 将模型数组元素的 text 属性值,通过:分隔符 连接成字符串(组件内封装的工具方法)
+    NSString *selectText = [models br_joinText:@":"];
+    NSLog(@"选择的结果:%@", selectText);
+};
+
+// 设置自定义样式
+BRPickerStyle *customStyle = [[BRPickerStyle alloc]init];
+// 设置 picker 的列宽
+customStyle.columnWidth = 30;
+// 设置 picker 的列间隔
+customStyle.columnSpacing = 60;
+// 设置圆角矩形背景
+// 方式1:使用系统自带样式,保留iOS14之后系统默认的圆角样式。
+customStyle.clearPickerNewStyle = NO;
+// 方式2:可以使用UIView自定义一个圆角矩形视图rectView,并添加到 alertView 上也能实现同样的效果([textPickerView.alertView addSubview:rectView];)
+// 设置选择器中间选中行的样式
+customStyle.selectRowTextFont = [UIFont boldSystemFontOfSize:20.0f];
+customStyle.selectRowTextColor = [UIColor blueColor];
+textPickerView.pickerStyle = customStyle;
+
+[textPickerView show];
+```
+
+- 多列文本选择器效果图:
+
+| ![多列文本选择器](https://github.com/agiapp/BRPickerView/blob/master/BRPickerViewDemo/images/text_multi_grade.png?raw=true) | ![多列文本选择器](https://github.com/agiapp/BRPickerView/blob/master/BRPickerViewDemo/images/text_multi_time.png?raw=true) |
+| :----------------------------------------------------------: | :----------------------------------------------------------: |
+
+
+
+#### 3. 多列联动文本选择器
+
+- 使用示例:
+
+```objective-c
+/// 多列联动文本选择器
+BRTextPickerView *textPickerView = [[BRTextPickerView alloc]initWithPickerMode:BRTextPickerComponentCascade];
+textPickerView.title = @"多列联动文本选择器";
+NSArray *dataArr = @[
+    @{
+        @"text" : @"浙江省",
+        @"children" : @[
+            @{ @"text": @"杭州市", @"children": @[@{ @"text": @"西湖区" }, @{ @"text": @"滨江区" }] },
+            @{ @"text": @"宁波市", @"children": @[@{ @"text": @"海曙区" }, @{ @"text": @"江北区" }] },
+            @{ @"text": @"温州市", @"children": @[@{ @"text": @"鹿城区" }, @{ @"text": @"龙湾区" }] }
+      ]
+    },
+    @{
+        @"text" : @"江苏省",
+        @"children" : @[
+            @{ @"text": @"南京市", @"children": @[@{ @"text": @"玄武区" }, @{ @"text": @"秦淮区" }] },
+            @{ @"text": @"苏州市", @"children": @[@{ @"text": @"虎丘区" }, @{ @"text": @"吴中区" }] }
+      ]
+    },
+    @{
+        @"text" : @"辽宁省",
+        @"children" : @[
+            @{ @"text": @"沈阳市", @"children": @[@{ @"text": @"沈河区" }, @{ @"text": @"和平区" }] },
+            @{ @"text": @"大连市", @"children": @[@{ @"text": @"中山区" }, @{ @"text": @"金州区" }] }
+      ]
+    }
+];
+// 设置数据源:传树状结构模型数组(NSArray <BRTextModel *>*)
+textPickerView.dataSourceArr = [NSArray br_modelArrayWithJson:dataArr mapper:nil];
+textPickerView.selectIndexs = self.mySelectIndexs;
+textPickerView.multiResultBlock = ^(NSArray<BRTextModel *> * _Nullable models, NSArray<NSNumber *> * _Nullable indexs) {
+    self.mySelectIndexs = indexs;
+  	// 将模型数组元素的 text 属性值,通过-分隔符 连接成字符串(组件内封装的工具方法)
+    NSString *selectText = [models br_joinText:@"-"];
+    NSLog(@"选择的结果:%@", selectText);
+};
+[textPickerView show];
+```
+
+
+
+- 实现省、市、区/县选择(使用本地数据源:region_tree_data.json)
+
+```objective-c
+// 地区
+BRTextPickerView *textPickerView = [[BRTextPickerView alloc]initWithPickerMode:BRTextPickerComponentCascade];
+textPickerView.title = @"请选择地区";
+// 设置数据源:传入本地json文件名(可以下载Demo中的 region_tree_data.json 文件放到自己的项目中,该数据源来源于高德地图最新数据)
+textPickerView.fileName = @"region_tree_data.json";
+// 设置选择器显示的列数(即层级数),默认是根据数据源层级动态计算显示。如:设置1则只显示前1列数据(即只显示省);设置2则只显示前2列数据(即只显示省、市);设置3则只显示前3列数据(即显示省、市、区)
+textPickerView.showColumnNum = 3;
+textPickerView.selectIndexs = self.addressSelectIndexs;
+textPickerView.multiResultBlock = ^(NSArray<BRTextModel *> * _Nullable models, NSArray<NSNumber *> * _Nullable indexs) {
+    self.addressSelectIndexs = indexs;
+    // 将模型数组元素的 text 属性值,通过-分隔符 连接成字符串(组件内封装的工具方法)
+    NSString *selectText = [models br_joinText:@"-"];
+    NSLog(@"选择的结果:%@", selectText);
+    textField.text = selectText;
+};
+[textPickerView show];
+```
+
+- 地址文本选择器的3种显示效果
+
+| ![地区](https://github.com/agiapp/BRPickerView/blob/master/BRPickerViewDemo/images/text_cascade_area.png?raw=true) | ![城市](https://github.com/agiapp/BRPickerView/blob/master/BRPickerViewDemo/images/text_cascade_city.png?raw=true) |
+| ------------------------------------------------------------ | ------------------------------------------------------------ |
+| 样式1:textPickerView.showColumnNum = 3;                     | 样式2:textPickerView.showColumnNum = 2;                     |
+|                                                              |                                                              |
+| ![省份](https://github.com/agiapp/BRPickerView/blob/master/BRPickerViewDemo/images/text_cascade_province.png?raw=true) |                                                              |
+| 样式3:textPickerView.showColumnNum = 1;                     |                                                              |
+
+>高德地图行政区划数据源(省、市、区/县),数据更新于2024年7月
+>
+>- 原数据:[amap_region_data.json](https://raw.githubusercontent.com/agiapp/BRPickerView/master/BRPickerViewDemo/DataFile/amap_region_data.json)
+>- 处理后的树状结构数据1:[region_tree_data.json](https://raw.githubusercontent.com/agiapp/BRPickerView/master/BRPickerViewDemo/DataFile/region_tree_data.json) (组件使用本地数据源时,需要下载的文件)
+>- 处理后的树状结构数据2:[region_list_data.json](https://raw.githubusercontent.com/agiapp/BRPickerView/master/BRPickerViewDemo/DataFile/region_list_data.json)
+
+
+
+- 处理树状结构数据
+
+```json
+{
+    "status": "1",
+    "info": "OK",
+    "districts": [
+        {
+            "adcode": "330000",
+            "name": "浙江省",
+            "districts" : [
+                { "adcode" : "330100", "name": "杭州市", "districts": [{ "adcode" : "330106", "name": "西湖区" }, { "adcode" : "330108", "name": "滨江区" }] },
+                { "adcode" : "330200", "name": "宁波市", "districts": [{ "adcode" : "330203", "name": "海曙区" }, { "adcode" : "330205", "name": "江北区" }] },
+                { "adcode" : "330300", "name": "温州市", "districts": [{ "adcode" : "330302", "name": "鹿城区" }, { "adcode" : "330303", "name": "龙湾区" }] }
+            ]
+        },
+        {
+            "adcode": "320000",
+            "name": "江苏省",
+            "districts" : [
+                { "adcode" : "320100", "name": "南京市", "districts": [{ "adcode" : "320102", "name": "玄武区" }, { "adcode" : "320104", "name": "秦淮区" }] },
+                { "adcode" : "320500", "name": "苏州市", "districts": [{ "adcode" : "320505", "name": "虎丘区" }, { "adcode" : "320506", "name": "吴中区" }] }
+            ]
+        },
+        {
+            "adcode": "210000",
+            "name": "辽宁省",
+            "districts" : [
+                { "adcode" : "210100", "name": "沈阳市", "districts": [{ "adcode" : "210103", "name": "沈河区" }, { "adcode" : "210102", "name": "和平区" }] },
+                { "adcode" : "210200", "name": "大连市", "districts": [{ "adcode" : "210202", "name": "中山区" }, { "adcode" : "210213", "name": "金州区" }] }
+            ]
+        }
+    ]
+}
+```
+
+```objective-c
+/// 多列联动文本选择器
+BRTextPickerView *textPickerView = [[BRTextPickerView alloc]initWithPickerMode:BRTextPickerComponentCascade];
+textPickerView.title = @"多列联动文本选择器";
+
+// 接收网络请求结果数据(下面省略号表示省略部分代码)
+NSArray *dataArr = ...... responseObject[@"districts"];
+// 指定 BRTextModel模型的属性 与 字典key 的映射关系
+NSDictionary *mapper = @{ @"code": @"adcode", @"text": @"name", @"children": @"districts" };
+// 将上面数组 转为 模型数组(组件内封装的工具方法)
+NSArray<BRTextModel *> *modelArr = [NSArray br_modelArrayWithJson:dataArr mapper:mapper];
+textPickerView.dataSourceArr = modelArr;
+textPickerView.multiResultBlock = ^(NSArray<BRTextModel *> * _Nullable models, NSArray<NSNumber *> * _Nullable indexs) {
+    // 将模型数组元素的 text 属性值,通过-分隔符 连接成字符串(组件内封装的工具方法)
+  	NSString *selectText = [models br_joinText:@"-"];
+    NSLog(@"选择的结果:%@", selectText);
+};
+[textPickerView show];
+```
+
+- 处理扁平结构数据
+
+```json
+{
+  "Code" : 200,
+  "Msg" : "获取成功",
+  "Result" : [
+      {
+        "ParentID" : "-1",
+        "ParentName" : "",
+        "CategoryID" : "330000",
+        "CategoryName" : "浙江省"
+      },
+      {
+        "ParentID" : "-1",
+        "ParentName" : "",
+        "CategoryID" : "320000",
+        "CategoryName" : "江苏省"
+      },
+      {
+        "ParentID" : "-1",
+        "ParentName" : "",
+        "CategoryID" : "210000",
+        "CategoryName" : "辽宁省"
+      },
+      {
+        "ParentID" : "330000",
+        "ParentName" : "浙江省",
+        "CategoryID" : "330100",
+        "CategoryName" : "杭州市"
+      },
+      {
+        "ParentID" : "330000",
+        "ParentName" : "浙江省",
+        "CategoryID" : "330200",
+        "CategoryName" : "宁波市"
+      },
+      {
+        "ParentID" : "330000",
+        "ParentName" : "浙江省",
+        "CategoryID" : "330300",
+        "CategoryName" : "温州市"
+      },
+      {
+        "ParentID" : "320000",
+        "ParentName" : "江苏省",
+        "CategoryID" : "320100",
+        "CategoryName" : "南京市"
+      },
+      {
+        "ParentID" : "320000",
+        "ParentName" : "江苏省",
+        "CategoryID" : "320500",
+        "CategoryName" : "苏州市"
+      },
+      {
+        "ParentID" : "210000",
+        "ParentName" : "辽宁省",
+        "CategoryID" : "210100",
+        "CategoryName" : "沈阳市"
+      },
+      {
+        "ParentID" : "210000",
+        "ParentName" : "辽宁省",
+        "CategoryID" : "210200",
+        "CategoryName" : "大连市"
+      }
+  ]
+}
+```
+
+```objective-c
+/// 多列联动文本选择器
+BRTextPickerView *textPickerView = [[BRTextPickerView alloc]initWithPickerMode:BRTextPickerComponentCascade];
+textPickerView.title = @"多列联动文本选择器";
+
+// 接收网络请求结果数据(下面省略号表示省略部分代码)
+NSArray *dataArr = ...... responseObject[@"Result"];
+// 指定 BRTextModel模型的属性 与 字典key 的映射关系
+NSDictionary *mapper = @{ @"parentCode": @"ParentID", @"code": @"CategoryID", @"text": @"CategoryName" };
+// 1.先将上面数组 转为 模型数组(组件内封装的工具方法)。如果数据源是多个数组,需要自己先手动组装成一个NSArray<BRTextModel *>类型的扁平结构模型数组。
+NSArray<BRTextModel *> *listModelArr = [NSArray br_modelArrayWithJson:dataArr mapper:mapper];
+// 2.将扁平结构模型数组 转成 树状结构模型数组(组件内封装的工具方法)
+NSArray<BRTextModel *> *treeModelArr = [listModelArr br_buildTreeArray];
+textPickerView.dataSourceArr = treeModelArr;
+
+textPickerView.multiResultBlock = ^(NSArray<BRTextModel *> * _Nullable models, NSArray<NSNumber *> * _Nullable indexs) {
+    // 将模型数组元素的 text 属性值,通过-分隔符 连接成字符串(组件内封装的工具方法)
+  	NSString *selectText = [models br_joinText:@"-"];
+    NSLog(@"选择的结果:%@", selectText);
+    // 获取选择模型指定属性(如:code)组成的数组(组件内封装的工具方法)
+    NSArray *selectIDs = [models br_getValueArr:@"code"];
+};
+
+// 设置选择器中间选中行的样式
+BRPickerStyle *customStyle = [[BRPickerStyle alloc]init];
+customStyle.selectRowTextFont = [UIFont boldSystemFontOfSize:20.0f];
+customStyle.selectRowTextColor = [UIColor blueColor];
+customStyle.columnWidth = 80;
+customStyle.columnSpacing = 10;
+textPickerView.pickerStyle = customStyle;
+
+[textPickerView show];
+```
+
+- 多列联动文本选择器效果图:
+
+| ![三列联动文本选择器](https://github.com/agiapp/BRPickerView/blob/master/BRPickerViewDemo/images/text_cascade_three.png?raw=true) | ![两列字符串选择器](https://github.com/agiapp/BRPickerView/blob/master/BRPickerViewDemo/images/text_cascade_two.png?raw=true) |
+| :----------------------------------------------------------: | :----------------------------------------------------------: |
+
+
+
+补充说明:对于一些需要特殊定制弹框的应用场景,可以使用下面的方法把日期选择器/文本选择器到指定容器视图上,实现个性化的弹框需求。
+
+```objective-c
+/// 扩展一:添加选择器到指定容器视图上
+/// 应用场景:可将中间的滚轮选择器 pickerView 视图(不包含蒙层及标题栏)添加到任何自定义视图上(会自动填满容器视图),也方便自定义更多的弹框样式
+/// 补充说明:如果是自定义确定按钮,需要回调默认选择的值:只需在自定义确定按钮的点击事件方法里执行一下 doneBlock 回调(目的是去触发组件内部执行 resultBlock 回调,进而回调默认选择的值)
+/// @param view 容器视图
+- (void)addPickerToView:(nullable UIView *)view;
+```
+
+
+
+# 更新记录
+
+#### 2025-04-22(V2.9.5)
+
+- fix:[#319](https://github.com/agiapp/BRPickerView/issues/319) 、[#326](https://github.com/agiapp/BRPickerView/issues/326) 、[#340](https://github.com/agiapp/BRPickerView/issues/340) 
+
+#### 2025-03-16(V2.9.3)
+
+- [#336](https://github.com/agiapp/BRPickerView/issues/336) :优化选择年月日时分秒时,UI显示最后一个秒显示不全问题
+
+#### 2024-07-24(V2.9.1)
+
+- 新增 maxTextLines 属性
+- 取消 selectRowAnimated 属性 readonly 限制
+
+#### 2024-07-17(V2.9.0)
+
+- 新增 BRTextPickerView 文本选择组件(用于替代BRAddressPickerView、BRStringPickerView组件)
+
+#### 2024-07-02(V2.8.8)
+
+- [#310](https://github.com/agiapp/BRPickerView/issues/310) :更新本地省市区数据源数据
+
+- [#314](https://github.com/agiapp/BRPickerView/issues/314) :修改maskView视图命名,解决因命名冲突在iOS 18 上出现的崩溃问题
+
+#### 2024-05-28(V2.8.7)
+
+- 解决已知问题:[#308](https://github.com/agiapp/BRPickerView/issues/308) 、[#309](https://github.com/agiapp/BRPickerView/issues/309) 
+- 时间选择器新增 `twelveHourMode` 属性,支持设置12小时制
+- 支持 Swift Package Manager
+
+#### 2024-04-28(V2.8.5)
+
+- 解决已知问题:[#305](https://github.com/agiapp/BRPickerView/issues/305) 
+- 添加可设置选择器组件的列宽属性:`columnWidth`
+- 添加可设置`BRStringPickerView` 选择器组件的列间隔属性:`columnSpacing`
+
+#### 2024-04-23(V2.8.2)
+
+- 解决已知问题:[#304](https://github.com/agiapp/BRPickerView/issues/304) 
+
+- Add PrivacyInfo.xcprivacy
+
+#### 2022-07-08(V2.8.0)
+
+- 优化代码。
+
+#### 2022-06-16(V2.7.8)
+
+- 优化代码。
+
+#### 2022-03-30(V2.7.7)
+
+- 优化代码。
+
+#### 2021-10-09(V2.7.6)
+
+- 适配iOS15
+
+#### 2021-05-28(V2.7.5)
+
+- 日期选择器新增属性:`monthNames` 和 `customUnit`
+
+- 解决已知问题:[#232](https://github.com/agiapp/BRPickerView/issues/232) 、[#231](https://github.com/agiapp/BRPickerView/issues/231)  、[#230](https://github.com/agiapp/BRPickerView/issues/230)  、[#227](https://github.com/agiapp/BRPickerView/issues/227)  、[#225](https://github.com/agiapp/BRPickerView/issues/225) 、[#219](https://github.com/agiapp/BRPickerView/issues/219) 、[#206](https://github.com/agiapp/BRPickerView/issues/206) 
+
+#### 2020-09-25(V2.7.3)
+
+- 适配选择器iOS14的样式:[#189](https://github.com/agiapp/BRPickerView/issues/189) 、[#191](https://github.com/agiapp/BRPickerView/issues/191)
+
+#### 2020-09-23(V2.7.2)
+
+- 日期选择器新增添加自定义字符串属性:`firstRowContent` 和 `lastRowContent`
+- 解决日期选择器设置最小日期时,存在的联动不正确的问题:[#184](https://github.com/agiapp/BRPickerView/issues/184) 
+
+#### 2020-08-28(V2.7.0)
+
+- 日期选择器添加 `nonSelectableDates` 属性:[#178](https://github.com/agiapp/BRPickerView/issues/178) 
+- 优化选中行文本显示:[#177](https://github.com/agiapp/BRPickerView/issues/177) 
+
+#### 2020-08-16(V2.6.8)
+
+- 优化代码,适配 iPad 分屏显示
+- 新增 `keyView` 属性(即组件的父视图:可以将组件添加到 自己获取的 keyWindow 上,或页面的 view 上)
+
+#### 2020-08-09(V2.6.7)
+
+- 适配 iOS14
+
+#### 2020-08-06(V2.6.6)
+
+- 修复 [#163](https://github.com/agiapp/BRPickerView/issues/163) 和  [#170](https://github.com/agiapp/BRPickerView/issues/170) 
+
+#### 2020-07-18(V2.6.5)
+
+- 字符串选择器新增支持多级联动选择
+
+#### 2020-06-24(V2.6.3)
+
+- 日期选择器新增属性:`timeZone` 和 `addCustomString`
+
+#### 2020-05-12(V2.6.2)
+
+- 实现 [#145](#145) 和  [#146](#146) 需求
+
+#### 2020-04-30(V2.6.0)
+
+- 新增样式属性:`selectRowTextColor` 和 `selectRowTextFont`
+- 日期选择器新增数字显示属性:`numberFullName`
+- 优化代码,添加 `BRDatePickerModeYMD` 支持国际化英式日期
+
+- 修复 [#143](#143)
+
+#### 2020-04-27(V2.5.8)
+
+- 修复 [#138](https://github.com/agiapp/BRPickerView/issues/138) 和 [#142](https://github.com/agiapp/BRPickerView/issues/142)
+- 日期选择器新增 `descending` 属性,支持降序的时间列表
+- 更新地址选择器地区数据源
+
+#### 2020-03-31(V2.5.7)
+
+- 优化代码,解决已知问题
+
+#### 2020-02-26(V2.5.6)
+
+- 优化代码,兼容部分国际化日期样式
+
+#### 2020-02-24(V2.5.5)
+
+- 添加设置选择器选中行背景颜色的功能,新增属性 `selectRowColor`
+
+#### 2020-01-31(V2.5.3)
+
+- 新增属性:`pickerHeaderView`、`pickerFooterView`
+- 新增刷新选择器数据方法:`reloadData`
+
+#### 2020-01-05(V2.5.1)
+
+- 优化代码,添加 `BRDatePickerModeYM` 支持国际化英式日期
+
+#### 2020-01-02(V2.5.0)
+
+- 日期选择器新增属性:`showUnitType`(日期单位显示样式)、`minuteInterval`、`secondInterval`
+- 封装了常用的几种模板样式,使用更加简单便捷
+- 框架内默认适配深色模式显示
+
+#### 2019-12-26(V2.4.6)
+
+- 添加支持动态更新属性 `title` 、 `selectDate`、`pickerMode` 的值
+- 日期选择器添加 `showWeek` 属性,及新增 `BRDatePickerModeMS` 日期类型
+- 优化选择器【用法二】的使用,新增选择器滚动选择时回调的属性
+
+#### 2019-11-28(V2.4.5)
+
+- 日期选择器新增选择 ”至今“ 和 显示 ”今天“ 的功能,见以下两个属性:
+
+  `showToday` :控制是否显示 “今天” ,默认为 NO
+
+  `addToNow`:控制是否添加选择 “至今”,默认为 NO
+
+#### 2019-11-26(V2.4.3)
+
+- 日期选择器新增以下三种选择类型:
+
+  `BRDatePickerModeYMDHMS`(年月日时分秒)、`BRDatePickerModeYMDE`(年月日星期)、`BRDatePickerModeHMS`(时分秒)
+
+- 更新地址选择器地区数据源
+
+#### 2019-11-07(V2.4.2)
+
+- 日期选择器添加:BRDatePickerModeYMDH(yyyy-MM-dd HH)类型
+- 地址选择器添加:selectIndexs 属性,可根据索引去设置默认选择
+- 适配横屏及刘海屏安全区域显示效果
+
+#### 2019-11-04(V2.4.0)
+
+- 优化选择器子目录管理,方便轻量级、模块化集成
+
+  `pod 'BRPickerView'`	// 集成全部的功能
+
+  `pod 'BRPickerView/DatePickerView'`	// 仅集成日期选择器的功能
+
+  `pod 'BRPickerView/AddressPickerView'`	// 仅集成地址选择器的功能
+
+  `pod 'BRPickerView/StringPickerView'`	// 仅集成字符串选择器的功能
+
+#### 2019-11-01(V2.3.8)
+
+- 优化代码,添加更多的自定义样式属性
+
+#### 2019-10-30(V2.3.6)
+
+- 优化代码,添加国际化支持
+
+#### 2019-10-26(V2.3.5)
+
+- 添加传统的创建对象设置属性的使用方式
+- 开放设置选择器颜色及样式,适配深色模式
+- 更新省市区数据源,数据与政府官网最新公布的一致(参见:[行政区划代码](http://www.mca.gov.cn/article/sj/xzqh/2019/))
+- 支持将选择器添加到指定容器视图上(见BaseView.h文件,扩展一方法)
+- 支持将子视图添加到选择器上(见BaseView.h文件,扩展二方法)
+- 优化代码,配置Pod库的层级目录
+
+#### 2018-04-27(V2.2.1):
+
+- 修复bug,适配iPad和横屏显示。
+- 优化代码,提高框架适应性,降低内存消耗。
+
+#### 2018-04-03(V2.2.0)
+
+- 时间选择器新添加了7种显示类型(BRDatePickerMode),可根据自己项目的需求选择性使用。
+- 适配横屏,及 iPhoneX 底部安全区域。
+- 修改了最小时间和最大时间的参数名称(以前版本是传 NSString 类型, 现在传 NSDate 类型)
+- 修复比较时间大小时出现的bug。
+
+#### 2018-03-19(V2.1.3)
+
+- 修改地址选择器确认选择后的回调参数。
+- 现修改如下:可通过省市区的模型获取省市区的 name(名称)、code(id)、index(索引)`resultBlock:^(BRProvinceModel *province, BRCityModel *city, BRAreaModel *area) {}`
+- 去掉第三方依赖库 `MJExtension` ,修改为手动解析地址数据源。
+
+#### 2018-03-11(V2.1.2)
+
+- 重命名了Github用户名,更新项目相关的路径。(提示:pod之前的版本不受影响)
+
+#### 2018-02-28(V2.1.1)
+
+- 修复某些情况下无法用bundle加载本地数据源(BRCity.plist)bug。
+
+#### 2018-01-26(V2.1.0)
+
+- 给地址选择器添加了一个方法(见方法4),提供数据源参数,支持外部传入地区数据源。
+- 提示:要注意数据源格式,参考 BRCity.json。可以把 BRCity.json 文件的内容放到后台去维护,通过后台接口获取地区数据源(即 BRCity.json 文件的内容)。
+
+#### 2018-01-25(V2.0.0)
+
+- 更新了地址数据源(BRCity.plist),地区信息是2018年最新最全的,与微信的地区信息完全一致。
+- 支持自定义默认选择地址(格式:@[@"浙江省", @"杭州市", @"西湖区"]),支持下次点击进入地址选择器时,默认地址为上次选择的结果。
+- 修改了日期选择器、地址选择器、字符串选择器的接口方法(删除了之前的方法2)。
+- 添加了地址选择器显示类型,支持3种显示:只显示省份、显示省份和城市、显示省市区。
+
+#### 2018-01-05(V1.3.0)
+
+- 添加取消选择的回调方法(点击背景或取消按钮会执行 `cancelBlock` )
+- 合并了字符串选择器 数组数据源和plist数据源对应的方法,`dataSource` 参数支持两种类型:
+
+#### 2018-01-02(V1.2.0)
+
+- 添加支持自定义主题颜色的方法。
+
+#### 2017-11-26(V1.1.0)
+
+- 更换第三方依赖库。
+- 用MJExtension 替换了 原来的YYModel,以前没有注意导入YYModel,同时又导入YYKit会导致重复导入而冲突(另外使用YYModel时,手动导入和pod导入 其中的头文件和方法名也不一样,所以很容易出错)。
+
+#### 2017-11-16(V1.0.0)
+
+- 初始版本!
+
+# 许可证
+
+BRPickerView 使用 MIT 许可证,详情见 LICENSE 文件。

+ 85 - 0
Pods/CircleProgressBar/CircleProgressBarDemo/CircleProgressBar/CircleProgressBar.h

@@ -0,0 +1,85 @@
+//
+//  CircleProgressBar.h
+//  CircleProgressBar
+//
+//  Created by Andrew Cherkashin on 3/16/15.
+//  Copyright (c) 2015 Eclair. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+typedef NSString*(^StringGenerationBlock)(CGFloat progress);
+typedef NSAttributedString*(^AttributedStringGenerationBlock)(CGFloat progress);
+
+/** Class that represents CircleProgressBar itself.
+ 
+ CircleProgressBar can be initialized programmatically or using InterfaceBuilder.
+ 
+ To change progress in CircleProgressBar just use:
+ 
+ [ setProgress:(CGFloat) animated:(BOOL)animated];
+ 
+ Interface provides ability to customize each element of CircleProgressBar independently;
+ 
+ */
+IB_DESIGNABLE
+@interface CircleProgressBar : UIView
+
+/// @brief Width of Progress Bar
+@property (nonatomic) IBInspectable CGFloat progressBarWidth;
+/// @brief Progress color in Progress Bar
+@property (nonatomic) IBInspectable UIColor *progressBarProgressColor;
+/// @brief Track color in Progress Bar
+@property (nonatomic) IBInspectable UIColor *progressBarTrackColor;
+/// @brief Start Angle
+@property (nonatomic) IBInspectable CGFloat startAngle;
+
+/// @brief Whether HintView should be shown or not
+@property (nonatomic) IBInspectable BOOL hintHidden;
+/// @brief Inner spacing between Progress Bar and Hint View
+@property (nonatomic) IBInspectable CGFloat hintViewSpacing;
+/// @brief Hint View Background Color
+@property (nonatomic) IBInspectable UIColor *hintViewBackgroundColor;
+/// @brief Hint View Text Font
+@property (nonatomic) IBInspectable UIFont *hintTextFont;
+/// @brief Hint View Text Color
+@property (nonatomic) IBInspectable UIColor *hintTextColor;
+
+/** Used to set block that generates NSString according to progress, to show it in Hint View
+ 
+ @param StringGenerationBlock block with CGFloat progress parameter, that returns NSString*
+ */
+- (void)setHintTextGenerationBlock:(StringGenerationBlock)generationBlock;
+
+/** Used to set block that generates NSAttributedString according to progress, to show it in Hint View
+ 
+ @param AttributedStringGenerationBlock block with CGFloat progress parameter, that returns NSAttributedString*
+ */
+- (void)setHintAttributedGenerationBlock:(AttributedStringGenerationBlock)generationBlock;
+
+/// @brief Current ProgressBar's progress (Read-Only)
+/// To change ProgressBar's progress use setProgress:animated:
+@property (nonatomic, readonly) IBInspectable CGFloat progress;
+
+/// @brief Indicates of there is ongoing animation
+@property (nonatomic, readonly) BOOL isAnimating;
+
+/** Used to set progress with animation or without
+ 
+ @param progress progress to be set
+ @param animated should control animate progress change or not
+ */
+- (void)setProgress:(CGFloat)progress animated:(BOOL)animated;
+
+/** Used to set progress with animation and custom duration
+ 
+ @param progress progress to be set
+ @param animated should control animate progress change or not
+ @param duration animation duration (default is 0.2f)
+ */
+- (void)setProgress:(CGFloat)progress animated:(BOOL)animated duration:(CGFloat)duration;
+
+/// Used to stop ongoing animation
+- (void)stopAnimation;
+
+@end

+ 310 - 0
Pods/CircleProgressBar/CircleProgressBarDemo/CircleProgressBar/CircleProgressBar.m

@@ -0,0 +1,310 @@
+//
+//  CircleProgressBar.m
+//  CircleProgressBar
+//
+//  Created by Andrew Cherkashin on 3/16/15.
+//  Copyright (c) 2015 Eclair. All rights reserved.
+//
+
+#import "CircleProgressBar.h"
+
+// Common
+#define DEGREES_TO_RADIANS(angle) ((angle) / 180.0 * M_PI)
+
+// Progress Bar Defaults
+#define DefaultProgressBarProgressColor [UIColor colorWithRed:0.71 green:0.099 blue:0.099 alpha:0.7]
+#define DefaultProgressBarTrackColor [UIColor colorWithRed:1 green:1 blue:1 alpha:0.7]
+const CGFloat DefaultProgressBarWidth = 33.0f;
+
+// Hint View Defaults
+#define DefaultHintBackgroundColor [UIColor colorWithWhite:0 alpha:0.7]
+#define DefaultHintTextFont [UIFont fontWithName:@"HelveticaNeue-CondensedBlack" size:30.0f]
+#define DefaultHintTextColor [UIColor whiteColor]
+const CGFloat DefaultHintSpacing = 20.0f;
+const StringGenerationBlock DefaultHintTextGenerationBlock = ^NSString *(CGFloat progress) {
+    return [NSString stringWithFormat:@"%.0f%%", progress * 100];
+};
+
+// Animation Constants
+const CGFloat AnimationChangeTimeDuration = 0.2f;
+const CGFloat AnimationChangeTimeStep = 0.01f;
+
+@interface CircleProgressBar (Private)
+
+// Common
+- (CGFloat)progressAccordingToBounds:(CGFloat)progress;
+
+// Base Drawing
+- (void)drawBackground:(CGContextRef)context;
+
+// ProgressBar Drawing
+- (UIColor*)progressBarProgressColorForDrawing;
+- (UIColor*)progressBarTrackColorForDrawing;
+- (CGFloat)progressBarWidthForDrawing;
+- (void)drawProgressBar:(CGContextRef)context progressAngle:(CGFloat)progressAngle center:(CGPoint)center radius:(CGFloat)radius;
+
+// Hint Drawing
+- (CGFloat)hintViewSpacingForDrawing;
+- (UIColor*)hintViewBackgroundColorForDrawing;
+- (UIFont*)hintTextFontForDrawing;
+- (UIColor*)hintTextColorForDrawing;
+- (NSString*)stringRepresentationOfProgress:(CGFloat)progress;
+- (void)drawSimpleHintTextAtCenter:(CGPoint)center;
+- (void)drawAttributedHintTextAtCenter:(CGPoint)center;
+- (void)drawHint:(CGContextRef)context center:(CGPoint)center radius:(CGFloat)radius;
+
+// Animation
+- (void)animateProgressBarChangeFrom:(CGFloat)startProgress to:(CGFloat)endProgress duration:(CGFloat)duration;
+- (void)updateProgressBarForAnimation;
+
+@end
+
+@implementation CircleProgressBar {
+    NSTimer *_animationTimer;
+    CGFloat _currentAnimationProgress, _startProgress, _endProgress, _animationProgressStep;
+    StringGenerationBlock _hintTextGenerationBlock;
+    AttributedStringGenerationBlock _hintAttributedTextGenerationBlock;
+}
+
+- (BOOL)isAnimating {
+    return _animationTimer != nil;
+}
+
+- (void)setProgress:(CGFloat)progress animated:(BOOL)animated {
+    [self setProgress:progress animated:animated duration:AnimationChangeTimeDuration];
+}
+
+- (void)setProgress:(CGFloat)progress animated:(BOOL)animated duration:(CGFloat)duration; {
+    progress = [self progressAccordingToBounds:progress];
+    if (_progress == progress) {
+        return;
+    }
+    
+    [_animationTimer invalidate];
+    _animationTimer = nil;
+    
+    if (animated) {
+        [self animateProgressBarChangeFrom:_progress to:progress duration:duration];
+    } else {
+        _progress = progress;
+        [self setNeedsDisplay];
+    }
+}
+
+- (void)stopAnimation {
+    if (!self.isAnimating) {
+        return;
+    }
+    
+    [_animationTimer invalidate];
+    _animationTimer = nil;
+    _progress = _endProgress;
+    [self setNeedsDisplay];
+}
+
+- (void)drawRect:(CGRect)rect {
+    [super drawRect:rect];
+    
+    CGPoint innerCenter = CGPointMake(self.bounds.size.width / 2, self.bounds.size.height / 2);
+    CGFloat radius = MIN(innerCenter.x, innerCenter.y);
+    CGFloat currentProgressAngle = (_progress * 360) + _startAngle;
+    
+    CGContextRef context = UIGraphicsGetCurrentContext();
+    CGContextClearRect(context, rect);
+
+    [self drawBackground:context];
+    
+    [self drawProgressBar:context progressAngle:currentProgressAngle center:innerCenter radius:radius];
+    if (!_hintHidden) {
+        [self drawHint:context center:innerCenter radius:radius];
+    }
+}
+
+#pragma mark - Setters with View Update
+
+- (void)setProgressBarWidth:(CGFloat)progressBarWidth {
+    _progressBarWidth = progressBarWidth;
+    [self setNeedsDisplay];
+}
+
+- (void)setProgressBarProgressColor:(UIColor *)progressBarProgressColor {
+    _progressBarProgressColor = progressBarProgressColor;
+    [self setNeedsDisplay];
+}
+
+- (void)setProgressBarTrackColor:(UIColor *)progressBarTrackColor {
+    _progressBarTrackColor = progressBarTrackColor;
+    [self setNeedsDisplay];
+}
+
+- (void)setHintHidden:(BOOL)isHintHidden {
+    _hintHidden = isHintHidden;
+    [self setNeedsDisplay];
+}
+
+- (void)setHintViewSpacing:(CGFloat)hintViewSpacing {
+    _hintViewSpacing = hintViewSpacing;
+    [self setNeedsDisplay];
+}
+
+- (void)setHintViewBackgroundColor:(UIColor *)hintViewBackgroundColor {
+    _hintViewBackgroundColor = hintViewBackgroundColor;
+    [self setNeedsDisplay];
+}
+
+- (void)setHintTextFont:(UIFont *)hintTextFont {
+    _hintTextFont = hintTextFont;
+    [self setNeedsDisplay];
+}
+
+- (void)setHintTextColor:(UIColor *)hintTextColor {
+    _hintTextColor = hintTextColor;
+    [self setNeedsDisplay];
+}
+
+- (void)setHintTextGenerationBlock:(StringGenerationBlock)generationBlock {
+    _hintTextGenerationBlock = generationBlock;
+    [self setNeedsDisplay];
+}
+
+- (void)setHintAttributedGenerationBlock:(AttributedStringGenerationBlock)generationBlock {
+    _hintAttributedTextGenerationBlock = generationBlock;
+    [self setNeedsDisplay];
+}
+
+- (void)setStartAngle:(CGFloat)startAngle {
+    _startAngle = startAngle;
+    [self setNeedsDisplay];
+}
+
+@end
+
+@implementation CircleProgressBar (Private)
+
+#pragma mark - Common
+
+- (CGFloat)progressAccordingToBounds:(CGFloat)progress {
+    progress = MIN(progress, 1);
+    progress = MAX(progress, 0);
+    return progress;
+}
+
+#pragma mark - Base Drawing
+
+- (void)drawBackground:(CGContextRef)context {
+    CGContextSetFillColorWithColor(context, self.backgroundColor.CGColor);
+    CGContextFillRect(context, self.bounds);
+}
+
+#pragma mark - ProgressBar Drawing
+
+- (UIColor*)progressBarProgressColorForDrawing {
+    return (_progressBarProgressColor != nil ? _progressBarProgressColor : DefaultProgressBarProgressColor);
+}
+
+- (UIColor*)progressBarTrackColorForDrawing {
+    return (_progressBarTrackColor != nil ? _progressBarTrackColor : DefaultProgressBarTrackColor);
+}
+
+- (CGFloat)progressBarWidthForDrawing {
+    return (_progressBarWidth > 0 ? _progressBarWidth : DefaultProgressBarWidth);
+}
+
+- (void)drawProgressBar:(CGContextRef)context progressAngle:(CGFloat)progressAngle center:(CGPoint)center radius:(CGFloat)radius {
+    CGFloat barWidth = self.progressBarWidthForDrawing;
+    if (barWidth > radius) {
+        barWidth = radius;
+    }
+    
+    CGContextSetFillColorWithColor(context, self.progressBarProgressColorForDrawing.CGColor);
+    CGContextBeginPath(context);
+    CGContextAddArc(context, center.x, center.y, radius, DEGREES_TO_RADIANS(_startAngle), DEGREES_TO_RADIANS(progressAngle), 0);
+    CGContextAddArc(context, center.x, center.y, radius - barWidth, DEGREES_TO_RADIANS(progressAngle), DEGREES_TO_RADIANS(_startAngle), 1);
+    CGContextClosePath(context);
+    CGContextFillPath(context);
+    
+    CGContextSetFillColorWithColor(context, self.progressBarTrackColorForDrawing.CGColor);
+    CGContextBeginPath(context);
+    CGContextAddArc(context, center.x, center.y, radius, DEGREES_TO_RADIANS(progressAngle), DEGREES_TO_RADIANS(_startAngle + 360), 0);
+    CGContextAddArc(context, center.x, center.y, radius - barWidth, DEGREES_TO_RADIANS(_startAngle + 360), DEGREES_TO_RADIANS(progressAngle), 1);
+    CGContextClosePath(context);
+    CGContextFillPath(context);
+}
+
+#pragma mark - Hint Drawing
+
+- (CGFloat)hintViewSpacingForDrawing {
+    return (_hintViewSpacing != 0 ? _hintViewSpacing : DefaultHintSpacing);
+}
+
+- (UIColor*)hintViewBackgroundColorForDrawing {
+    return (_hintViewBackgroundColor != nil ? _hintViewBackgroundColor : DefaultHintBackgroundColor);
+}
+
+- (UIFont*)hintTextFontForDrawing {
+    return (_hintTextFont != nil ? _hintTextFont : DefaultHintTextFont);
+}
+
+- (UIColor*)hintTextColorForDrawing {
+    return (_hintTextColor != nil ? _hintTextColor : DefaultHintTextColor);
+}
+
+- (NSString*)stringRepresentationOfProgress:(CGFloat)progress {
+    return (_hintTextGenerationBlock != nil ? _hintTextGenerationBlock(progress) : DefaultHintTextGenerationBlock(progress));
+}
+
+- (void)drawSimpleHintTextAtCenter:(CGPoint)center {
+    NSString *progressString = [self stringRepresentationOfProgress:_progress];
+    CGSize hintTextSize = [progressString boundingRectWithSize:CGSizeZero options:NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName: self.hintTextFontForDrawing} context:nil].size;
+    [progressString drawAtPoint:CGPointMake(center.x - hintTextSize.width / 2, center.y - hintTextSize.height / 2) withAttributes:@{NSFontAttributeName: self.hintTextFontForDrawing, NSForegroundColorAttributeName: self.hintTextColorForDrawing}];
+}
+
+- (void)drawAttributedHintTextAtCenter:(CGPoint)center {
+    NSAttributedString *progressString = _hintAttributedTextGenerationBlock(_progress);
+    CGSize hintTextSize = [progressString boundingRectWithSize:CGSizeZero options:NSStringDrawingUsesFontLeading context:nil].size;
+    [progressString drawAtPoint:CGPointMake(center.x - hintTextSize.width / 2, center.y - hintTextSize.height / 2)];
+}
+
+- (void)drawHint:(CGContextRef)context center:(CGPoint)center radius:(CGFloat)radius {
+    CGFloat barWidth = self.progressBarWidthForDrawing;
+    if (barWidth + self.hintViewSpacingForDrawing > radius) {
+        return;
+    }
+    
+    CGContextSetFillColorWithColor(context, self.hintViewBackgroundColorForDrawing.CGColor);
+    CGContextBeginPath(context);
+    CGContextAddArc(context, center.x, center.y, radius - barWidth - self.hintViewSpacingForDrawing, DEGREES_TO_RADIANS(0), DEGREES_TO_RADIANS(360), 1);
+    CGContextClosePath(context);
+    CGContextFillPath(context);
+    
+    if (_hintAttributedTextGenerationBlock != nil) {
+        [self drawAttributedHintTextAtCenter:center];
+    } else {
+        [self drawSimpleHintTextAtCenter:center];
+    }
+}
+
+#pragma mark - Amination
+
+- (void)animateProgressBarChangeFrom:(CGFloat)startProgress to:(CGFloat)endProgress duration:(CGFloat)duration {
+    _currentAnimationProgress = _startProgress = startProgress;
+    _endProgress = endProgress;
+    
+    _animationProgressStep = (_endProgress - _startProgress) * AnimationChangeTimeStep / duration;
+    
+    _animationTimer = [NSTimer scheduledTimerWithTimeInterval:AnimationChangeTimeStep target:self selector:@selector(updateProgressBarForAnimation) userInfo:nil repeats:YES];
+    [[NSRunLoop currentRunLoop] addTimer:_animationTimer forMode:NSRunLoopCommonModes];
+}
+
+- (void)updateProgressBarForAnimation {
+    _currentAnimationProgress += _animationProgressStep;
+    _progress = _currentAnimationProgress;
+    if ((_animationProgressStep > 0 && _currentAnimationProgress >= _endProgress) || (_animationProgressStep < 0 && _currentAnimationProgress <= _endProgress)) {
+        [_animationTimer invalidate];
+        _animationTimer = nil;
+        _progress = _endProgress;
+    }
+    [self setNeedsDisplay];
+}
+
+@end

+ 22 - 0
Pods/CircleProgressBar/LICENSE

@@ -0,0 +1,22 @@
+The MIT License (MIT)
+
+Copyright (c) 2015 Cherkashin Andrey
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+

+ 115 - 0
Pods/CircleProgressBar/README.md

@@ -0,0 +1,115 @@
+CircleProgressBar
+=================
+
+Circle Progress Bar iOS Control.
+
+Require iOS 7.0+ or tvOS 9.0+
+
+![CircleProgressBar Screenshot-iOS-Example](https://raw.githubusercontent.com/Eclair/CircleProgressBar/master/Screenshots/ios-screen01.png)
+![CircleProgressBar Screenshot-iOS-Example2](https://raw.githubusercontent.com/Eclair/CircleProgressBar/master/Screenshots/ios-screen02.png)
+
+Installation
+============
+
+You can install this control in two ways:
+
+1. Using CocoaPods:
+
+```ruby
+pod 'CircleProgressBar', '~> 0.32’
+```
+
+2. Manually:
+
+  Download source from this repository and copy CircleProgressBarDemo/CircleProgressBar folder to your project.
+
+	Don't forget to add _*UIKit*_ and _*QuartzCore*_ frameworks to your project.
+
+How to use
+==========
+
+_NOTE: If you installed this control manually - please be sure that you've added UIKit and QuartzCore frameworks to your project._
+
+_NOTE: If you're using rectangular view for CircleProgressBar control instead of square, ProgressBar will fit available area and will be drawn in center of it._
+
+You can simply add UIView in Interface Builder to your controller and change it's class to "CircleProgressBar" (overridden _initWithCoder_ method will be called) or create CircleProgressBar programmatically using _init_ or _initWithFrame_ methods.
+
+Using Interface Builder you'll take advantage of Xcode 6 new live rendering feature to customize control according to your needs on the fly (will be explained below in "Customization" section).
+
+To change progress, simply call "setProgress:animated:" method of CircleProgressBar instance:
+
+```objective-c
+[_circleProgressBar setProgress:(CGFloat)progress animated:(BOOL)animated];
+```
+
+or "setProgress:animated:duration:" method to define custom animation time:
+
+```objective-c
+[_circleProgressBar setProgress:(CGFloat)progress animated:(BOOL)animated duration:(CGFloat)duration];
+```
+
+To check if there is ongoing animation use `isAnimating` property.
+To stop an ongoing animation, you can use `stopAnimation` method. In this case it will set the progress to animation end value:
+
+```objective-c
+[_circleProgressBar stopAnimation];
+```
+
+Customization
+=============
+
+CircleProgressBar provides many customization properties:
+
+```objective-c
+// Progress Bar Customization
+@property (nonatomic) CGFloat progressBarWidth;
+@property (nonatomic) UIColor *progressBarProgressColor;
+@property (nonatomic) UIColor *progressBarTrackColor;
+@property (nonatomic) CGFloat startAngle;
+
+// Hint View Customization (inside progress bar)
+@property (nonatomic) BOOL hintHidden;
+@property (nonatomic) CGFloat hintViewSpacing;
+@property (nonatomic) UIColor *hintViewBackgroundColor;
+@property (nonatomic) UIFont *hintTextFont;
+@property (nonatomic) UIColor *hintTextColor;
+```
+
+Using these customization properties you can define Progress Bar's width, color of filled part, color of empty part, Progress Bar's start angle, Hint View's spacing (between progress bar and hint view), background color, hint text color and hint text font.
+
+If you want to hide HintView you can simply set hintHidden property to NO.
+
+To customize text inside HintView you can simply set TextGenerationBlock:
+
+```objective-c
+- (void)setHintTextGenerationBlock:(StringGenerationBlock)generationBlock;
+```
+
+For example this way:
+
+```objective-c
+[_circleProgressBar setHintTextGenerationBlock:^NSString *(CGFloat progress) {
+  return [NSString stringWithFormat:@"%.0f / 255", progress * 255];
+}];
+```
+
+If you want to use NSAttributedString you can set instead HintAttributedGenerationBlock:
+
+```objective-c
+- (void)setHintAttributedGenerationBlock:(AttributedStringGenerationBlock)generationBlock;
+```
+
+If you using Interface Builder, you can take an advantage of Xcode 6 live render with IBDesignable and IBInspectable features to customize control:
+
+![CircleProgressBar Screenshot-Xcode-InterfaceBuilder](https://raw.githubusercontent.com/Eclair/CircleProgressBar/master/Screenshots/xcode-screen01.png)
+
+License (MIT)
+=============
+
+Copyright (c) 2015 Cherkashin Andrey
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

+ 58 - 0
Pods/FDFullscreenPopGesture/FDFullscreenPopGesture/UINavigationController+FDFullscreenPopGesture.h

@@ -0,0 +1,58 @@
+// The MIT License (MIT)
+//
+// Copyright (c) 2015-2016 forkingdog ( https://github.com/forkingdog )
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in all
+// copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+// SOFTWARE.
+
+#import <UIKit/UIKit.h>
+
+/// "UINavigation+FDFullscreenPopGesture" extends UINavigationController's swipe-
+/// to-pop behavior in iOS 7+ by supporting fullscreen pan gesture. Instead of
+/// screen edge, you can now swipe from any place on the screen and the onboard
+/// interactive pop transition works seamlessly.
+///
+/// Adding the implementation file of this category to your target will
+/// automatically patch UINavigationController with this feature.
+@interface UINavigationController (FDFullscreenPopGesture)
+
+/// The gesture recognizer that actually handles interactive pop.
+@property (nonatomic, strong, readonly) UIPanGestureRecognizer *fd_fullscreenPopGestureRecognizer;
+
+/// A view controller is able to control navigation bar's appearance by itself,
+/// rather than a global way, checking "fd_prefersNavigationBarHidden" property.
+/// Default to YES, disable it if you don't want so.
+@property (nonatomic, assign) BOOL fd_viewControllerBasedNavigationBarAppearanceEnabled;
+
+@end
+
+/// Allows any view controller to disable interactive pop gesture, which might
+/// be necessary when the view controller itself handles pan gesture in some
+/// cases.
+@interface UIViewController (FDFullscreenPopGesture)
+
+/// Whether the interactive pop gesture is disabled when contained in a navigation
+/// stack.
+@property (nonatomic, assign) BOOL fd_interactivePopDisabled;
+
+/// Indicate this view controller prefers its navigation bar hidden or not,
+/// checked when view controller based navigation bar's appearance is enabled.
+/// Default to NO, bars are more likely to show.
+@property (nonatomic, assign) BOOL fd_prefersNavigationBarHidden;
+
+@end

+ 227 - 0
Pods/FDFullscreenPopGesture/FDFullscreenPopGesture/UINavigationController+FDFullscreenPopGesture.m

@@ -0,0 +1,227 @@
+// The MIT License (MIT)
+//
+// Copyright (c) 2015-2016 forkingdog ( https://github.com/forkingdog )
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in all
+// copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+// SOFTWARE.
+
+#import "UINavigationController+FDFullscreenPopGesture.h"
+#import <objc/runtime.h>
+
+@interface _FDFullscreenPopGestureRecognizerDelegate : NSObject <UIGestureRecognizerDelegate>
+
+@property (nonatomic, weak) UINavigationController *navigationController;
+
+@end
+
+@implementation _FDFullscreenPopGestureRecognizerDelegate
+
+- (BOOL)gestureRecognizerShouldBegin:(UIPanGestureRecognizer *)gestureRecognizer
+{
+    // Ignore when no view controller is pushed into the navigation stack.
+    if (self.navigationController.viewControllers.count <= 1) {
+        return NO;
+    }
+    
+    // Disable when the active view controller doesn't allow interactive pop.
+    UIViewController *topViewController = self.navigationController.viewControllers.lastObject;
+    if (topViewController.fd_interactivePopDisabled) {
+        return NO;
+    }
+
+    // Ignore pan gesture when the navigation controller is currently in transition.
+    if ([[self.navigationController valueForKey:@"_isTransitioning"] boolValue]) {
+        return NO;
+    }
+    
+    // Prevent calling the handler when the gesture begins in an opposite direction.
+    CGPoint translation = [gestureRecognizer translationInView:gestureRecognizer.view];
+    if (translation.x <= 0) {
+        return NO;
+    }
+    
+    return YES;
+}
+
+@end
+
+typedef void (^_FDViewControllerWillAppearInjectBlock)(UIViewController *viewController, BOOL animated);
+
+@interface UIViewController (FDFullscreenPopGesturePrivate)
+
+@property (nonatomic, copy) _FDViewControllerWillAppearInjectBlock fd_willAppearInjectBlock;
+
+@end
+
+@implementation UIViewController (FDFullscreenPopGesturePrivate)
+
++ (void)load
+{
+    Method originalMethod = class_getInstanceMethod(self, @selector(viewWillAppear:));
+    Method swizzledMethod = class_getInstanceMethod(self, @selector(fd_viewWillAppear:));
+    method_exchangeImplementations(originalMethod, swizzledMethod);
+}
+
+- (void)fd_viewWillAppear:(BOOL)animated
+{
+    // Forward to primary implementation.
+    [self fd_viewWillAppear:animated];
+    
+    if (self.fd_willAppearInjectBlock) {
+        self.fd_willAppearInjectBlock(self, animated);
+    }
+}
+
+- (_FDViewControllerWillAppearInjectBlock)fd_willAppearInjectBlock
+{
+    return objc_getAssociatedObject(self, _cmd);
+}
+
+- (void)setFd_willAppearInjectBlock:(_FDViewControllerWillAppearInjectBlock)block
+{
+    objc_setAssociatedObject(self, @selector(fd_willAppearInjectBlock), block, OBJC_ASSOCIATION_COPY_NONATOMIC);
+}
+
+@end
+
+@implementation UINavigationController (FDFullscreenPopGesture)
+
++ (void)load
+{
+    // Inject "-pushViewController:animated:"
+    Method originalMethod = class_getInstanceMethod(self, @selector(pushViewController:animated:));
+    Method swizzledMethod = class_getInstanceMethod(self, @selector(fd_pushViewController:animated:));
+    method_exchangeImplementations(originalMethod, swizzledMethod);
+}
+
+- (void)fd_pushViewController:(UIViewController *)viewController animated:(BOOL)animated
+{
+    if (![self.interactivePopGestureRecognizer.view.gestureRecognizers containsObject:self.fd_fullscreenPopGestureRecognizer]) {
+        
+        // Add our own gesture recognizer to where the onboard screen edge pan gesture recognizer is attached to.
+        [self.interactivePopGestureRecognizer.view addGestureRecognizer:self.fd_fullscreenPopGestureRecognizer];
+
+        // Forward the gesture events to the private handler of the onboard gesture recognizer.
+        NSArray *internalTargets = [self.interactivePopGestureRecognizer valueForKey:@"targets"];
+        id internalTarget = [internalTargets.firstObject valueForKey:@"target"];
+        SEL internalAction = NSSelectorFromString(@"handleNavigationTransition:");
+        self.fd_fullscreenPopGestureRecognizer.delegate = self.fd_popGestureRecognizerDelegate;
+        [self.fd_fullscreenPopGestureRecognizer addTarget:internalTarget action:internalAction];
+
+        // Disable the onboard gesture recognizer.
+        self.interactivePopGestureRecognizer.enabled = NO;
+    }
+    
+    // Handle perferred navigation bar appearance.
+    [self fd_setupViewControllerBasedNavigationBarAppearanceIfNeeded:viewController];
+    
+    // Forward to primary implementation.
+    [self fd_pushViewController:viewController animated:animated];
+}
+
+- (void)fd_setupViewControllerBasedNavigationBarAppearanceIfNeeded:(UIViewController *)appearingViewController
+{
+    if (!self.fd_viewControllerBasedNavigationBarAppearanceEnabled) {
+        return;
+    }
+    
+    __weak typeof(self) weakSelf = self;
+    _FDViewControllerWillAppearInjectBlock block = ^(UIViewController *viewController, BOOL animated) {
+        __strong typeof(weakSelf) strongSelf = weakSelf;
+        if (strongSelf) {
+            [strongSelf setNavigationBarHidden:viewController.fd_prefersNavigationBarHidden animated:animated];
+        }
+    };
+    
+    // Setup will appear inject block to appearing view controller.
+    // Setup disappearing view controller as well, because not every view controller is added into
+    // stack by pushing, maybe by "-setViewControllers:".
+    appearingViewController.fd_willAppearInjectBlock = block;
+    UIViewController *disappearingViewController = self.viewControllers.lastObject;
+    if (disappearingViewController && !disappearingViewController.fd_willAppearInjectBlock) {
+        disappearingViewController.fd_willAppearInjectBlock = block;
+    }
+}
+
+- (_FDFullscreenPopGestureRecognizerDelegate *)fd_popGestureRecognizerDelegate
+{
+    _FDFullscreenPopGestureRecognizerDelegate *delegate = objc_getAssociatedObject(self, _cmd);
+
+    if (!delegate) {
+        delegate = [[_FDFullscreenPopGestureRecognizerDelegate alloc] init];
+        delegate.navigationController = self;
+        
+        objc_setAssociatedObject(self, _cmd, delegate, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
+    }
+    return delegate;
+}
+
+- (UIPanGestureRecognizer *)fd_fullscreenPopGestureRecognizer
+{
+    UIPanGestureRecognizer *panGestureRecognizer = objc_getAssociatedObject(self, _cmd);
+
+    if (!panGestureRecognizer) {
+        panGestureRecognizer = [[UIPanGestureRecognizer alloc] init];
+        panGestureRecognizer.maximumNumberOfTouches = 1;
+        
+        objc_setAssociatedObject(self, _cmd, panGestureRecognizer, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
+    }
+    return panGestureRecognizer;
+}
+
+- (BOOL)fd_viewControllerBasedNavigationBarAppearanceEnabled
+{
+    NSNumber *number = objc_getAssociatedObject(self, _cmd);
+    if (number) {
+        return number.boolValue;
+    }
+    self.fd_viewControllerBasedNavigationBarAppearanceEnabled = YES;
+    return YES;
+}
+
+- (void)setFd_viewControllerBasedNavigationBarAppearanceEnabled:(BOOL)enabled
+{
+    SEL key = @selector(fd_viewControllerBasedNavigationBarAppearanceEnabled);
+    objc_setAssociatedObject(self, key, @(enabled), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
+}
+
+@end
+
+@implementation UIViewController (FDFullscreenPopGesture)
+
+- (BOOL)fd_interactivePopDisabled
+{
+    return [objc_getAssociatedObject(self, _cmd) boolValue];
+}
+
+- (void)setFd_interactivePopDisabled:(BOOL)disabled
+{
+    objc_setAssociatedObject(self, @selector(fd_interactivePopDisabled), @(disabled), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
+}
+
+- (BOOL)fd_prefersNavigationBarHidden
+{
+    return [objc_getAssociatedObject(self, _cmd) boolValue];
+}
+
+- (void)setFd_prefersNavigationBarHidden:(BOOL)hidden
+{
+    objc_setAssociatedObject(self, @selector(fd_prefersNavigationBarHidden), @(hidden), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
+}
+
+@end

+ 22 - 0
Pods/FDFullscreenPopGesture/LICENSE

@@ -0,0 +1,22 @@
+The MIT License (MIT)
+
+Copyright (c) 2015 
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+

+ 62 - 0
Pods/FDFullscreenPopGesture/README.md

@@ -0,0 +1,62 @@
+# FDFullscreenPopGesture
+An UINavigationController's category to enable fullscreen pop gesture in an iOS7+ system style with AOP.
+
+# Overview
+
+![snapshot](https://raw.githubusercontent.com/forkingdog/FDFullscreenPopGesture/master/Snapshots/snapshot0.gif)
+
+这个扩展来自 @J_雨 同学的这个很天才的思路,他的文章地址:[http://www.jianshu.com/p/d39f7d22db6c](http://www.jianshu.com/p/d39f7d22db6c)
+
+# Usage
+
+**AOP**, just add 2 files and **no need** for any setups, all navigation controllers will be able to use fullscreen pop gesture automatically.  
+
+To disable this pop gesture of a navigation controller:  
+
+``` objc
+navigationController.fd_fullscreenPopGestureRecognizer.enabled = NO;
+```
+
+To disable this pop gesture of a view controller:  
+
+``` objc
+viewController.fd_interactivePopDisabled = YES;
+```
+
+Require at least iOS **7.0**.
+
+# View Controller Based Navigation Bar Appearance
+
+It handles navigation bar transition properly when using fullscreen gesture to push or pop a view controller:  
+
+- with bar -> without bar
+- without bar -> with bar
+- without bar -> without bar
+
+![snapshot with bar states](https://raw.githubusercontent.com/forkingdog/FDFullscreenPopGesture/master/Snapshots/snapshot1.gif)
+
+This opmiziation is enabled by default, from now on you don't need to call **UINavigationController**'s `-setNavigationBarHidden:animated:` method, instead, use view controller's specific API to hide its bar:  
+
+``` objc
+- (void)viewDidLoad {
+    [super viewDidLoad];
+    self.fd_prefersNavigationBarHidden = NO;
+}
+```
+
+And this property is **YES** by default.
+
+# Installation
+
+Use cocoapods  
+
+``` ruby
+pod 'FDFullscreenPopGesture', '1.1'
+```
+# Release Notes
+
+**1.1** - View controller based navigation bar appearance and transition.  
+**1.0** - Fullscreen pop gesture.  
+
+# License  
+MIT

BIN
Pods/FMDB/.DS_Store


+ 28 - 0
Pods/FMDB/LICENSE.txt

@@ -0,0 +1,28 @@
+If you are using FMDB in your project, I'd love to hear about it.  Let Gus know
+by sending an email to gus@flyingmeat.com.
+
+And if you happen to come across either Gus Mueller or Rob Ryan in a bar, you
+might consider purchasing a drink of their choosing if FMDB has been useful to
+you.
+
+Finally, and shortly, this is the MIT License.
+
+Copyright (c) 2008-2014 Flying Meat Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.

+ 546 - 0
Pods/FMDB/README.markdown

@@ -0,0 +1,546 @@
+# FMDB v2.7
+<!--[![Platform](https://img.shields.io/cocoapods/p/FMDB.svg?style=flat)](http://cocoadocs.org/docsets/Alamofire)-->
+[![CocoaPods Compatible](https://img.shields.io/cocoapods/v/FMDB.svg)](https://img.shields.io/cocoapods/v/FMDB.svg)
+[![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
+
+This is an Objective-C wrapper around [SQLite](https://sqlite.org/).
+
+## The FMDB Mailing List:
+https://groups.google.com/group/fmdb
+
+## Read the SQLite FAQ:
+https://www.sqlite.org/faq.html
+
+Since FMDB is built on top of SQLite, you're going to want to read this page top to bottom at least once.  And while you're there, make sure to bookmark the SQLite Documentation page: https://www.sqlite.org/docs.html
+
+## Contributing
+Do you have an awesome idea that deserves to be in FMDB?  You might consider pinging ccgus first to make sure he hasn't already ruled it out for some reason.  Otherwise pull requests are great, and make sure you stick to the local coding conventions.  However, please be patient and if you haven't heard anything from ccgus for a week or more, you might want to send a note asking what's up.
+
+## Installing
+
+### CocoaPods
+
+FMDB can be installed using [CocoaPods](https://cocoapods.org/).
+
+If you haven't done so already, you might want to initialize the project, to have it produce a `Podfile` template for you:
+
+```
+$ pod init
+```
+
+Then, edit the `Podfile`, adding `FMDB`:
+
+```ruby
+# Uncomment the next line to define a global platform for your project
+# platform :ios, '12.0'
+
+target 'MyApp' do
+    # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
+    use_frameworks!
+
+    # Pods for MyApp2
+
+    pod 'FMDB'
+    # pod 'FMDB/FTS'   # FMDB with FTS
+    # pod 'FMDB/standalone'   # FMDB with latest SQLite amalgamation source
+    # pod 'FMDB/standalone/FTS'   # FMDB with latest SQLite amalgamation source and FTS
+    # pod 'FMDB/SQLCipher'   # FMDB with SQLCipher
+end
+```
+
+Then install the pods:
+
+```
+$ pod install
+```
+
+Then open the `.xcworkspace` rather than the `.xcodeproj`.
+
+For more information on Cocoapods visit https://cocoapods.org.
+
+**If using FMDB with [SQLCipher](https://www.zetetic.net/sqlcipher/) you must use the FMDB/SQLCipher subspec. The FMDB/SQLCipher subspec declares SQLCipher as a dependency, allowing FMDB to be compiled with the `-DSQLITE_HAS_CODEC` flag.**
+
+### Carthage
+
+Once you make sure you have [the latest version of Carthage](https://github.com/Carthage/Carthage/releases), you can open up a command line terminal, navigate to your project's main directory, and then do the following commands:
+
+```
+$ echo ' github "ccgus/fmdb" ' > ./Cartfile
+$ carthage update
+```
+
+You can then configure your project as outlined in Carthage's [Getting Started](https://github.com/Carthage/Carthage#getting-started) (i.e. for iOS, adding the framework to the "Link Binary with Libraries" in your target and adding the `copy-frameworks` script; in macOS, adding the framework to the list of "Embedded Binaries").
+
+### Swift Package Manager
+
+Declare FMDB as a package dependency.
+```swift
+.package(
+    name: "FMDB", 
+    url: "https://github.com/ccgus/fmdb", 
+    .upToNextMinor(from: "2.7.12")),
+```
+
+Use FMDB in target dependencies
+```swift
+.product(name: "FMDB", package: "FMDB")
+```
+
+## FMDB Class Reference:
+https://ccgus.github.io/fmdb/html/index.html
+
+## Automatic Reference Counting (ARC) or Manual Memory Management?
+You can use either style in your Cocoa project.  FMDB will figure out which you are using at compile time and do the right thing.
+
+## What's New in FMDB 2.7
+
+FMDB 2.7 attempts to support a more natural interface. This represents a fairly significant change for Swift developers (audited for nullability; shifted to properties in external interfaces where possible rather than methods; etc.). For Objective-C developers, this should be a fairly seamless transition (unless you were using the ivars that were previously exposed in the public interface, which you shouldn't have been doing, anyway!). 
+
+### Nullability and Swift Optionals
+
+FMDB 2.7 is largely the same as prior versions, but has been audited for nullability. For Objective-C users, this simply means that if you perform a static analysis of your FMDB-based project, you may receive more meaningful warnings as you review your project, but there are likely to be few, if any, changes necessary in your code.
+
+For Swift users, this nullability audit results in changes that are not entirely backward compatible with FMDB 2.6, but is a little more Swifty. Before FMDB was audited for nullability, Swift was forced to defensively assume that variables were optional, but the library now more accurately knows which properties and method parameters are optional, and which are not.
+
+This means, though, that Swift code written for FMDB 2.7 may require changes. For example, consider the following Swift 3/Swift 4 code for FMDB 2.6:
+
+```swift
+queue.inTransaction { db, rollback in
+    do {
+        guard let db == db else {
+            // handle error here
+            return
+        }
+
+        try db.executeUpdate("INSERT INTO foo (bar) VALUES (?)", values: [1])
+        try db.executeUpdate("INSERT INTO foo (bar) VALUES (?)", values: [2])
+    } catch {
+        rollback?.pointee = true
+    }
+}
+```
+
+Because FMDB 2.6 was not audited for nullability, Swift inferred that `db` and `rollback` were optionals. But, now, in FMDB 2.7, Swift now knows that, for example, neither `db` nor `rollback` above can be `nil`, so they are no longer optionals. Thus it becomes:
+
+```swift
+queue.inTransaction { db, rollback in
+    do {
+        try db.executeUpdate("INSERT INTO foo (bar) VALUES (?)", values: [1])
+        try db.executeUpdate("INSERT INTO foo (bar) VALUES (?)", values: [2])
+    } catch {
+        rollback.pointee = true
+    }
+}
+```
+
+### Custom Functions
+
+In the past, when writing custom functions, you would have to generally include your own `@autoreleasepool` block to avoid problems when writing functions that scanned through a large table. Now, FMDB will automatically wrap it in an autorelease pool, so you don't have to.
+
+Also, in the past, when retrieving the values passed to the function, you had to drop down to the SQLite C API and include your own `sqlite3_value_XXX` calls. There are now `FMDatabase` methods, `valueInt`, `valueString`, etc., so you can stay within Swift and/or Objective-C, without needing to call the C functions yourself. Likewise, when specifying the return values, you no longer need to call `sqlite3_result_XXX` C API, but rather you can use `FMDatabase` methods, `resultInt`, `resultString`, etc. There is a new `enum` for `valueType` called `SqliteValueType`, which can be used for checking the type of parameter passed to the custom function.
+
+Thus, you can do something like (as of Swift 3):
+
+```swift
+db.makeFunctionNamed("RemoveDiacritics", arguments: 1) { context, argc, argv in
+    guard db.valueType(argv[0]) == .text || db.valueType(argv[0]) == .null else {
+        db.resultError("Expected string parameter", context: context)
+        return
+    }
+
+    if let string = db.valueString(argv[0])?.folding(options: .diacriticInsensitive, locale: nil) {
+        db.resultString(string, context: context)
+    } else {
+        db.resultNull(context: context)
+    }
+}
+```
+
+And you can then use that function in your SQL (in this case, matching both "Jose" and "José"):
+
+```sql
+SELECT * FROM employees WHERE RemoveDiacritics(first_name) LIKE 'jose'
+```
+
+Note, the method `makeFunctionNamed:maximumArguments:withBlock:` has been renamed to `makeFunctionNamed:arguments:block:`, to more accurately reflect the functional intent of the second parameter.
+
+### API Changes
+
+In addition to the `makeFunctionNamed` noted above, there are a few other API changes. Specifically, 
+
+ - To become consistent with the rest of the API, the methods `objectForColumnName` and `UTF8StringForColumnName` have been renamed to `objectForColumn` and `UTF8StringForColumn`.
+
+ - Note, the `objectForColumn` (and the associted subscript operator) now returns `nil` if an invalid column name/index is passed to it. It used to return `NSNull`.
+
+ - To avoid confusion with `FMDatabaseQueue` method `inTransaction`, which performs transactions, the `FMDatabase` method to determine whether you are in a transaction or not, `inTransaction`, has been replaced with a read-only property, `isInTransaction`. 
+
+ - Several functions have been converted to properties, namely, `databasePath`, `maxBusyRetryTimeInterval`, `shouldCacheStatements`, `sqliteHandle`, `hasOpenResultSets`, `lastInsertRowId`, `changes`, `goodConnection`, `columnCount`, `resultDictionary`, `applicationID`, `applicationIDString`, `userVersion`, `countOfCheckedInDatabases`, `countOfCheckedOutDatabases`, and `countOfOpenDatabases`. For Objective-C users, this has little material impact, but for Swift users, it results in a slightly more natural interface. Note: For Objective-C developers, previously versions of FMDB exposed many ivars (but we hope you weren't using them directly, anyway!), but the implmentation details for these are no longer exposed.
+
+### URL Methods
+
+In keeping with Apple's shift from paths to URLs, there are now `NSURL` renditions of the various `init` methods, previously only accepting paths. 
+
+## Usage
+There are three main classes in FMDB:
+
+1. `FMDatabase` - Represents a single SQLite database.  Used for executing SQL statements.
+2. `FMResultSet` - Represents the results of executing a query on an `FMDatabase`.
+3. `FMDatabaseQueue` - If you're wanting to perform queries and updates on multiple threads, you'll want to use this class.  It's described in the "Thread Safety" section below.
+
+### Database Creation
+An `FMDatabase` is created with a path to a SQLite database file.  This path can be one of these three:
+
+1. A file system path.  The file does not have to exist on disk.  If it does not exist, it is created for you.
+2. An empty string (`@""`).  An empty database is created at a temporary location.  This database is deleted when the `FMDatabase` connection is closed.
+3. `NULL`.  An in-memory database is created.  This database will be destroyed when the `FMDatabase` connection is closed.
+
+(For more information on temporary and in-memory databases, read the sqlite documentation on the subject: https://www.sqlite.org/inmemorydb.html)
+
+```objc
+NSString *path = [NSTemporaryDirectory() stringByAppendingPathComponent:@"tmp.db"];
+FMDatabase *db = [FMDatabase databaseWithPath:path];
+```
+
+### Opening
+
+Before you can interact with the database, it must be opened.  Opening fails if there are insufficient resources or permissions to open and/or create the database.
+
+```objc
+if (![db open]) {
+    // [db release];   // uncomment this line in manual referencing code; in ARC, this is not necessary/permitted
+    db = nil;
+    return;
+}
+```
+
+### Executing Updates
+
+Any sort of SQL statement which is not a `SELECT` statement qualifies as an update.  This includes `CREATE`, `UPDATE`, `INSERT`, `ALTER`, `COMMIT`, `BEGIN`, `DETACH`, `DELETE`, `DROP`, `END`, `EXPLAIN`, `VACUUM`, and `REPLACE` statements (plus many more).  Basically, if your SQL statement does not begin with `SELECT`, it is an update statement.
+
+Executing updates returns a single value, a `BOOL`.  A return value of `YES` means the update was successfully executed, and a return value of `NO` means that some error was encountered.  You may invoke the `-lastErrorMessage` and `-lastErrorCode` methods to retrieve more information.
+
+### Executing Queries
+
+A `SELECT` statement is a query and is executed via one of the `-executeQuery...` methods.
+
+Executing queries returns an `FMResultSet` object if successful, and `nil` upon failure.  You should use the `-lastErrorMessage` and `-lastErrorCode` methods to determine why a query failed.
+
+In order to iterate through the results of your query, you use a `while()` loop.  You also need to "step" from one record to the other.  With FMDB, the easiest way to do that is like this:
+
+```objc
+FMResultSet *s = [db executeQuery:@"SELECT * FROM myTable"];
+while ([s next]) {
+    //retrieve values for each record
+}
+```
+
+You must always invoke `-[FMResultSet next]` before attempting to access the values returned in a query, even if you're only expecting one:
+
+```objc
+FMResultSet *s = [db executeQuery:@"SELECT COUNT(*) FROM myTable"];
+if ([s next]) {
+    int totalCount = [s intForColumnIndex:0];
+}
+[s close];  // Call the -close method on the FMResultSet if you cannot confirm whether the result set is exhausted.
+```
+
+`FMResultSet` has many methods to retrieve data in an appropriate format:
+
+- `intForColumn:`
+- `longForColumn:`
+- `longLongIntForColumn:`
+- `boolForColumn:`
+- `doubleForColumn:`
+- `stringForColumn:`
+- `dateForColumn:`
+- `dataForColumn:`
+- `dataNoCopyForColumn:`
+- `UTF8StringForColumn:`
+- `objectForColumn:`
+
+Each of these methods also has a `{type}ForColumnIndex:` variant that is used to retrieve the data based on the position of the column in the results, as opposed to the column's name.
+
+Typically, there's no need to `-close` an `FMResultSet` yourself, since that happens when either the result set is exhausted. However, if you only pull out a single request or any other number of requests which don't exhaust the result set, you will need to call the `-close` method on the `FMResultSet`.
+
+### Closing
+
+When you have finished executing queries and updates on the database, you should `-close` the `FMDatabase` connection so that SQLite will relinquish any resources it has acquired during the course of its operation.
+
+```objc
+[db close];
+```
+
+### Transactions
+
+`FMDatabase` can begin and commit a transaction by invoking one of the appropriate methods or executing a begin/end transaction statement.
+
+### Multiple Statements and Batch Stuff
+
+You can use `FMDatabase`'s executeStatements:withResultBlock: to do multiple statements in a string:
+
+```objc
+NSString *sql = @"create table bulktest1 (id integer primary key autoincrement, x text);"
+                 "create table bulktest2 (id integer primary key autoincrement, y text);"
+                 "create table bulktest3 (id integer primary key autoincrement, z text);"
+                 "insert into bulktest1 (x) values ('XXX');"
+                 "insert into bulktest2 (y) values ('YYY');"
+                 "insert into bulktest3 (z) values ('ZZZ');";
+
+success = [db executeStatements:sql];
+
+sql = @"select count(*) as count from bulktest1;"
+       "select count(*) as count from bulktest2;"
+       "select count(*) as count from bulktest3;";
+
+success = [self.db executeStatements:sql withResultBlock:^int(NSDictionary *dictionary) {
+    NSInteger count = [dictionary[@"count"] integerValue];
+    XCTAssertEqual(count, 1, @"expected one record for dictionary %@", dictionary);
+    return 0;
+}];
+```
+
+### Data Sanitization
+
+When providing a SQL statement to FMDB, you should not attempt to "sanitize" any values before insertion.  Instead, you should use the standard SQLite binding syntax:
+
+```sql
+INSERT INTO myTable VALUES (?, ?, ?, ?)
+```
+
+The `?` character is recognized by SQLite as a placeholder for a value to be inserted.  The execution methods all accept a variable number of arguments (or a representation of those arguments, such as an `NSArray`, `NSDictionary`, or a `va_list`), which are properly escaped for you.
+
+And, to use that SQL with the `?` placeholders from Objective-C:
+
+```objc
+NSInteger identifier = 42;
+NSString *name = @"Liam O'Flaherty (\"the famous Irish author\")";
+NSDate *date = [NSDate date];
+NSString *comment = nil;
+
+BOOL success = [db executeUpdate:@"INSERT INTO authors (identifier, name, date, comment) VALUES (?, ?, ?, ?)", @(identifier), name, date, comment ?: [NSNull null]];
+if (!success) {
+    NSLog(@"error = %@", [db lastErrorMessage]);
+}
+```
+
+> **Note:** Fundamental data types, like the `NSInteger` variable `identifier`, should be as a `NSNumber` objects, achieved by using the `@` syntax, shown above. Or you can use the `[NSNumber numberWithInt:identifier]` syntax, too.
+>
+> Likewise, SQL `NULL` values should be inserted as `[NSNull null]`. For example, in the case of `comment` which might be `nil` (and is in this example), you can use the `comment ?: [NSNull null]` syntax, which will insert the string if `comment` is not `nil`, but will insert `[NSNull null]` if it is `nil`.
+
+In Swift, you would use `executeUpdate(values:)`, which not only is a concise Swift syntax, but also `throws` errors for proper error handling:
+
+```swift
+do {
+    let identifier = 42
+    let name = "Liam O'Flaherty (\"the famous Irish author\")"
+    let date = Date()
+    let comment: String? = nil
+
+    try db.executeUpdate("INSERT INTO authors (identifier, name, date, comment) VALUES (?, ?, ?, ?)", values: [identifier, name, date, comment ?? NSNull()])
+} catch {
+    print("error = \(error)")
+}
+```
+
+> **Note:** In Swift, you don't have to wrap fundamental numeric types like you do in Objective-C. But if you are going to insert an optional string, you would probably use the `comment ?? NSNull()` syntax (i.e., if it is `nil`, use `NSNull`, otherwise use the string).
+
+Alternatively, you may use named parameters syntax:
+
+```sql
+INSERT INTO authors (identifier, name, date, comment) VALUES (:identifier, :name, :date, :comment)
+```
+
+The parameters *must* start with a colon. SQLite itself supports other characters, but internally the dictionary keys are prefixed with a colon, do **not** include the colon in your dictionary keys.
+
+```objc
+NSDictionary *arguments = @{@"identifier": @(identifier), @"name": name, @"date": date, @"comment": comment ?: [NSNull null]};
+BOOL success = [db executeUpdate:@"INSERT INTO authors (identifier, name, date, comment) VALUES (:identifier, :name, :date, :comment)" withParameterDictionary:arguments];
+if (!success) {
+    NSLog(@"error = %@", [db lastErrorMessage]);
+}
+```
+
+The key point is that one should not use `NSString` method `stringWithFormat` to manually insert values into the SQL statement, itself. Nor should one Swift string interpolation to insert values into the SQL. Use `?` placeholders for values to be inserted into the database (or used in `WHERE` clauses in `SELECT` statements).
+
+<h2 id="threads">Using FMDatabaseQueue and Thread Safety.</h2>
+
+Using a single instance of `FMDatabase` from multiple threads at once is a bad idea.  It has always been OK to make a `FMDatabase` object *per thread*.  Just don't share a single instance across threads, and definitely not across multiple threads at the same time.  Bad things will eventually happen and you'll eventually get something to crash, or maybe get an exception, or maybe meteorites will fall out of the sky and hit your Mac Pro.  *This would suck*.
+
+**So don't instantiate a single `FMDatabase` object and use it across multiple threads.**
+
+Instead, use `FMDatabaseQueue`. Instantiate a single `FMDatabaseQueue` and use it across multiple threads. The `FMDatabaseQueue` object will synchronize and coordinate access across the multiple threads. Here's how to use it:
+
+First, make your queue.
+
+```objc
+FMDatabaseQueue *queue = [FMDatabaseQueue databaseQueueWithPath:aPath];
+```
+
+Then use it like so:
+
+
+```objc
+[queue inDatabase:^(FMDatabase *db) {
+    [db executeUpdate:@"INSERT INTO myTable VALUES (?)", @1];
+    [db executeUpdate:@"INSERT INTO myTable VALUES (?)", @2];
+    [db executeUpdate:@"INSERT INTO myTable VALUES (?)", @3];
+
+    FMResultSet *rs = [db executeQuery:@"select * from foo"];
+    while ([rs next]) {
+        …
+    }
+}];
+```
+
+An easy way to wrap things up in a transaction can be done like this:
+
+```objc
+[queue inTransaction:^(FMDatabase *db, BOOL *rollback) {
+    [db executeUpdate:@"INSERT INTO myTable VALUES (?)", @1];
+    [db executeUpdate:@"INSERT INTO myTable VALUES (?)", @2];
+    [db executeUpdate:@"INSERT INTO myTable VALUES (?)", @3];
+
+    if (whoopsSomethingWrongHappened) {
+        *rollback = YES;
+        return;
+    }
+
+    // etc ...
+}];
+```
+
+The Swift equivalent would be:
+
+```swift
+queue.inTransaction { db, rollback in
+    do {
+        try db.executeUpdate("INSERT INTO myTable VALUES (?)", values: [1])
+        try db.executeUpdate("INSERT INTO myTable VALUES (?)", values: [2])
+        try db.executeUpdate("INSERT INTO myTable VALUES (?)", values: [3])
+
+        if whoopsSomethingWrongHappened {
+            rollback.pointee = true
+            return
+        }
+
+        // etc ...
+    } catch {
+        rollback.pointee = true
+        print(error)
+    }
+}
+```
+
+(Note, as of Swift 3, use `pointee`. But in Swift 2.3, use `memory` rather than `pointee`.)
+
+`FMDatabaseQueue` will run the blocks on a serialized queue (hence the name of the class).  So if you call `FMDatabaseQueue`'s methods from multiple threads at the same time, they will be executed in the order they are received.  This way queries and updates won't step on each other's toes, and every one is happy.
+
+**Note:** The calls to `FMDatabaseQueue`'s methods are blocking.  So even though you are passing along blocks, they will **not** be run on another thread.
+
+## Making custom sqlite functions, based on blocks.
+
+You can do this!  For an example, look for `-makeFunctionNamed:` in main.m
+
+## Swift
+
+You can use FMDB in Swift projects too.
+
+To do this, you must:
+
+1. Copy the relevant `.m` and `.h` files from the FMDB `src` folder into your project.
+
+ You can copy all of them (which is easiest), or only the ones you need. Likely you will need [`FMDatabase`](https://ccgus.github.io/fmdb/html/Classes/FMDatabase.html) and [`FMResultSet`](https://ccgus.github.io/fmdb/html/Classes/FMResultSet.html) at a minimum. [`FMDatabaseAdditions`](https://ccgus.github.io/fmdb/html/Categories/FMDatabase+FMDatabaseAdditions.html) provides some very useful convenience methods, so you will likely want that, too. If you are doing multithreaded access to a database, [`FMDatabaseQueue`](https://ccgus.github.io/fmdb/html/Classes/FMDatabaseQueue.html) is quite useful, too. If you choose to not copy all of the files from the `src` directory, though, you may want to update `FMDB.h` to only reference the files that you included in your project.
+
+ Note, if you're copying all of the files from the `src` folder into to your project (which is recommended), you may want to drag the individual files into your project, not the folder, itself, because if you drag the folder, you won't be prompted to add the bridging header (see next point).
+
+2. If prompted to create a "bridging header", you should do so. If not prompted and if you don't already have a bridging header, add one.
+
+ For more information on bridging headers, see [Swift and Objective-C in the Same Project](https://developer.apple.com/library/ios/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html#//apple_ref/doc/uid/TP40014216-CH10-XID_76).
+
+3. In your bridging header, add a line that says:
+    ```objc
+    #import "FMDB.h"
+    ```
+
+4. Use the variations of `executeQuery` and `executeUpdate` with the `sql` and `values` parameters with `try` pattern, as shown below. These renditions of `executeQuery` and `executeUpdate` both `throw` errors in true Swift fashion.
+
+If you do the above, you can then write Swift code that uses `FMDatabase`. For example, as of Swift 3:
+
+```swift
+let fileURL = try! FileManager.default
+    .url(for: .applicationSupportDirectory, in: .userDomainMask, appropriateFor: nil, create: true)
+    .appendingPathComponent("test.sqlite")
+
+let database = FMDatabase(url: fileURL)
+
+guard database.open() else {
+    print("Unable to open database")
+    return
+}
+
+do {
+    try database.executeUpdate("create table test(x text, y text, z text)", values: nil)
+    try database.executeUpdate("insert into test (x, y, z) values (?, ?, ?)", values: ["a", "b", "c"])
+    try database.executeUpdate("insert into test (x, y, z) values (?, ?, ?)", values: ["e", "f", "g"])
+
+    let rs = try database.executeQuery("select x, y, z from test", values: nil)
+    while rs.next() {
+        if let x = rs.string(forColumn: "x"), let y = rs.string(forColumn: "y"), let z = rs.string(forColumn: "z") {
+            print("x = \(x); y = \(y); z = \(z)")
+        }
+    }
+} catch {
+    print("failed: \(error.localizedDescription)")
+}
+
+database.close()
+```
+
+## History
+
+The history and changes are availbe on its [GitHub page](https://github.com/ccgus/fmdb) and are summarized in the "CHANGES_AND_TODO_LIST.txt" file.
+
+## Contributors
+
+The contributors to FMDB are contained in the "Contributors.txt" file.
+
+## Additional projects using FMDB, which might be interesting to the discerning developer.
+
+ * FMDBMigrationManager, A SQLite schema migration management system for FMDB: https://github.com/layerhq/FMDBMigrationManager
+ * FCModel, An alternative to Core Data for people who like having direct SQL access: https://github.com/marcoarment/FCModel
+
+## Quick notes on FMDB's coding style
+
+Spaces, not tabs.  Square brackets, not dot notation.  Look at what FMDB already does with curly brackets and such, and stick to that style.
+
+## Reporting bugs
+
+Reduce your bug down to the smallest amount of code possible.  You want to make it super easy for the developers to see and reproduce your bug.  If it helps, pretend that the person who can fix your bug is active on shipping 3 major products, works on a handful of open source projects, has a newborn baby, and is generally very very busy.
+
+And we've even added a template function to main.m (FMDBReportABugFunction) in the FMDB distribution to help you out:
+
+* Open up fmdb project in Xcode.
+* Open up main.m and modify the FMDBReportABugFunction to reproduce your bug.
+    * Setup your table(s) in the code.
+    * Make your query or update(s).
+    * Add some assertions which demonstrate the bug.
+
+Then you can bring it up on the FMDB mailing list by showing your nice and compact FMDBReportABugFunction, or you can report the bug via the github FMDB bug reporter.
+
+**Optional:**
+
+Figure out where the bug is, fix it, and send a patch in or bring that up on the mailing list.  Make sure all the other tests run after your modifications.
+
+## Support
+
+The support channels for FMDB are the mailing list (see above), filing a bug here, or maybe on Stack Overflow.  So that is to say, support is provided by the community and on a voluntary basis.
+
+FMDB development is overseen by Gus Mueller of Flying Meat.  If FMDB been helpful to you, consider purchasing an app from FM or telling all your friends about it.
+
+## License
+
+The license for FMDB is contained in the "License.txt" file.
+
+If you happen to come across either Gus Mueller or Rob Ryan in a bar, you might consider purchasing a drink of their choosing if FMDB has been useful to you.
+
+(The drink is for them of course, shame on you for trying to keep it.)

+ 14 - 0
Pods/FMDB/privacy/PrivacyInfo.xcprivacy

@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>NSPrivacyTracking</key>
+	<false/>
+	<key>NSPrivacyTrackingDomains</key>
+	<array/>
+	<key>NSPrivacyCollectedDataTypes</key>
+	<array/>
+	<key>NSPrivacyAccessedAPITypes</key>
+	<array/>
+</dict>
+</plist>

+ 10 - 0
Pods/FMDB/src/fmdb/FMDB.h

@@ -0,0 +1,10 @@
+#import <Foundation/Foundation.h>
+
+FOUNDATION_EXPORT double FMDBVersionNumber;
+FOUNDATION_EXPORT const unsigned char FMDBVersionString[];
+
+#import "FMDatabase.h"
+#import "FMResultSet.h"
+#import "FMDatabaseAdditions.h"
+#import "FMDatabaseQueue.h"
+#import "FMDatabasePool.h"

+ 1494 - 0
Pods/FMDB/src/fmdb/FMDatabase.h

@@ -0,0 +1,1494 @@
+#import <Foundation/Foundation.h>
+#import "FMResultSet.h"
+#import "FMDatabasePool.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+#if ! __has_feature(objc_arc)
+    #define FMDBAutorelease(__v) ([__v autorelease]);
+    #define FMDBReturnAutoreleased FMDBAutorelease
+
+    #define FMDBRetain(__v) ([__v retain]);
+    #define FMDBReturnRetained FMDBRetain
+
+    #define FMDBRelease(__v) ([__v release]);
+
+    #define FMDBDispatchQueueRelease(__v) (dispatch_release(__v));
+#else
+    // -fobjc-arc
+    #define FMDBAutorelease(__v)
+    #define FMDBReturnAutoreleased(__v) (__v)
+
+    #define FMDBRetain(__v)
+    #define FMDBReturnRetained(__v) (__v)
+
+    #define FMDBRelease(__v)
+
+// If OS_OBJECT_USE_OBJC=1, then the dispatch objects will be treated like ObjC objects
+// and will participate in ARC.
+// See the section on "Dispatch Queues and Automatic Reference Counting" in "Grand Central Dispatch (GCD) Reference" for details. 
+    #if OS_OBJECT_USE_OBJC
+        #define FMDBDispatchQueueRelease(__v)
+    #else
+        #define FMDBDispatchQueueRelease(__v) (dispatch_release(__v));
+    #endif
+#endif
+
+#if !__has_feature(objc_instancetype)
+    #define instancetype id
+#endif
+
+/**
+ Callback block used by @c executeStatements:withResultBlock:
+ */
+typedef int(^FMDBExecuteStatementsCallbackBlock)(NSDictionary *resultsDictionary);
+
+/**
+ Enumeration used in checkpoint methods.
+ */
+typedef NS_ENUM(int, FMDBCheckpointMode) {
+    FMDBCheckpointModePassive  = 0, // SQLITE_CHECKPOINT_PASSIVE,
+    FMDBCheckpointModeFull     = 1, // SQLITE_CHECKPOINT_FULL,
+    FMDBCheckpointModeRestart  = 2, // SQLITE_CHECKPOINT_RESTART,
+    FMDBCheckpointModeTruncate = 3  // SQLITE_CHECKPOINT_TRUNCATE
+};
+
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wobjc-interface-ivars"
+
+/** A SQLite ([https://sqlite.org/](https://sqlite.org/)) Objective-C wrapper.
+
+ Usage
+
+ The three main classes in FMDB are:
+
+ - @c FMDatabase - Represents a single SQLite database.  Used for executing SQL statements.
+
+ - @c FMResultSet - Represents the results of executing a query on an @c FMDatabase .
+
+ - @c FMDatabaseQueue - If you want to perform queries and updates on multiple threads, you'll want to use this class.
+
+ See also
+
+ - @c FMDatabasePool - A pool of @c FMDatabase objects
+
+ - @c FMStatement - A wrapper for @c sqlite_stmt
+
+ External links
+
+ - [FMDB on GitHub](https://github.com/ccgus/fmdb) including introductory documentation
+ - [SQLite web site](https://sqlite.org/)
+ - [FMDB mailing list](http://groups.google.com/group/fmdb)
+ - [SQLite FAQ](https://sqlite.org/faq.html)
+
+ @warning Do not instantiate a single @c FMDatabase  object and use it across multiple threads. Instead, use @c FMDatabaseQueue .
+
+ */
+
+@interface FMDatabase : NSObject
+
+///-----------------
+/// @name Properties
+///-----------------
+
+/** Whether should trace execution */
+
+@property (atomic, assign) BOOL traceExecution;
+
+/** Whether checked out or not */
+
+@property (atomic, assign) BOOL checkedOut;
+
+/** Crash on errors */
+
+@property (atomic, assign) BOOL crashOnErrors;
+
+/** Logs errors */
+
+@property (atomic, assign) BOOL logsErrors;
+
+/** Dictionary of cached statements */
+
+@property (atomic, retain, nullable) NSMutableDictionary *cachedStatements;
+
+///---------------------
+/// @name Initialization
+///---------------------
+
+/** Create a @c FMDatabase  object.
+ 
+ An @c FMDatabase  is created with a path to a SQLite database file.  This path can be one of these three:
+
+ 1. A file system path.  The file does not have to exist on disk.  If it does not exist, it is created for you.
+
+ 2. An zero-length string.  An empty database is created at a temporary location.  This database is deleted with the @c FMDatabase  connection is closed.
+
+ 3. @c nil .  An in-memory database is created.  This database will be destroyed with the @c FMDatabase  connection is closed.
+
+ For example, to open a database in the app's “Application Support” directory:
+
+@code
+NSURL *folder  = [[NSFileManager defaultManager] URLForDirectory:NSApplicationSupportDirectory inDomain:NSUserDomainMask appropriateForURL:nil create:true error:&error];
+NSURL *fileURL = [folder URLByAppendingPathComponent:@"test.db"];
+FMDatabase *db = [FMDatabase databaseWithPath:fileURL.path];
+@endcode
+
+ (For more information on temporary and in-memory databases, read the sqlite documentation on the subject: [https://sqlite.org/inmemorydb.html](https://sqlite.org/inmemorydb.html))
+
+ @param inPath Path of database file
+
+ @return @c FMDatabase  object if successful; @c nil  if failure.
+
+ */
+
++ (instancetype)databaseWithPath:(NSString * _Nullable)inPath;
+
+/** Create a @c FMDatabase  object.
+ 
+ An @c FMDatabase  is created with a path to a SQLite database file.  This path can be one of these three:
+ 
+ 1. A file system URL.  The file does not have to exist on disk.  If it does not exist, it is created for you.
+
+ 2. @c nil .  An in-memory database is created.  This database will be destroyed with the @c FMDatabase  connection is closed.
+ 
+ For example, to open a database in the app's “Application Support” directory:
+
+@code
+NSURL *folder  = [[NSFileManager defaultManager] URLForDirectory:NSApplicationSupportDirectory inDomain:NSUserDomainMask appropriateForURL:nil create:true error:&error];
+NSURL *fileURL = [folder URLByAppendingPathComponent:@"test.db"];
+FMDatabase *db = [FMDatabase databaseWithURL:fileURL];
+@endcode
+
+ (For more information on temporary and in-memory databases, read the sqlite documentation on the subject: [https://sqlite.org/inmemorydb.html](https://sqlite.org/inmemorydb.html))
+ 
+ @param url The local file URL (not remote URL) of database file
+ 
+ @return @c FMDatabase  object if successful; @c nil  if failure.
+ 
+ */
+
++ (instancetype)databaseWithURL:(NSURL * _Nullable)url;
+
+/** Initialize a @c FMDatabase  object.
+ 
+ An @c FMDatabase  is created with a path to a SQLite database file.  This path can be one of these three:
+
+ 1. A file system path.  The file does not have to exist on disk.  If it does not exist, it is created for you.
+
+ 2. A zero-length string.  An empty database is created at a temporary location.  This database is deleted with the @c FMDatabase  connection is closed.
+
+ 3. @c nil .  An in-memory database is created.  This database will be destroyed with the @c FMDatabase  connection is closed.
+
+  For example, to open a database in the app's “Application Support” directory:
+
+ @code
+ NSURL *folder  = [[NSFileManager defaultManager] URLForDirectory:NSApplicationSupportDirectory inDomain:NSUserDomainMask appropriateForURL:nil create:true error:&error];
+ NSURL *fileURL = [folder URLByAppendingPathComponent:@"test.db"];
+ FMDatabase *db = [[FMDatabase alloc] initWithPath:fileURL.path];
+ @endcode
+
+
+ (For more information on temporary and in-memory databases, read the sqlite documentation on the subject: [https://sqlite.org/inmemorydb.html](https://sqlite.org/inmemorydb.html))
+
+ @param path Path of database file.
+ 
+ @return @c FMDatabase  object if successful; @c nil  if failure.
+
+ */
+
+- (instancetype)initWithPath:(NSString * _Nullable)path;
+
+/** Initialize a @c FMDatabase  object.
+ 
+ An @c FMDatabase  is created with a local file URL to a SQLite database file.  This path can be one of these three:
+ 
+ 1. A file system URL.  The file does not have to exist on disk.  If it does not exist, it is created for you.
+
+ 2. @c nil .  An in-memory database is created.  This database will be destroyed with the @c FMDatabase  connection is closed.
+ 
+  For example, to open a database in the app's “Application Support” directory:
+
+ @code
+ NSURL *folder  = [[NSFileManager defaultManager] URLForDirectory:NSApplicationSupportDirectory inDomain:NSUserDomainMask appropriateForURL:nil create:true error:&error];
+ NSURL *fileURL = [folder URLByAppendingPathComponent:@"test.db"];
+ FMDatabase *db = [[FMDatabase alloc] initWithURL:fileURL];
+ @endcode
+
+ (For more information on temporary and in-memory databases, read the sqlite documentation on the subject: [https://sqlite.org/inmemorydb.html](https://sqlite.org/inmemorydb.html))
+ 
+ @param url The file @c NSURL  of database file.
+ 
+ @return @c FMDatabase  object if successful; @c nil  if failure.
+ 
+ */
+
+- (instancetype)initWithURL:(NSURL * _Nullable)url;
+
+///-----------------------------------
+/// @name Opening and closing database
+///-----------------------------------
+
+/// Is the database open or not?
+
+@property (nonatomic) BOOL isOpen;
+
+/** Opening a new database connection
+ 
+ The database is opened for reading and writing, and is created if it does not already exist.
+
+ @return @c YES if successful, @c NO on error.
+
+ @see [sqlite3_open()](https://sqlite.org/c3ref/open.html)
+ @see openWithFlags:
+ @see close
+ */
+
+- (BOOL)open;
+
+/** Opening a new database connection with flags and an optional virtual file system (VFS)
+
+ @param flags One of the following three values, optionally combined with the @c SQLITE_OPEN_NOMUTEX , @c SQLITE_OPEN_FULLMUTEX , @c SQLITE_OPEN_SHAREDCACHE , @c SQLITE_OPEN_PRIVATECACHE , and/or @c SQLITE_OPEN_URI flags:
+
+@code
+SQLITE_OPEN_READONLY
+@endcode
+
+ The database is opened in read-only mode. If the database does not already exist, an error is returned.
+ 
+@code
+SQLITE_OPEN_READWRITE
+@endcode
+
+ The database is opened for reading and writing if possible, or reading only if the file is write protected by the operating system. In either case the database must already exist, otherwise an error is returned.
+
+@code
+SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE
+@endcode
+ 
+ The database is opened for reading and writing, and is created if it does not already exist. This is the behavior that is always used for @c open  method.
+  
+ @return @c YES if successful, @c NO on error.
+
+ @see [sqlite3_open_v2()](https://sqlite.org/c3ref/open.html)
+ @see open
+ @see close
+ */
+
+- (BOOL)openWithFlags:(int)flags;
+
+/** Opening a new database connection with flags and an optional virtual file system (VFS)
+ 
+ @param flags One of the following three values, optionally combined with the @c SQLITE_OPEN_NOMUTEX , `SQLITE_OPEN_FULLMUTEX`, `SQLITE_OPEN_SHAREDCACHE`, @c SQLITE_OPEN_PRIVATECACHE , and/or @c SQLITE_OPEN_URI flags:
+ 
+@code
+SQLITE_OPEN_READONLY
+@endcode
+
+  The database is opened in read-only mode. If the database does not already exist, an error is returned.
+
+@code
+SQLITE_OPEN_READWRITE
+@endcode
+
+  The database is opened for reading and writing if possible, or reading only if the file is write protected by the operating system. In either case the database must already exist, otherwise an error is returned.
+
+@code
+SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE
+@endcode
+
+ The database is opened for reading and writing, and is created if it does not already exist. This is the behavior that is always used for @c open  method.
+ 
+ @param vfsName   If vfs is given the value is passed to the vfs parameter of sqlite3_open_v2.
+ 
+ @return @c YES if successful, @c NO on error.
+ 
+ @see [sqlite3_open_v2()](https://sqlite.org/c3ref/open.html)
+ @see open
+ @see close
+ */
+
+- (BOOL)openWithFlags:(int)flags vfs:(NSString * _Nullable)vfsName;
+
+/** Closing a database connection
+ 
+ @return @c YES if success, @c NO on error.
+ 
+ @see [sqlite3_close()](https://sqlite.org/c3ref/close.html)
+ @see open
+ @see openWithFlags:
+ */
+
+- (BOOL)close;
+
+/** Test to see if we have a good connection to the database.
+ 
+ This will confirm whether:
+ 
+ - is database open
+
+ - if open, it will try a simple @c SELECT statement and confirm that it succeeds.
+
+ @return @c YES if everything succeeds, @c NO on failure.
+ */
+
+@property (nonatomic, readonly) BOOL goodConnection;
+
+
+///----------------------
+/// @name Perform updates
+///----------------------
+
+/** Execute single update statement
+ 
+ This method executes a single SQL update statement (i.e. any SQL that does not return results, such as @c UPDATE , @c INSERT , or @c DELETE . This method employs [`sqlite3_prepare_v2`](https://sqlite.org/c3ref/prepare.html), [`sqlite3_bind`](https://sqlite.org/c3ref/bind_blob.html) to bind values to `?` placeholders in the SQL with the optional list of parameters, and [`sqlite_step`](https://sqlite.org/c3ref/step.html) to perform the update.
+
+ The optional values provided to this method should be objects (e.g. @c NSString , @c NSNumber , @c NSNull , @c NSDate , and @c NSData  objects), not fundamental data types (e.g. @c int , @c long , @c NSInteger , etc.). This method automatically handles the aforementioned object types, and all other object types will be interpreted as text values using the object's @c description  method.
+
+ @param sql The SQL to be performed, with optional `?` placeholders. This can be followed by iptional parameters to bind to `?` placeholders in the SQL statement. These should be Objective-C objects (e.g. @c NSString , @c NSNumber , etc.), not fundamental C data types (e.g. @c int , etc.).
+ 
+ @param outErr A reference to the @c NSError  pointer to be updated with an auto released @c NSError  object if an error if an error occurs. If @c nil , no @c NSError  object will be returned.
+
+ @return @c YES upon success; @c NO upon failure. If failed, you can call @c lastError , @c lastErrorCode , or @c lastErrorMessage  for diagnostic information regarding the failure.
+
+ @see lastError
+ @see lastErrorCode
+ @see lastErrorMessage
+ @see [`sqlite3_bind`](https://sqlite.org/c3ref/bind_blob.html)
+ */
+
+- (BOOL)executeUpdate:(NSString*)sql withErrorAndBindings:(NSError * _Nullable __autoreleasing *)outErr, ...;
+
+/** Execute single update statement
+ 
+ @see executeUpdate:withErrorAndBindings:
+ 
+ @warning **Deprecated**: Please use `<executeUpdate:withErrorAndBindings>` instead.
+ */
+
+- (BOOL)update:(NSString*)sql withErrorAndBindings:(NSError * _Nullable __autoreleasing *)outErr, ...  __deprecated_msg("Use executeUpdate:withErrorAndBindings: instead");;
+
+/** Execute single update statement
+
+ This method executes a single SQL update statement (i.e. any SQL that does not return results, such as @c UPDATE , @c INSERT , or @c DELETE . This method employs [`sqlite3_prepare_v2`](https://sqlite.org/c3ref/prepare.html), [`sqlite3_bind`](https://sqlite.org/c3ref/bind_blob.html) to bind values to `?` placeholders in the SQL with the optional list of parameters, and [`sqlite_step`](https://sqlite.org/c3ref/step.html) to perform the update.
+
+ The optional values provided to this method should be objects (e.g. @c NSString , @c NSNumber , @c NSNull , @c NSDate , and @c NSData  objects), not fundamental data types (e.g. @c int , @c long , @c NSInteger , etc.). This method automatically handles the aforementioned object types, and all other object types will be interpreted as text values using the object's @c description  method.
+ 
+ @param sql The SQL to be performed, with optional `?` placeholders, followed by optional parameters to bind to `?` placeholders in the SQL statement. These should be Objective-C objects (e.g. @c NSString , @c NSNumber , etc.), not fundamental C data types (e.g. @c int , etc.).
+
+ @return @c YES upon success; @c NO upon failure. If failed, you can call @c lastError , @c lastErrorCode , or @c lastErrorMessage  for diagnostic information regarding the failure.
+ 
+ @see lastError
+ @see lastErrorCode
+ @see lastErrorMessage
+ @see [`sqlite3_bind`](https://sqlite.org/c3ref/bind_blob.html)
+ 
+ @note This technique supports the use of `?` placeholders in the SQL, automatically binding any supplied value parameters to those placeholders. This approach is more robust than techniques that entail using @c stringWithFormat to manually build SQL statements, which can be problematic if the values happened to include any characters that needed to be quoted.
+ 
+ @note You cannot use this method from Swift due to incompatibilities between Swift and Objective-C variadic implementations. Consider using `<executeUpdate:values:>` instead.
+ */
+
+- (BOOL)executeUpdate:(NSString*)sql, ...;
+
+/** Execute single update statement
+
+ This method executes a single SQL update statement (i.e. any SQL that does not return results, such as @c UPDATE , @c INSERT , or @c DELETE . This method employs [`sqlite3_prepare_v2`](https://sqlite.org/c3ref/prepare.html) and [`sqlite_step`](https://sqlite.org/c3ref/step.html) to perform the update. Unlike the other @c executeUpdate methods, this uses printf-style formatters (e.g. `%s`, `%d`, etc.) to build the SQL. Do not use `?` placeholders in the SQL if you use this method.
+
+ @param format The SQL to be performed, with `printf`-style escape sequences, followed by optional parameters to bind to use in conjunction with the `printf`-style escape sequences in the SQL statement.
+
+ @return @c YES upon success; @c NO upon failure. If failed, you can call @c lastError , @c lastErrorCode , or @c lastErrorMessage  for diagnostic information regarding the failure.
+
+ @see executeUpdate:
+ @see lastError
+ @see lastErrorCode
+ @see lastErrorMessage
+ 
+ @note This method does not technically perform a traditional printf-style replacement. What this method actually does is replace the printf-style percent sequences with a SQLite `?` placeholder, and then bind values to that placeholder. Thus the following command
+
+@code
+[db executeUpdateWithFormat:@"INSERT INTO test (name) VALUES (%@)", @"Gus"];
+@endcode
+
+ is actually replacing the `%@` with `?` placeholder, and then performing something equivalent to `<executeUpdate:>`
+
+@code
+[db executeUpdate:@"INSERT INTO test (name) VALUES (?)", @"Gus"];
+@endcode
+
+ There are two reasons why this distinction is important. First, the printf-style escape sequences can only be used where it is permissible to use a SQLite `?` placeholder. You can use it only for values in SQL statements, but not for table names or column names or any other non-value context. This method also cannot be used in conjunction with `pragma` statements and the like. Second, note the lack of quotation marks in the SQL. The `VALUES` clause was _not_ `VALUES ('%@')` (like you might have to do if you built a SQL statement using @c NSString  method @c stringWithFormat ), but rather simply `VALUES (%@)`.
+ */
+
+- (BOOL)executeUpdateWithFormat:(NSString *)format, ... NS_FORMAT_FUNCTION(1,2);
+
+/** Execute single update statement
+ 
+ This method executes a single SQL update statement (i.e. any SQL that does not return results, such as @c UPDATE , @c INSERT , or @c DELETE . This method employs [`sqlite3_prepare_v2`](https://sqlite.org/c3ref/prepare.html) and [`sqlite3_bind`](https://sqlite.org/c3ref/bind_blob.html) binding any `?` placeholders in the SQL with the optional list of parameters.
+ 
+ The optional values provided to this method should be objects (e.g. @c NSString , @c NSNumber , @c NSNull , @c NSDate , and @c NSData  objects), not fundamental data types (e.g. @c int , @c long , @c NSInteger , etc.). This method automatically handles the aforementioned object types, and all other object types will be interpreted as text values using the object's @c description  method.
+ 
+ @param sql The SQL to be performed, with optional `?` placeholders.
+ 
+ @param arguments A @c NSArray  of objects to be used when binding values to the `?` placeholders in the SQL statement.
+ 
+ @return @c YES upon success; @c NO upon failure. If failed, you can call @c lastError , @c lastErrorCode , or @c lastErrorMessage  for diagnostic information regarding the failure.
+ 
+ @see executeUpdate:values:error:
+ @see lastError
+ @see lastErrorCode
+ @see lastErrorMessage
+ */
+
+- (BOOL)executeUpdate:(NSString*)sql withArgumentsInArray:(NSArray *)arguments;
+
+/** Execute single update statement
+ 
+ This method executes a single SQL update statement (i.e. any SQL that does not return results, such as @c UPDATE , @c INSERT , or @c DELETE . This method employs [`sqlite3_prepare_v2`](https://sqlite.org/c3ref/prepare.html) and [`sqlite3_bind`](https://sqlite.org/c3ref/bind_blob.html) binding any `?` placeholders in the SQL with the optional list of parameters.
+ 
+ The optional values provided to this method should be objects (e.g. @c NSString , @c NSNumber , @c NSNull , @c NSDate , and @c NSData  objects), not fundamental data types (e.g. @c int , @c long , @c NSInteger , etc.). This method automatically handles the aforementioned object types, and all other object types will be interpreted as text values using the object's @c description  method.
+ 
+ This is similar to @c executeUpdate:withArgumentsInArray: , except that this also accepts a pointer to a @c NSError  pointer, so that errors can be returned.
+
+ In Swift, this throws errors, as if it were defined as follows:
+ 
+@code
+func executeUpdate(sql: String, values: [Any]?) throws -> Bool { }
+@endcode
+
+ @param sql The SQL to be performed, with optional `?` placeholders.
+ 
+ @param values A @c NSArray  of objects to be used when binding values to the `?` placeholders in the SQL statement.
+
+ @param error A @c NSError  object to receive any error object (if any).
+
+ @return @c YES upon success; @c NO upon failure. If failed, you can call @c lastError , @c lastErrorCode , or @c lastErrorMessage  for diagnostic information regarding the failure.
+ 
+ @see lastError
+ @see lastErrorCode
+ @see lastErrorMessage
+ 
+ */
+
+- (BOOL)executeUpdate:(NSString*)sql values:(NSArray * _Nullable)values error:(NSError * _Nullable __autoreleasing *)error;
+
+/** Execute single update statement
+
+ This method executes a single SQL update statement (i.e. any SQL that does not return results, such as @c UPDATE , @c INSERT , or @c DELETE . This method employs [`sqlite3_prepare_v2`](https://sqlite.org/c3ref/prepare.html) and [`sqlite_step`](https://sqlite.org/c3ref/step.html) to perform the update. Unlike the other @c executeUpdate methods, this uses printf-style formatters (e.g. `%s`, `%d`, etc.) to build the SQL.
+
+ The optional values provided to this method should be objects (e.g. @c NSString , @c NSNumber , @c NSNull , @c NSDate , and @c NSData  objects), not fundamental data types (e.g. @c int , @c long , @c NSInteger , etc.). This method automatically handles the aforementioned object types, and all other object types will be interpreted as text values using the object's @c description  method.
+
+ @param sql The SQL to be performed, with optional `?` placeholders.
+
+ @param arguments A @c NSDictionary of objects keyed by column names that will be used when binding values to the `?` placeholders in the SQL statement.
+
+ @return @c YES upon success; @c NO upon failure. If failed, you can call @c lastError , @c lastErrorCode , or @c lastErrorMessage  for diagnostic information regarding the failure.
+
+ @see lastError
+ @see lastErrorCode
+ @see lastErrorMessage
+*/
+
+- (BOOL)executeUpdate:(NSString*)sql withParameterDictionary:(NSDictionary *)arguments;
+
+
+/** Execute single update statement
+
+ This method executes a single SQL update statement (i.e. any SQL that does not return results, such as @c UPDATE , @c INSERT , or @c DELETE . This method employs [`sqlite3_prepare_v2`](https://sqlite.org/c3ref/prepare.html) and [`sqlite_step`](https://sqlite.org/c3ref/step.html) to perform the update. Unlike the other @c executeUpdate methods, this uses printf-style formatters (e.g. `%s`, `%d`, etc.) to build the SQL.
+
+ The optional values provided to this method should be objects (e.g. @c NSString , @c NSNumber , @c NSNull , @c NSDate , and @c NSData  objects), not fundamental data types (e.g. @c int , @c long , @c NSInteger , etc.). This method automatically handles the aforementioned object types, and all other object types will be interpreted as text values using the object's @c description  method.
+
+ @param sql The SQL to be performed, with optional `?` placeholders.
+
+ @param args A `va_list` of arguments.
+
+ @return @c YES upon success; @c NO upon failure. If failed, you can call @c lastError , @c lastErrorCode , or @c lastErrorMessage  for diagnostic information regarding the failure.
+
+ @see lastError
+ @see lastErrorCode
+ @see lastErrorMessage
+ */
+
+- (BOOL)executeUpdate:(NSString*)sql withVAList: (va_list)args;
+
+/** Execute multiple SQL statements
+ 
+ This executes a series of SQL statements that are combined in a single string (e.g. the SQL generated by the `sqlite3` command line `.dump` command). This accepts no value parameters, but rather simply expects a single string with multiple SQL statements, each terminated with a semicolon. This uses @c sqlite3_exec .
+
+ @param  sql  The SQL to be performed
+ 
+ @return      @c YES upon success; @c NO upon failure. If failed, you can call @c lastError , @c lastErrorCode , or @c lastErrorMessage  for diagnostic information regarding the failure.
+
+ @see executeStatements:withResultBlock:
+ @see [sqlite3_exec()](https://sqlite.org/c3ref/exec.html)
+
+ */
+
+- (BOOL)executeStatements:(NSString *)sql;
+
+/** Execute multiple SQL statements with callback handler
+ 
+ This executes a series of SQL statements that are combined in a single string (e.g. the SQL generated by the `sqlite3` command line `.dump` command). This accepts no value parameters, but rather simply expects a single string with multiple SQL statements, each terminated with a semicolon. This uses `sqlite3_exec`.
+
+ @param sql       The SQL to be performed.
+ @param block     A block that will be called for any result sets returned by any SQL statements. 
+                  Note, if you supply this block, it must return integer value, zero upon success (this would be a good opportunity to use @c SQLITE_OK ),
+                  non-zero value upon failure (which will stop the bulk execution of the SQL).  If a statement returns values, the block will be called with the results from the query in NSDictionary *resultsDictionary.
+                  This may be @c nil  if you don't care to receive any results.
+
+ @return          @c YES upon success; @c NO upon failure. If failed, you can call @c lastError ,
+                  @c lastErrorCode , or @c lastErrorMessage  for diagnostic information regarding the failure.
+ 
+ @see executeStatements:
+ @see [sqlite3_exec()](https://sqlite.org/c3ref/exec.html)
+
+ */
+
+- (BOOL)executeStatements:(NSString *)sql withResultBlock:(__attribute__((noescape)) FMDBExecuteStatementsCallbackBlock _Nullable)block;
+
+/** Last insert rowid
+ 
+ Each entry in an SQLite table has a unique 64-bit signed integer key called the "rowid". The rowid is always available as an undeclared column named `ROWID`, `OID`, or `_ROWID_` as long as those names are not also used by explicitly declared columns. If the table has a column of type `INTEGER PRIMARY KEY` then that column is another alias for the rowid.
+ 
+ This routine returns the rowid of the most recent successful @c INSERT  into the database from the database connection in the first argument. As of SQLite version 3.7.7, this routines records the last insert rowid of both ordinary tables and virtual tables. If no successful @c INSERT statements have ever occurred on that database connection, zero is returned.
+ 
+ @return The rowid of the last inserted row.
+ 
+ @see [sqlite3_last_insert_rowid()](https://sqlite.org/c3ref/last_insert_rowid.html)
+
+ */
+
+@property (nonatomic, readonly) int64_t lastInsertRowId;
+
+/** The number of rows changed by prior SQL statement.
+ 
+ This function returns the number of database rows that were changed or inserted or deleted by the most recently completed SQL statement on the database connection specified by the first parameter. Only changes that are directly specified by the @c INSERT , @c UPDATE , or @c DELETE statement are counted.
+ 
+ @return The number of rows changed by prior SQL statement.
+ 
+ @see [sqlite3_changes()](https://sqlite.org/c3ref/changes.html)
+ 
+ */
+
+@property (nonatomic, readonly) int changes;
+
+
+///-------------------------
+/// @name Retrieving results
+///-------------------------
+
+/** Execute select statement
+
+ Executing queries returns an @c FMResultSet  object if successful, and @c nil  upon failure.  Like executing updates, there is a variant that accepts an `NSError **` parameter.  Otherwise you should use the @c lastErrorMessage  and @c lastErrorMessage  methods to determine why a query failed.
+ 
+ In order to iterate through the results of your query, you use a `while()` loop.  You also need to "step" (via `<[FMResultSet next]>`) from one record to the other.
+ 
+ This method employs [`sqlite3_bind`](https://sqlite.org/c3ref/bind_blob.html) for any optional value parameters. This  properly escapes any characters that need escape sequences (e.g. quotation marks), which eliminates simple SQL errors as well as protects against SQL injection attacks. This method natively handles @c NSString , @c NSNumber , @c NSNull , @c NSDate , and @c NSData  objects. All other object types will be interpreted as text values using the object's @c description  method.
+
+ @param sql The SELECT statement to be performed, with optional `?` placeholders, followed by optional parameters to bind to `?` placeholders in the SQL statement. These should be Objective-C objects (e.g. @c NSString , @c NSNumber , etc.), not fundamental C data types (e.g. @c int , etc.).
+
+ @return A @c FMResultSet  for the result set upon success; @c nil  upon failure. If failed, you can call @c lastError , @c lastErrorCode , or @c lastErrorMessage  for diagnostic information regarding the failure.
+ 
+ @see FMResultSet
+ @see [`FMResultSet next`](<[FMResultSet next]>)
+ @see [`sqlite3_bind`](https://sqlite.org/c3ref/bind_blob.html)
+ 
+ @note You cannot use this method from Swift due to incompatibilities between Swift and Objective-C variadic implementations. Consider using `<executeQuery:values:>` instead.
+ */
+
+- (FMResultSet * _Nullable)executeQuery:(NSString*)sql, ...;
+
+/** Execute select statement
+
+ Executing queries returns an @c FMResultSet  object if successful, and @c nil  upon failure.  Like executing updates, there is a variant that accepts an `NSError **` parameter.  Otherwise you should use the @c lastErrorMessage  and @c lastErrorMessage  methods to determine why a query failed.
+ 
+ In order to iterate through the results of your query, you use a `while()` loop.  You also need to "step" (via `<[FMResultSet next]>`) from one record to the other.
+ 
+ @param format The SQL to be performed, with `printf`-style escape sequences, followed by ptional parameters to bind to use in conjunction with the `printf`-style escape sequences in the SQL statement.
+
+ @return A @c FMResultSet  for the result set upon success; @c nil  upon failure. If failed, you can call @c lastError , @c lastErrorCode , or @c lastErrorMessage  for diagnostic information regarding the failure.
+
+ @see executeQuery:
+ @see FMResultSet
+ @see [`FMResultSet next`](<[FMResultSet next]>)
+
+ @note This method does not technically perform a traditional printf-style replacement. What this method actually does is replace the printf-style percent sequences with a SQLite `?` placeholder, and then bind values to that placeholder. Thus the following command
+ 
+@code
+[db executeQueryWithFormat:@"SELECT * FROM test WHERE name=%@", @"Gus"];
+@endcode
+
+ is actually replacing the `%@` with `?` placeholder, and then performing something equivalent to `<executeQuery:>`
+
+@code
+[db executeQuery:@"SELECT * FROM test WHERE name=?", @"Gus"];
+@endcode
+
+ There are two reasons why this distinction is important. First, the printf-style escape sequences can only be used where it is permissible to use a SQLite `?` placeholder. You can use it only for values in SQL statements, but not for table names or column names or any other non-value context. This method also cannot be used in conjunction with `pragma` statements and the like. Second, note the lack of quotation marks in the SQL. The @c WHERE  clause was _not_ `WHERE name='%@'` (like you might have to do if you built a SQL statement using @c NSString  method @c stringWithFormat ), but rather simply `WHERE name=%@`.
+ 
+ */
+
+- (FMResultSet * _Nullable)executeQueryWithFormat:(NSString*)format, ... NS_FORMAT_FUNCTION(1,2);
+
+/** Execute select statement
+
+ Executing queries returns an @c FMResultSet  object if successful, and @c nil  upon failure.  Like executing updates, there is a variant that accepts an `NSError **` parameter.  Otherwise you should use the @c lastErrorMessage  and @c lastErrorMessage  methods to determine why a query failed.
+ 
+ In order to iterate through the results of your query, you use a `while()` loop.  You also need to "step" (via `<[FMResultSet next]>`) from one record to the other.
+ 
+ @param sql The SELECT statement to be performed, with optional `?` placeholders.
+
+ @param arguments A @c NSArray  of objects to be used when binding values to the `?` placeholders in the SQL statement.
+
+ @return A @c FMResultSet  for the result set upon success; @c nil  upon failure. If failed, you can call @c lastError , @c lastErrorCode , or @c lastErrorMessage  for diagnostic information regarding the failure.
+
+ @see -executeQuery:values:error:
+ @see FMResultSet
+ @see [`FMResultSet next`](<[FMResultSet next]>)
+ */
+
+- (FMResultSet * _Nullable)executeQuery:(NSString *)sql withArgumentsInArray:(NSArray *)arguments;
+
+/** Execute select statement
+ 
+ Executing queries returns an @c FMResultSet  object if successful, and @c nil  upon failure.  Like executing updates, there is a variant that accepts an `NSError **` parameter.  Otherwise you should use the @c lastErrorMessage  and @c lastErrorMessage  methods to determine why a query failed.
+ 
+ In order to iterate through the results of your query, you use a `while()` loop.  You also need to "step" (via `<[FMResultSet next]>`) from one record to the other.
+ 
+ This is similar to `<executeQuery:withArgumentsInArray:>`, except that this also accepts a pointer to a @c NSError  pointer, so that errors can be returned.
+ 
+ In Swift, this throws errors, as if it were defined as follows:
+ 
+ `func executeQuery(sql: String, values: [Any]?) throws  -> FMResultSet!`
+
+ @param sql The SELECT statement to be performed, with optional `?` placeholders.
+ 
+ @param values A @c NSArray  of objects to be used when binding values to the `?` placeholders in the SQL statement.
+
+ @param error A @c NSError  object to receive any error object (if any).
+
+ @return A @c FMResultSet  for the result set upon success; @c nil  upon failure. If failed, you can call @c lastError , @c lastErrorCode , or @c lastErrorMessage  for diagnostic information regarding the failure.
+ 
+ @see FMResultSet
+ @see [`FMResultSet next`](<[FMResultSet next]>)
+ 
+ @note When called from Swift, only use the first two parameters, `sql` and `values`. This but throws the error.
+
+ */
+
+- (FMResultSet * _Nullable)executeQuery:(NSString *)sql values:(NSArray * _Nullable)values error:(NSError * _Nullable __autoreleasing *)error;
+
+/** Execute select statement
+
+ Executing queries returns an @c FMResultSet  object if successful, and @c nil  upon failure.  Like executing updates, there is a variant that accepts an `NSError **` parameter.  Otherwise you should use the @c lastErrorMessage  and @c lastErrorMessage  methods to determine why a query failed.
+ 
+ In order to iterate through the results of your query, you use a `while()` loop.  You also need to "step" (via `<[FMResultSet next]>`) from one record to the other.
+ 
+ @param sql The SELECT statement to be performed, with optional `?` placeholders.
+
+ @param arguments A @c NSDictionary of objects keyed by column names that will be used when binding values to the `?` placeholders in the SQL statement.
+
+ @return A @c FMResultSet  for the result set upon success; @c nil  upon failure. If failed, you can call @c lastError , @c lastErrorCode , or @c lastErrorMessage  for diagnostic information regarding the failure.
+
+ @see FMResultSet
+ @see [`FMResultSet next`](<[FMResultSet next]>)
+ */
+
+- (FMResultSet * _Nullable)executeQuery:(NSString *)sql withParameterDictionary:(NSDictionary * _Nullable)arguments;
+
+
+// Documentation forthcoming.
+- (FMResultSet * _Nullable)executeQuery:(NSString *)sql withVAList:(va_list)args;
+
+/// Prepare SQL statement.
+///
+/// @param sql SQL statement to prepare, generally with `?` placeholders.
+
+- (FMResultSet *)prepare:(NSString *)sql;
+
+///-------------------
+/// @name Transactions
+///-------------------
+
+/** Begin a transaction
+ 
+ @return @c YES on success; @c NO on failure. If failed, you can call @c lastError , @c lastErrorCode , or @c lastErrorMessage  for diagnostic information regarding the failure.
+ 
+ @see commit
+ @see rollback
+ @see beginDeferredTransaction
+ @see isInTransaction
+ 
+ @warning    Unlike SQLite's `BEGIN TRANSACTION`, this method currently performs
+             an exclusive transaction, not a deferred transaction. This behavior
+             is likely to change in future versions of FMDB, whereby this method
+             will likely eventually adopt standard SQLite behavior and perform
+             deferred transactions. If you really need exclusive tranaction, it is
+             recommended that you use @c beginExclusiveTransaction, instead, not
+             only to make your intent explicit, but also to future-proof your code.
+
+ */
+
+- (BOOL)beginTransaction;
+
+/** Begin a deferred transaction
+ 
+ @return @c YES on success; @c NO on failure. If failed, you can call @c lastError , @c lastErrorCode , or @c lastErrorMessage  for diagnostic information regarding the failure.
+ 
+ @see commit
+ @see rollback
+ @see beginTransaction
+ @see isInTransaction
+ */
+
+- (BOOL)beginDeferredTransaction;
+
+/** Begin an immediate transaction
+ 
+ @return @c YES on success; @c NO on failure. If failed, you can call @c lastError , @c lastErrorCode , or @c lastErrorMessage  for diagnostic information regarding the failure.
+ 
+ @see commit
+ @see rollback
+ @see beginTransaction
+ @see isInTransaction
+ */
+
+- (BOOL)beginImmediateTransaction;
+
+/** Begin an exclusive transaction
+ 
+ @return @c YES on success; @c NO on failure. If failed, you can call @c lastError , @c lastErrorCode , or @c lastErrorMessage  for diagnostic information regarding the failure.
+ 
+ @see commit
+ @see rollback
+ @see beginTransaction
+ @see isInTransaction
+ */
+
+- (BOOL)beginExclusiveTransaction;
+
+/** Commit a transaction
+
+ Commit a transaction that was initiated with either `<beginTransaction>` or with `<beginDeferredTransaction>`.
+ 
+ @return @c YES on success; @c NO on failure. If failed, you can call @c lastError , @c lastErrorCode , or @c lastErrorMessage  for diagnostic information regarding the failure.
+ 
+ @see beginTransaction
+ @see beginDeferredTransaction
+ @see rollback
+ @see isInTransaction
+ */
+
+- (BOOL)commit;
+
+/** Rollback a transaction
+
+ Rollback a transaction that was initiated with either `<beginTransaction>` or with `<beginDeferredTransaction>`.
+
+ @return @c YES on success; @c NO on failure. If failed, you can call @c lastError , @c lastErrorCode , or @c lastErrorMessage  for diagnostic information regarding the failure.
+ 
+ @see beginTransaction
+ @see beginDeferredTransaction
+ @see commit
+ @see isInTransaction
+ */
+
+- (BOOL)rollback;
+
+/** Identify whether currently in a transaction or not
+  
+ @see beginTransaction
+ @see beginDeferredTransaction
+ @see commit
+ @see rollback
+ */
+
+@property (nonatomic, readonly) BOOL isInTransaction;
+
+- (BOOL)inTransaction __deprecated_msg("Use isInTransaction property instead");
+
+
+///----------------------------------------
+/// @name Cached statements and result sets
+///----------------------------------------
+
+/** Clear cached statements */
+
+- (void)clearCachedStatements;
+
+/** Close all open result sets */
+
+- (void)closeOpenResultSets;
+
+/** Whether database has any open result sets
+ 
+ @return @c YES if there are open result sets; @c NO if not.
+ */
+
+@property (nonatomic, readonly) BOOL hasOpenResultSets;
+
+/** Whether should cache statements or not
+  */
+
+@property (nonatomic) BOOL shouldCacheStatements;
+
+/** Interupt pending database operation
+ 
+ This method causes any pending database operation to abort and return at its earliest opportunity
+ 
+ @return @c YES on success; @c NO on failure. If failed, you can call @c lastError , @c lastErrorCode , or @c lastErrorMessage  for diagnostic information regarding the failure.
+ 
+ */
+
+- (BOOL)interrupt;
+
+///-------------------------
+/// @name Encryption methods
+///-------------------------
+
+/** Set encryption key.
+ 
+ @param key The key to be used.
+
+ @return @c YES if success, @c NO on error.
+
+ @see https://www.zetetic.net/sqlcipher/
+ 
+ @warning You need to have purchased the sqlite encryption extensions for this method to work.
+ */
+
+- (BOOL)setKey:(NSString*)key;
+
+/** Reset encryption key
+
+ @param key The key to be used.
+
+ @return @c YES if success, @c NO on error.
+
+ @see https://www.zetetic.net/sqlcipher/
+
+ @warning You need to have purchased the sqlite encryption extensions for this method to work.
+ */
+
+- (BOOL)rekey:(NSString*)key;
+
+/** Set encryption key using `keyData`.
+ 
+ @param keyData The @c NSData  to be used.
+
+ @return @c YES if success, @c NO on error.
+
+ @see https://www.zetetic.net/sqlcipher/
+ 
+ @warning You need to have purchased the sqlite encryption extensions for this method to work.
+ */
+
+- (BOOL)setKeyWithData:(NSData *)keyData;
+
+/** Reset encryption key using `keyData`.
+
+ @param keyData The @c NSData  to be used.
+
+ @return @c YES if success, @c NO on error.
+
+ @see https://www.zetetic.net/sqlcipher/
+
+ @warning You need to have purchased the sqlite encryption extensions for this method to work.
+ */
+
+- (BOOL)rekeyWithData:(NSData *)keyData;
+
+
+///------------------------------
+/// @name General inquiry methods
+///------------------------------
+
+/** The path of the database file.
+ */
+
+@property (nonatomic, readonly, nullable) NSString *databasePath;
+
+/** The file URL of the database file.
+ */
+
+@property (nonatomic, readonly, nullable) NSURL *databaseURL;
+
+/** The underlying SQLite handle .
+ 
+ @return The `sqlite3` pointer.
+ 
+ */
+
+@property (nonatomic, readonly) void *sqliteHandle;
+
+
+///-----------------------------
+/// @name Retrieving error codes
+///-----------------------------
+
+/** Last error message
+ 
+ Returns the English-language text that describes the most recent failed SQLite API call associated with a database connection. If a prior API call failed but the most recent API call succeeded, this return value is undefined.
+
+ @return @c NSString  of the last error message.
+ 
+ @see [sqlite3_errmsg()](https://sqlite.org/c3ref/errcode.html)
+ @see lastErrorCode
+ @see lastError
+ 
+ */
+
+- (NSString*)lastErrorMessage;
+
+/** Last error code
+ 
+ Returns the numeric result code or extended result code for the most recent failed SQLite API call associated with a database connection. If a prior API call failed but the most recent API call succeeded, this return value is undefined.
+ 
+ @return Integer value of the last error code.
+ 
+ @see [sqlite3_errcode()](https://sqlite.org/c3ref/errcode.html)
+ @see lastErrorMessage
+ @see lastError
+ 
+ */
+
+- (int)lastErrorCode;
+
+/** Last extended error code
+ 
+ Returns the numeric extended result code for the most recent failed SQLite API call associated with a database connection. If a prior API call failed but the most recent API call succeeded, this return value is undefined.
+ 
+ @return Integer value of the last extended error code.
+ 
+ @see [sqlite3_errcode()](https://sqlite.org/c3ref/errcode.html)
+ @see [2. Primary Result Codes versus Extended Result Codes](https://sqlite.org/rescode.html#primary_result_codes_versus_extended_result_codes)
+ @see [5. Extended Result Code List](https://sqlite.org/rescode.html#extrc)
+ @see lastErrorMessage
+ @see lastError
+ 
+ */
+
+- (int)lastExtendedErrorCode;
+
+/** Had error
+
+ @return @c YES if there was an error, @c NO if no error.
+ 
+ @see lastError
+ @see lastErrorCode
+ @see lastErrorMessage
+ 
+ */
+
+- (BOOL)hadError;
+
+/** Last error
+
+ @return @c NSError  representing the last error.
+ 
+ @see lastErrorCode
+ @see lastErrorMessage
+ 
+ */
+
+- (NSError *)lastError;
+
+
+// description forthcoming
+@property (nonatomic) NSTimeInterval maxBusyRetryTimeInterval;
+
+
+///------------------
+/// @name Save points
+///------------------
+
+/** Start save point
+ 
+ @param name Name of save point.
+ 
+ @param outErr A @c NSError  object to receive any error object (if any).
+ 
+ @return @c YES on success; @c NO on failure. If failed, you can call @c lastError , @c lastErrorCode , or @c lastErrorMessage  for diagnostic information regarding the failure.
+ 
+ @see releaseSavePointWithName:error:
+ @see rollbackToSavePointWithName:error:
+ */
+
+- (BOOL)startSavePointWithName:(NSString*)name error:(NSError * _Nullable __autoreleasing *)outErr;
+
+/** Release save point
+
+ @param name Name of save point.
+ 
+ @param outErr A @c NSError  object to receive any error object (if any).
+ 
+ @return @c YES on success; @c NO on failure. If failed, you can call @c lastError , @c lastErrorCode , or @c lastErrorMessage  for diagnostic information regarding the failure.
+
+ @see startSavePointWithName:error:
+ @see rollbackToSavePointWithName:error:
+ 
+ */
+
+- (BOOL)releaseSavePointWithName:(NSString*)name error:(NSError * _Nullable __autoreleasing *)outErr;
+
+/** Roll back to save point
+
+ @param name Name of save point.
+ @param outErr A @c NSError  object to receive any error object (if any).
+ 
+ @return @c YES on success; @c NO on failure. If failed, you can call @c lastError , @c lastErrorCode , or @c lastErrorMessage  for diagnostic information regarding the failure.
+ 
+ @see startSavePointWithName:error:
+ @see releaseSavePointWithName:error:
+ 
+ */
+
+- (BOOL)rollbackToSavePointWithName:(NSString*)name error:(NSError * _Nullable __autoreleasing *)outErr;
+
+/** Start save point
+
+ @param block Block of code to perform from within save point.
+ 
+ @return The NSError corresponding to the error, if any. If no error, returns @c nil .
+
+ @see startSavePointWithName:error:
+ @see releaseSavePointWithName:error:
+ @see rollbackToSavePointWithName:error:
+ 
+ */
+
+- (NSError * _Nullable)inSavePoint:(__attribute__((noescape)) void (^)(BOOL *rollback))block;
+
+
+///-----------------
+/// @name Checkpoint
+///-----------------
+
+/** Performs a WAL checkpoint
+ 
+ @param checkpointMode The checkpoint mode for @c sqlite3_wal_checkpoint_v2
+ @param error The @c NSError corresponding to the error, if any.
+ @return @c YES on success, otherwise @c NO .
+ */
+- (BOOL)checkpoint:(FMDBCheckpointMode)checkpointMode error:(NSError * _Nullable *)error;
+
+/** Performs a WAL checkpoint
+ 
+ @param checkpointMode The checkpoint mode for @c sqlite3_wal_checkpoint_v2
+ @param name The db name for @c sqlite3_wal_checkpoint_v2
+ @param error The @c NSError corresponding to the error, if any.
+ @return @c YES on success, otherwise @c NO .
+ */
+- (BOOL)checkpoint:(FMDBCheckpointMode)checkpointMode name:(NSString * _Nullable)name error:(NSError * _Nullable *)error;
+
+/** Performs a WAL checkpoint
+ 
+ @param checkpointMode The checkpoint mode for sqlite3_wal_checkpoint_v2
+ @param name The db name for sqlite3_wal_checkpoint_v2
+ @param error The NSError corresponding to the error, if any.
+ @param logFrameCount If not @c NULL , then this is set to the total number of frames in the log file or to -1 if the checkpoint could not run because of an error or because the database is not in WAL mode.
+ @param checkpointCount If not @c NULL , then this is set to the total number of checkpointed frames in the log file (including any that were already checkpointed before the function was called) or to -1 if the checkpoint could not run due to an error or because the database is not in WAL mode.
+ @return @c YES on success, otherwise @c NO .
+ */
+- (BOOL)checkpoint:(FMDBCheckpointMode)checkpointMode name:(NSString * _Nullable)name logFrameCount:(int * _Nullable)logFrameCount checkpointCount:(int * _Nullable)checkpointCount error:(NSError * _Nullable *)error;
+
+///----------------------------
+/// @name SQLite library status
+///----------------------------
+
+/** Test to see if the library is threadsafe
+
+ @return @c NO if and only if SQLite was compiled with mutexing code omitted due to the @c SQLITE_THREADSAFE compile-time option being set to 0.
+
+ @see [sqlite3_threadsafe()](https://sqlite.org/c3ref/threadsafe.html)
+ */
+
++ (BOOL)isSQLiteThreadSafe;
+
+/** Examine/set limits
+
+ @param type The type of limit. See https://sqlite.org/c3ref/c_limit_attached.html
+ @param newLimit The new limit value. Use -1 if you don't want to change the limit, but rather only want to check it.
+
+ @return Regardless, returns previous value.
+
+ @see [sqlite3_limit()](https://sqlite.org/c3ref/limit.html)
+*/
+
+- (int)limitFor:(int)type value:(int)newLimit;
+
+/** Run-time library version numbers
+ 
+ @return The sqlite library version string.
+ 
+ @see [sqlite3_libversion()](https://sqlite.org/c3ref/libversion.html)
+ */
+
++ (NSString*)sqliteLibVersion;
+
+/// The FMDB version number as a string in the form of @c "2.7.12" .
+///
+/// If you want to compare version number strings, you can use NSNumericSearch option:
+///
+/// @code
+/// NSComparisonResult result = [[FMDatabase FMDBUserVersion] compare:@"2.11.0" options:NSNumericSearch];
+/// @endcode
+///
+/// @returns The version number string.
+
++ (NSString*)FMDBUserVersion;
+
+/** The FMDB version
+
+ This returns the FMDB as hexadecimal value, e.g., @c 0x0243 for version 2.4.3.
+
+ @warning This routine will not work if any component of the version number exceeds 15.
+       For example, if it is version @c 2.17.3 , this will max out at @c 0x2f3.
+       For this reason, we would recommend using @c FMDBUserVersion  and with @c NSNumericSearch  option, e.g.
+
+ @code
+ NSComparisonResult result = [[FMDatabase FMDBUserVersion] compare:@"2.11.0" options:NSNumericSearch];
+ @endcode
+
+ @returns The version number in hexadecimal, e.g., @c 0x0243 for version 2.4.3. If any component exceeds what can be
+       can be represented in four bits, we'll max it out at @c 0xf .
+ */
+
++ (SInt32)FMDBVersion __deprecated_msg("Use FMDBUserVersion instead");
+
+///------------------------
+/// @name Make SQL function
+///------------------------
+
+/** Adds SQL functions or aggregates or to redefine the behavior of existing SQL functions or aggregates.
+ 
+ For example:
+
+@code
+[db makeFunctionNamed:@"RemoveDiacritics" arguments:1 block:^(void *context, int argc, void **argv) {
+    SqliteValueType type = [self.db valueType:argv[0]];
+    if (type == SqliteValueTypeNull) {
+        [self.db resultNullInContext:context];
+         return;
+    }
+    if (type != SqliteValueTypeText) {
+        [self.db resultError:@"Expected text" context:context];
+        return;
+    }
+    NSString *string = [self.db valueString:argv[0]];
+    NSString *result = [string stringByFoldingWithOptions:NSDiacriticInsensitiveSearch locale:nil];
+    [self.db resultString:result context:context];
+}];
+
+FMResultSet *rs = [db executeQuery:@"SELECT * FROM employees WHERE RemoveDiacritics(first_name) LIKE 'jose'"];
+NSAssert(rs, @"Error %@", [db lastErrorMessage]);
+@endcode
+
+ @param name Name of function.
+
+ @param arguments Maximum number of parameters.
+
+ @param block The block of code for the function.
+
+ @see [sqlite3_create_function()](https://sqlite.org/c3ref/create_function.html)
+ */
+
+- (void)makeFunctionNamed:(NSString *)name arguments:(int)arguments block:(void (^)(void *context, int argc, void * _Nonnull * _Nonnull argv))block;
+
+- (void)makeFunctionNamed:(NSString *)name maximumArguments:(int)count withBlock:(void (^)(void *context, int argc, void * _Nonnull * _Nonnull argv))block __deprecated_msg("Use makeFunctionNamed:arguments:block:");
+
+- (SqliteValueType)valueType:(void *)argv;
+
+/**
+ Get integer value of parameter in custom function.
+ 
+ @param value The argument whose value to return.
+ @return The integer value.
+ 
+ @see makeFunctionNamed:arguments:block:
+ */
+- (int)valueInt:(void *)value;
+
+/**
+ Get long value of parameter in custom function.
+ 
+ @param value The argument whose value to return.
+ @return The long value.
+ 
+ @see makeFunctionNamed:arguments:block:
+ */
+- (long long)valueLong:(void *)value;
+
+/**
+ Get double value of parameter in custom function.
+ 
+ @param value The argument whose value to return.
+ @return The double value.
+ 
+ @see makeFunctionNamed:arguments:block:
+ */
+- (double)valueDouble:(void *)value;
+
+/**
+ Get @c NSData  value of parameter in custom function.
+ 
+ @param value The argument whose value to return.
+ @return The data object.
+ 
+ @see makeFunctionNamed:arguments:block:
+ */
+- (NSData * _Nullable)valueData:(void *)value;
+
+/**
+ Get string value of parameter in custom function.
+ 
+ @param value The argument whose value to return.
+ @return The string value.
+ 
+ @see makeFunctionNamed:arguments:block:
+ */
+- (NSString * _Nullable)valueString:(void *)value;
+
+/**
+ Return null value from custom function.
+ 
+ @param context The context to which the null value will be returned.
+ 
+ @see makeFunctionNamed:arguments:block:
+ */
+- (void)resultNullInContext:(void *)context NS_SWIFT_NAME(resultNull(context:));
+
+/**
+ Return integer value from custom function.
+ 
+ @param value The integer value to be returned.
+ @param context The context to which the value will be returned.
+ 
+ @see makeFunctionNamed:arguments:block:
+ */
+- (void)resultInt:(int) value context:(void *)context;
+
+/**
+ Return long value from custom function.
+ 
+ @param value The long value to be returned.
+ @param context The context to which the value will be returned.
+ 
+ @see makeFunctionNamed:arguments:block:
+ */
+- (void)resultLong:(long long)value context:(void *)context;
+
+/**
+ Return double value from custom function.
+ 
+ @param value The double value to be returned.
+ @param context The context to which the value will be returned.
+ 
+ @see makeFunctionNamed:arguments:block:
+ */
+- (void)resultDouble:(double)value context:(void *)context;
+
+/**
+ Return @c NSData  object from custom function.
+ 
+ @param data The @c NSData  object to be returned.
+ @param context The context to which the value will be returned.
+ 
+ @see makeFunctionNamed:arguments:block:
+ */
+- (void)resultData:(NSData *)data context:(void *)context;
+
+/**
+ Return string value from custom function.
+ 
+ @param value The string value to be returned.
+ @param context The context to which the value will be returned.
+ 
+ @see makeFunctionNamed:arguments:block:
+ */
+- (void)resultString:(NSString *)value context:(void *)context;
+
+/**
+ Return error string from custom function.
+ 
+ @param error The error string to be returned.
+ @param context The context to which the error will be returned.
+ 
+ @see makeFunctionNamed:arguments:block:
+ */
+- (void)resultError:(NSString *)error context:(void *)context;
+
+/**
+ Return error code from custom function.
+ 
+ @param errorCode The integer error code to be returned.
+ @param context The context to which the error will be returned.
+ 
+ @see makeFunctionNamed:arguments:block:
+ */
+- (void)resultErrorCode:(int)errorCode context:(void *)context;
+
+/**
+ Report memory error in custom function.
+ 
+ @param context The context to which the error will be returned.
+ 
+ @see makeFunctionNamed:arguments:block:
+ */
+- (void)resultErrorNoMemoryInContext:(void *)context NS_SWIFT_NAME(resultErrorNoMemory(context:));
+
+/**
+ Report that string or BLOB is too long to represent in custom function.
+ 
+ @param context The context to which the error will be returned.
+ 
+ @see makeFunctionNamed:arguments:block:
+ */
+- (void)resultErrorTooBigInContext:(void *)context NS_SWIFT_NAME(resultErrorTooBig(context:));
+
+///---------------------
+/// @name Date formatter
+///---------------------
+
+/** Generate an @c NSDateFormatter  that won't be broken by permutations of timezones or locales.
+ 
+ Use this method to generate values to set the dateFormat property.
+ 
+ Example:
+
+@code
+myDB.dateFormat = [FMDatabase storeableDateFormat:@"yyyy-MM-dd HH:mm:ss"];
+@endcode
+
+ @param format A valid NSDateFormatter format string.
+ 
+ @return A @c NSDateFormatter  that can be used for converting dates to strings and vice versa.
+ 
+ @see hasDateFormatter
+ @see setDateFormat:
+ @see dateFromString:
+ @see stringFromDate:
+ @see storeableDateFormat:
+
+ @warning Note that @c NSDateFormatter  is not thread-safe, so the formatter generated by this method should be assigned to only one FMDB instance and should not be used for other purposes.
+
+ */
+
++ (NSDateFormatter *)storeableDateFormat:(NSString *)format;
+
+/** Test whether the database has a date formatter assigned.
+ 
+ @return @c YES if there is a date formatter; @c NO if not.
+ 
+ @see hasDateFormatter
+ @see setDateFormat:
+ @see dateFromString:
+ @see stringFromDate:
+ @see storeableDateFormat:
+ */
+
+- (BOOL)hasDateFormatter;
+
+/** Set to a date formatter to use string dates with sqlite instead of the default UNIX timestamps.
+ 
+ @param format Set to nil to use UNIX timestamps. Defaults to nil. Should be set using a formatter generated using @c FMDatabase:storeableDateFormat .
+ 
+ @see hasDateFormatter
+ @see setDateFormat:
+ @see dateFromString:
+ @see stringFromDate:
+ @see storeableDateFormat:
+ 
+ @warning Note there is no direct getter for the @c NSDateFormatter , and you should not use the formatter you pass to FMDB for other purposes, as @c NSDateFormatter  is not thread-safe.
+ */
+
+- (void)setDateFormat:(NSDateFormatter * _Nullable)format;
+
+/** Convert the supplied NSString to NSDate, using the current database formatter.
+ 
+ @param s @c NSString  to convert to @c NSDate .
+ 
+ @return The @c NSDate  object; or @c nil  if no formatter is set.
+ 
+ @see hasDateFormatter
+ @see setDateFormat:
+ @see dateFromString:
+ @see stringFromDate:
+ @see storeableDateFormat:
+ */
+
+- (NSDate * _Nullable)dateFromString:(NSString *)s;
+
+/** Convert the supplied NSDate to NSString, using the current database formatter.
+ 
+ @param date @c NSDate  of date to convert to @c NSString .
+
+ @return The @c NSString  representation of the date; @c nil  if no formatter is set.
+ 
+ @see hasDateFormatter
+ @see setDateFormat:
+ @see dateFromString:
+ @see stringFromDate:
+ @see storeableDateFormat:
+ */
+
+- (NSString * _Nullable)stringFromDate:(NSDate *)date;
+
+@end
+
+
+/** Objective-C wrapper for @c sqlite3_stmt
+ 
+ This is a wrapper for a SQLite @c sqlite3_stmt . Generally when using FMDB you will not need to interact directly with `FMStatement`, but rather with @c FMDatabase  and @c FMResultSet  only.
+ 
+ See also
+ 
+ - @c FMDatabase 
+ - @c FMResultSet
+ - [@c sqlite3_stmt ](https://sqlite.org/c3ref/stmt.html)
+ */
+
+@interface FMStatement : NSObject {
+    void *_statement;
+    NSString *_query;
+    long _useCount;
+    BOOL _inUse;
+}
+
+///-----------------
+/// @name Properties
+///-----------------
+
+/** Usage count */
+
+@property (atomic, assign) long useCount;
+
+/** SQL statement */
+
+@property (atomic, retain) NSString *query;
+
+/** SQLite sqlite3_stmt
+ 
+ @see [@c sqlite3_stmt ](https://sqlite.org/c3ref/stmt.html)
+ */
+
+@property (atomic, assign) void *statement;
+
+/** Indication of whether the statement is in use */
+
+@property (atomic, assign) BOOL inUse;
+
+///----------------------------
+/// @name Closing and Resetting
+///----------------------------
+
+/** Close statement */
+
+- (void)close;
+
+/** Reset statement */
+
+- (void)reset;
+
+@end
+
+#pragma clang diagnostic pop
+
+NS_ASSUME_NONNULL_END

+ 1529 - 0
Pods/FMDB/src/fmdb/FMDatabase.m

@@ -0,0 +1,1529 @@
+#import "FMDatabase.h"
+#import <unistd.h>
+#import <objc/runtime.h>
+
+#if FMDB_SQLITE_STANDALONE
+#import <sqlite3/sqlite3.h>
+#else
+#import <sqlite3.h>
+#endif
+
+// MARK: - FMDatabase Private Extension
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface FMDatabase () {
+    void*               _db;
+    BOOL                _isExecutingStatement;
+    NSTimeInterval      _startBusyRetryTime;
+    
+    NSMutableSet        *_openResultSets;
+    NSMutableSet        *_openFunctions;
+    
+    NSDateFormatter     *_dateFormat;
+}
+
+- (FMResultSet * _Nullable)executeQuery:(NSString *)sql withArgumentsInArray:(NSArray * _Nullable)arrayArgs orDictionary:(NSDictionary * _Nullable)dictionaryArgs orVAList:(va_list)args shouldBind:(BOOL)shouldBind;
+- (BOOL)executeUpdate:(NSString *)sql error:(NSError * _Nullable __autoreleasing *)outErr withArgumentsInArray:(NSArray * _Nullable)arrayArgs orDictionary:(NSDictionary * _Nullable)dictionaryArgs orVAList:(va_list)args;
+
+@end
+
+// MARK: - FMResultSet Private Extension
+
+@interface FMResultSet ()
+
+- (int)internalStepWithError:(NSError * _Nullable __autoreleasing *)outErr;
++ (instancetype)resultSetWithStatement:(FMStatement *)statement usingParentDatabase:(FMDatabase*)aDB shouldAutoClose:(BOOL)shouldAutoClose;
+
+@end
+
+NS_ASSUME_NONNULL_END
+
+// MARK: - FMDatabase
+
+@implementation FMDatabase
+
+// Because these two properties have all of their accessor methods implemented,
+// we have to synthesize them to get the corresponding ivars. The rest of the
+// properties have their ivars synthesized automatically for us.
+
+@synthesize shouldCacheStatements = _shouldCacheStatements;
+@synthesize maxBusyRetryTimeInterval = _maxBusyRetryTimeInterval;
+
+#pragma mark FMDatabase instantiation and deallocation
+
++ (instancetype)databaseWithPath:(NSString *)aPath {
+    return FMDBReturnAutoreleased([[self alloc] initWithPath:aPath]);
+}
+
++ (instancetype)databaseWithURL:(NSURL *)url {
+    return FMDBReturnAutoreleased([[self alloc] initWithURL:url]);
+}
+
+- (instancetype)init {
+    return [self initWithPath:nil];
+}
+
+- (instancetype)initWithURL:(NSURL *)url {
+    return [self initWithPath:url.path];
+}
+
+- (instancetype)initWithPath:(NSString *)path {
+    
+    assert(sqlite3_threadsafe()); // whoa there big boy- gotta make sure sqlite it happy with what we're going to do.
+    
+    self = [super init];
+    
+    if (self) {
+        _databasePath               = [path copy];
+        _openResultSets             = [[NSMutableSet alloc] init];
+        _db                         = nil;
+        _logsErrors                 = YES;
+        _crashOnErrors              = NO;
+        _maxBusyRetryTimeInterval   = 2;
+        _isOpen                     = NO;
+    }
+    
+    return self;
+}
+
+#if ! __has_feature(objc_arc)
+- (void)finalize {
+    [self close];
+    [super finalize];
+}
+#endif
+
+- (void)dealloc {
+    [self close];
+    FMDBRelease(_openResultSets);
+    FMDBRelease(_cachedStatements);
+    FMDBRelease(_dateFormat);
+    FMDBRelease(_databasePath);
+    FMDBRelease(_openFunctions);
+    
+#if ! __has_feature(objc_arc)
+    [super dealloc];
+#endif
+}
+
+- (NSURL *)databaseURL {
+    return _databasePath ? [NSURL fileURLWithPath:_databasePath] : nil;
+}
+
++ (NSString*)FMDBUserVersion {
+    return @"2.7.12";
+}
+
++ (SInt32)FMDBVersion {
+    
+    // we go through these hoops so that we only have to change the version number in a single spot.
+    static dispatch_once_t once;
+    static SInt32 FMDBVersionVal = 0;
+    
+    dispatch_once(&once, ^{
+        NSString *prodVersion = [self FMDBUserVersion];
+        
+        while ([[prodVersion componentsSeparatedByString:@"."] count] < 3) {
+            prodVersion = [prodVersion stringByAppendingString:@".0"];
+        }
+
+        NSArray *components = [prodVersion componentsSeparatedByString:@"."];
+        for (NSUInteger i = 0; i < 3; i++) {
+            SInt32 component = [components[i] intValue];
+            if (component > 15) {
+                NSLog(@"FMDBVersion is invalid: Please use FMDBUserVersion instead.");
+                component = 15;
+            }
+            FMDBVersionVal = FMDBVersionVal << 4 | component;
+        }
+    });
+    
+    return FMDBVersionVal;
+}
+
+#pragma mark SQLite information
+
++ (NSString*)sqliteLibVersion {
+    return [NSString stringWithFormat:@"%s", sqlite3_libversion()];
+}
+
++ (BOOL)isSQLiteThreadSafe {
+    // make sure to read the sqlite headers on this guy!
+    return sqlite3_threadsafe() != 0;
+}
+
+- (void*)sqliteHandle {
+    return _db;
+}
+
+- (const char*)sqlitePath {
+    
+    if (!_databasePath) {
+        return ":memory:";
+    }
+    
+    if ([_databasePath length] == 0) {
+        return ""; // this creates a temporary database (it's an sqlite thing).
+    }
+    
+    return [_databasePath fileSystemRepresentation];
+    
+}
+
+- (int)limitFor:(int)type value:(int)newLimit {
+    return sqlite3_limit(_db, type, newLimit);
+}
+
+#pragma mark Open and close database
+
+- (BOOL)open {
+    if (_isOpen) {
+        return YES;
+    }
+    
+    // if we previously tried to open and it failed, make sure to close it before we try again
+    
+    if (_db) {
+        [self close];
+    }
+    
+    // now open database
+
+    int err = sqlite3_open([self sqlitePath], (sqlite3**)&_db );
+    if(err != SQLITE_OK) {
+        NSLog(@"error opening!: %d", err);
+        return NO;
+    }
+    
+    if (_maxBusyRetryTimeInterval > 0.0) {
+        // set the handler
+        [self setMaxBusyRetryTimeInterval:_maxBusyRetryTimeInterval];
+    }
+    
+    _isOpen = YES;
+    
+    return YES;
+}
+
+- (BOOL)openWithFlags:(int)flags {
+    return [self openWithFlags:flags vfs:nil];
+}
+
+- (BOOL)openWithFlags:(int)flags vfs:(NSString *)vfsName {
+#if SQLITE_VERSION_NUMBER >= 3005000
+    if (_isOpen) {
+        return YES;
+    }
+    
+    // if we previously tried to open and it failed, make sure to close it before we try again
+    
+    if (_db) {
+        [self close];
+    }
+    
+    // now open database
+    
+    int err = sqlite3_open_v2([self sqlitePath], (sqlite3**)&_db, flags, [vfsName UTF8String]);
+    if(err != SQLITE_OK) {
+        NSLog(@"error opening!: %d", err);
+        return NO;
+    }
+    
+    if (_maxBusyRetryTimeInterval > 0.0) {
+        // set the handler
+        [self setMaxBusyRetryTimeInterval:_maxBusyRetryTimeInterval];
+    }
+    
+    _isOpen = YES;
+    
+    return YES;
+#else
+    NSLog(@"openWithFlags requires SQLite 3.5");
+    return NO;
+#endif
+}
+
+- (BOOL)close {
+    
+    [self clearCachedStatements];
+    [self closeOpenResultSets];
+    
+    if (!_db) {
+        return YES;
+    }
+    
+    int  rc;
+    BOOL retry;
+    BOOL triedFinalizingOpenStatements = NO;
+    
+    do {
+        retry   = NO;
+        rc      = sqlite3_close(_db);
+        if (SQLITE_BUSY == rc || SQLITE_LOCKED == rc) {
+            if (!triedFinalizingOpenStatements) {
+                triedFinalizingOpenStatements = YES;
+                sqlite3_stmt *pStmt;
+                while ((pStmt = sqlite3_next_stmt(_db, nil)) !=0) {
+                    NSLog(@"Closing leaked statement");
+                    sqlite3_finalize(pStmt);
+                    pStmt = 0x00;
+                    retry = YES;
+                }
+            }
+        }
+        else if (SQLITE_OK != rc) {
+            NSLog(@"error closing!: %d", rc);
+        }
+    }
+    while (retry);
+    
+    _db = nil;
+    _isOpen = false;
+    
+    return YES;
+}
+
+#pragma mark Busy handler routines
+
+// NOTE: appledoc seems to choke on this function for some reason;
+//       so when generating documentation, you might want to ignore the
+//       .m files so that it only documents the public interfaces outlined
+//       in the .h files.
+//
+//       This is a known appledoc bug that it has problems with C functions
+//       within a class implementation, but for some reason, only this
+//       C function causes problems; the rest don't. Anyway, ignoring the .m
+//       files with appledoc will prevent this problem from occurring.
+
+static int FMDBDatabaseBusyHandler(void *f, int count) {
+    FMDatabase *self = (__bridge FMDatabase*)f;
+    
+    if (count == 0) {
+        self->_startBusyRetryTime = [NSDate timeIntervalSinceReferenceDate];
+        return 1;
+    }
+    
+    NSTimeInterval delta = [NSDate timeIntervalSinceReferenceDate] - (self->_startBusyRetryTime);
+    
+    if (delta < [self maxBusyRetryTimeInterval]) {
+        int requestedSleepInMillseconds = (int) arc4random_uniform(50) + 50;
+        int actualSleepInMilliseconds = sqlite3_sleep(requestedSleepInMillseconds);
+        if (actualSleepInMilliseconds != requestedSleepInMillseconds) {
+            NSLog(@"WARNING: Requested sleep of %i milliseconds, but SQLite returned %i. Maybe SQLite wasn't built with HAVE_USLEEP=1?", requestedSleepInMillseconds, actualSleepInMilliseconds);
+        }
+        return 1;
+    }
+    
+    return 0;
+}
+
+- (void)setMaxBusyRetryTimeInterval:(NSTimeInterval)timeout {
+    
+    _maxBusyRetryTimeInterval = timeout;
+    
+    if (!_db) {
+        return;
+    }
+    
+    if (timeout > 0) {
+        sqlite3_busy_handler(_db, &FMDBDatabaseBusyHandler, (__bridge void *)(self));
+    }
+    else {
+        // turn it off otherwise
+        sqlite3_busy_handler(_db, nil, nil);
+    }
+}
+
+- (NSTimeInterval)maxBusyRetryTimeInterval {
+    return _maxBusyRetryTimeInterval;
+}
+
+
+// we no longer make busyRetryTimeout public
+// but for folks who don't bother noticing that the interface to FMDatabase changed,
+// we'll still implement the method so they don't get suprise crashes
+- (int)busyRetryTimeout {
+    NSLog(@"%s:%d", __FUNCTION__, __LINE__);
+    NSLog(@"FMDB: busyRetryTimeout no longer works, please use maxBusyRetryTimeInterval");
+    return -1;
+}
+
+- (void)setBusyRetryTimeout:(int)i {
+#pragma unused(i)
+    NSLog(@"%s:%d", __FUNCTION__, __LINE__);
+    NSLog(@"FMDB: setBusyRetryTimeout does nothing, please use setMaxBusyRetryTimeInterval:");
+}
+
+#pragma mark Result set functions
+
+- (BOOL)hasOpenResultSets {
+    return [_openResultSets count] > 0;
+}
+
+- (void)closeOpenResultSets {
+    
+    //Copy the set so we don't get mutation errors
+    NSSet *openSetCopy = FMDBReturnAutoreleased([_openResultSets copy]);
+    for (NSValue *rsInWrappedInATastyValueMeal in openSetCopy) {
+        FMResultSet *rs = (FMResultSet *)[rsInWrappedInATastyValueMeal pointerValue];
+        
+        [rs setParentDB:nil];
+        [rs close];
+        
+        [_openResultSets removeObject:rsInWrappedInATastyValueMeal];
+    }
+}
+
+- (void)resultSetDidClose:(FMResultSet *)resultSet {
+    NSValue *setValue = [NSValue valueWithNonretainedObject:resultSet];
+    
+    [_openResultSets removeObject:setValue];
+}
+
+#pragma mark Cached statements
+
+- (void)clearCachedStatements {
+    
+    for (NSMutableSet *statements in [_cachedStatements objectEnumerator]) {
+        for (FMStatement *statement in [statements allObjects]) {
+            [statement close];
+        }
+    }
+    
+    [_cachedStatements removeAllObjects];
+}
+
+- (FMStatement*)cachedStatementForQuery:(NSString*)query {
+    
+    NSMutableSet* statements = [_cachedStatements objectForKey:query];
+    
+    return [[statements objectsPassingTest:^BOOL(FMStatement* statement, BOOL *stop) {
+        
+        *stop = ![statement inUse];
+        return *stop;
+        
+    }] anyObject];
+}
+
+
+- (void)setCachedStatement:(FMStatement*)statement forQuery:(NSString*)query {
+    NSParameterAssert(query);
+    if (!query) {
+        NSLog(@"API misuse, -[FMDatabase setCachedStatement:forQuery:] query must not be nil");
+        return;
+    }
+    
+    query = [query copy]; // in case we got handed in a mutable string...
+    [statement setQuery:query];
+    
+    NSMutableSet* statements = [_cachedStatements objectForKey:query];
+    if (!statements) {
+        statements = [NSMutableSet set];
+    }
+    
+    [statements addObject:statement];
+    
+    [_cachedStatements setObject:statements forKey:query];
+    
+    FMDBRelease(query);
+}
+
+#pragma mark Key routines
+
+- (BOOL)rekey:(NSString*)key {
+    NSData *keyData = [NSData dataWithBytes:(void *)[key UTF8String] length:(NSUInteger)strlen([key UTF8String])];
+    
+    return [self rekeyWithData:keyData];
+}
+
+- (BOOL)rekeyWithData:(NSData *)keyData {
+#ifdef SQLITE_HAS_CODEC
+    if (!keyData) {
+        return NO;
+    }
+    
+    int rc = sqlite3_rekey(_db, [keyData bytes], (int)[keyData length]);
+    
+    if (rc != SQLITE_OK) {
+        NSLog(@"error on rekey: %d", rc);
+        NSLog(@"%@", [self lastErrorMessage]);
+    }
+    
+    return (rc == SQLITE_OK);
+#else
+#pragma unused(keyData)
+    return NO;
+#endif
+}
+
+- (BOOL)setKey:(NSString*)key {
+    NSData *keyData = [NSData dataWithBytes:[key UTF8String] length:(NSUInteger)strlen([key UTF8String])];
+    
+    return [self setKeyWithData:keyData];
+}
+
+- (BOOL)setKeyWithData:(NSData *)keyData {
+#ifdef SQLITE_HAS_CODEC
+    if (!keyData) {
+        return NO;
+    }
+    
+    int rc = sqlite3_key(_db, [keyData bytes], (int)[keyData length]);
+    
+    return (rc == SQLITE_OK);
+#else
+#pragma unused(keyData)
+    return NO;
+#endif
+}
+
+#pragma mark Date routines
+
++ (NSDateFormatter *)storeableDateFormat:(NSString *)format {
+    
+    NSDateFormatter *result = FMDBReturnAutoreleased([[NSDateFormatter alloc] init]);
+    result.dateFormat = format;
+    result.timeZone = [NSTimeZone timeZoneForSecondsFromGMT:0];
+    result.locale = FMDBReturnAutoreleased([[NSLocale alloc] initWithLocaleIdentifier:@"en_US"]);
+    return result;
+}
+
+
+- (BOOL)hasDateFormatter {
+    return _dateFormat != nil;
+}
+
+- (void)setDateFormat:(NSDateFormatter *)format {
+    FMDBAutorelease(_dateFormat);
+    _dateFormat = FMDBReturnRetained(format);
+}
+
+- (NSDate *)dateFromString:(NSString *)s {
+    return [_dateFormat dateFromString:s];
+}
+
+- (NSString *)stringFromDate:(NSDate *)date {
+    return [_dateFormat stringFromDate:date];
+}
+
+#pragma mark State of database
+
+- (BOOL)goodConnection {
+    
+    if (!_isOpen) {
+        return NO;
+    }
+    
+#ifdef SQLCIPHER_CRYPTO
+    // Starting with Xcode8 / iOS 10 we check to make sure we really are linked with
+    // SQLCipher because there is no longer a linker error if we accidently link
+    // with unencrypted sqlite library.
+    //
+    // https://discuss.zetetic.net/t/important-advisory-sqlcipher-with-xcode-8-and-new-sdks/1688
+    
+    FMResultSet *rs = [self executeQuery:@"PRAGMA cipher_version"];
+
+    if ([rs next]) {
+        NSLog(@"SQLCipher version: %@", rs.resultDictionary[@"cipher_version"]);
+        
+        [rs close];
+        return YES;
+    }
+#else
+    FMResultSet *rs = [self executeQuery:@"select name from sqlite_master where type='table'"];
+    
+    if (rs) {
+        [rs close];
+        return YES;
+    }
+#endif
+    
+    return NO;
+}
+
+- (void)warnInUse {
+    NSLog(@"The FMDatabase %@ is currently in use.", self);
+    
+#ifndef NS_BLOCK_ASSERTIONS
+    if (_crashOnErrors) {
+        NSAssert(false, @"The FMDatabase %@ is currently in use.", self);
+        abort();
+    }
+#endif
+}
+
+- (BOOL)databaseExists {
+    
+    if (!_isOpen) {
+        
+        NSLog(@"The FMDatabase %@ is not open.", self);
+        
+#ifndef NS_BLOCK_ASSERTIONS
+        if (_crashOnErrors) {
+            NSAssert(false, @"The FMDatabase %@ is not open.", self);
+            abort();
+        }
+#endif
+        
+        return NO;
+    }
+    
+    return YES;
+}
+
+#pragma mark Error routines
+
+- (NSString *)lastErrorMessage {
+    return [NSString stringWithUTF8String:sqlite3_errmsg(_db)];
+}
+
+- (BOOL)hadError {
+    int lastErrCode = [self lastErrorCode];
+    
+    return (lastErrCode > SQLITE_OK && lastErrCode < SQLITE_ROW);
+}
+
+- (int)lastErrorCode {
+    return sqlite3_errcode(_db);
+}
+
+- (int)lastExtendedErrorCode {
+    return sqlite3_extended_errcode(_db);
+}
+
+- (NSError*)errorWithMessage:(NSString *)message {
+    NSDictionary* errorMessage = [NSDictionary dictionaryWithObject:message forKey:NSLocalizedDescriptionKey];
+    
+    return [NSError errorWithDomain:@"FMDatabase" code:sqlite3_errcode(_db) userInfo:errorMessage];
+}
+
+- (NSError*)lastError {
+    return [self errorWithMessage:[self lastErrorMessage]];
+}
+
+#pragma mark Update information routines
+
+- (sqlite_int64)lastInsertRowId {
+    
+    if (_isExecutingStatement) {
+        [self warnInUse];
+        return NO;
+    }
+    
+    _isExecutingStatement = YES;
+    
+    sqlite_int64 ret = sqlite3_last_insert_rowid(_db);
+    
+    _isExecutingStatement = NO;
+    
+    return ret;
+}
+
+- (int)changes {
+    if (_isExecutingStatement) {
+        [self warnInUse];
+        return 0;
+    }
+    
+    _isExecutingStatement = YES;
+    
+    int ret = sqlite3_changes(_db);
+    
+    _isExecutingStatement = NO;
+    
+    return ret;
+}
+
+#pragma mark SQL manipulation
+
+- (int)bindObject:(id)obj toColumn:(int)idx inStatement:(sqlite3_stmt*)pStmt {
+    
+    if ((!obj) || ((NSNull *)obj == [NSNull null])) {
+        return sqlite3_bind_null(pStmt, idx);
+    }
+    
+    // FIXME - someday check the return codes on these binds.
+    else if ([obj isKindOfClass:[NSData class]]) {
+        const void *bytes = [obj bytes];
+        if (!bytes) {
+            // it's an empty NSData object, aka [NSData data].
+            // Don't pass a NULL pointer, or sqlite will bind a SQL null instead of a blob.
+            bytes = "";
+        }
+        return sqlite3_bind_blob(pStmt, idx, bytes, (int)[obj length], SQLITE_TRANSIENT);
+    }
+    else if ([obj isKindOfClass:[NSDate class]]) {
+        if (self.hasDateFormatter)
+            return sqlite3_bind_text(pStmt, idx, [[self stringFromDate:obj] UTF8String], -1, SQLITE_TRANSIENT);
+        else
+            return sqlite3_bind_double(pStmt, idx, [obj timeIntervalSince1970]);
+    }
+    else if ([obj isKindOfClass:[NSNumber class]]) {
+        
+        if (strcmp([obj objCType], @encode(char)) == 0) {
+            return sqlite3_bind_int(pStmt, idx, [obj charValue]);
+        }
+        else if (strcmp([obj objCType], @encode(unsigned char)) == 0) {
+            return sqlite3_bind_int(pStmt, idx, [obj unsignedCharValue]);
+        }
+        else if (strcmp([obj objCType], @encode(short)) == 0) {
+            return sqlite3_bind_int(pStmt, idx, [obj shortValue]);
+        }
+        else if (strcmp([obj objCType], @encode(unsigned short)) == 0) {
+            return sqlite3_bind_int(pStmt, idx, [obj unsignedShortValue]);
+        }
+        else if (strcmp([obj objCType], @encode(int)) == 0) {
+            return sqlite3_bind_int(pStmt, idx, [obj intValue]);
+        }
+        else if (strcmp([obj objCType], @encode(unsigned int)) == 0) {
+            return sqlite3_bind_int64(pStmt, idx, (long long)[obj unsignedIntValue]);
+        }
+        else if (strcmp([obj objCType], @encode(long)) == 0) {
+            return sqlite3_bind_int64(pStmt, idx, [obj longValue]);
+        }
+        else if (strcmp([obj objCType], @encode(unsigned long)) == 0) {
+            return sqlite3_bind_int64(pStmt, idx, (long long)[obj unsignedLongValue]);
+        }
+        else if (strcmp([obj objCType], @encode(long long)) == 0) {
+            return sqlite3_bind_int64(pStmt, idx, [obj longLongValue]);
+        }
+        else if (strcmp([obj objCType], @encode(unsigned long long)) == 0) {
+            return sqlite3_bind_int64(pStmt, idx, (long long)[obj unsignedLongLongValue]);
+        }
+        else if (strcmp([obj objCType], @encode(float)) == 0) {
+            return sqlite3_bind_double(pStmt, idx, [obj floatValue]);
+        }
+        else if (strcmp([obj objCType], @encode(double)) == 0) {
+            return sqlite3_bind_double(pStmt, idx, [obj doubleValue]);
+        }
+        else if (strcmp([obj objCType], @encode(BOOL)) == 0) {
+            return sqlite3_bind_int(pStmt, idx, ([obj boolValue] ? 1 : 0));
+        }
+        else {
+            return sqlite3_bind_text(pStmt, idx, [[obj description] UTF8String], -1, SQLITE_TRANSIENT);
+        }
+    }
+
+    return sqlite3_bind_text(pStmt, idx, [[obj description] UTF8String], -1, SQLITE_TRANSIENT);
+}
+
+- (void)extractSQL:(NSString *)sql argumentsList:(va_list)args intoString:(NSMutableString *)cleanedSQL arguments:(NSMutableArray *)arguments {
+    
+    NSUInteger length = [sql length];
+    unichar last = '\0';
+    for (NSUInteger i = 0; i < length; ++i) {
+        id arg = nil;
+        unichar current = [sql characterAtIndex:i];
+        unichar add = current;
+        if (last == '%') {
+            switch (current) {
+                case '@':
+                    arg = va_arg(args, id);
+                    break;
+                case 'c':
+                    // warning: second argument to 'va_arg' is of promotable type 'char'; this va_arg has undefined behavior because arguments will be promoted to 'int'
+                    arg = [NSString stringWithFormat:@"%c", va_arg(args, int)];
+                    break;
+                case 's':
+                    arg = [NSString stringWithUTF8String:va_arg(args, char*)];
+                    break;
+                case 'd':
+                case 'D':
+                case 'i':
+                    arg = [NSNumber numberWithInt:va_arg(args, int)];
+                    break;
+                case 'u':
+                case 'U':
+                    arg = [NSNumber numberWithUnsignedInt:va_arg(args, unsigned int)];
+                    break;
+                case 'h':
+                    i++;
+                    if (i < length && [sql characterAtIndex:i] == 'i') {
+                        //  warning: second argument to 'va_arg' is of promotable type 'short'; this va_arg has undefined behavior because arguments will be promoted to 'int'
+                        arg = [NSNumber numberWithShort:(short)(va_arg(args, int))];
+                    }
+                    else if (i < length && [sql characterAtIndex:i] == 'u') {
+                        // warning: second argument to 'va_arg' is of promotable type 'unsigned short'; this va_arg has undefined behavior because arguments will be promoted to 'int'
+                        arg = [NSNumber numberWithUnsignedShort:(unsigned short)(va_arg(args, uint))];
+                    }
+                    else {
+                        i--;
+                    }
+                    break;
+                case 'q':
+                    i++;
+                    if (i < length && [sql characterAtIndex:i] == 'i') {
+                        arg = [NSNumber numberWithLongLong:va_arg(args, long long)];
+                    }
+                    else if (i < length && [sql characterAtIndex:i] == 'u') {
+                        arg = [NSNumber numberWithUnsignedLongLong:va_arg(args, unsigned long long)];
+                    }
+                    else {
+                        i--;
+                    }
+                    break;
+                case 'f':
+                    arg = [NSNumber numberWithDouble:va_arg(args, double)];
+                    break;
+                case 'g':
+                    // warning: second argument to 'va_arg' is of promotable type 'float'; this va_arg has undefined behavior because arguments will be promoted to 'double'
+                    arg = [NSNumber numberWithFloat:(float)(va_arg(args, double))];
+                    break;
+                case 'l':
+                    i++;
+                    if (i < length) {
+                        unichar next = [sql characterAtIndex:i];
+                        if (next == 'l') {
+                            i++;
+                            if (i < length && [sql characterAtIndex:i] == 'd') {
+                                //%lld
+                                arg = [NSNumber numberWithLongLong:va_arg(args, long long)];
+                            }
+                            else if (i < length && [sql characterAtIndex:i] == 'u') {
+                                //%llu
+                                arg = [NSNumber numberWithUnsignedLongLong:va_arg(args, unsigned long long)];
+                            }
+                            else {
+                                i--;
+                            }
+                        }
+                        else if (next == 'd') {
+                            //%ld
+                            arg = [NSNumber numberWithLong:va_arg(args, long)];
+                        }
+                        else if (next == 'u') {
+                            //%lu
+                            arg = [NSNumber numberWithUnsignedLong:va_arg(args, unsigned long)];
+                        }
+                        else {
+                            i--;
+                        }
+                    }
+                    else {
+                        i--;
+                    }
+                    break;
+                default:
+                    // something else that we can't interpret. just pass it on through like normal
+                    break;
+            }
+        }
+        else if (current == '%') {
+            // percent sign; skip this character
+            add = '\0';
+        }
+        
+        if (arg != nil) {
+            [cleanedSQL appendString:@"?"];
+            [arguments addObject:arg];
+        }
+        else if (add == (unichar)'@' && last == (unichar) '%') {
+            [cleanedSQL appendFormat:@"NULL"];
+        }
+        else if (add != '\0') {
+            [cleanedSQL appendFormat:@"%C", add];
+        }
+        last = current;
+    }
+}
+
+#pragma mark Execute queries
+
+- (FMResultSet *)executeQuery:(NSString *)sql withParameterDictionary:(NSDictionary *)arguments {
+    return [self executeQuery:sql withArgumentsInArray:nil orDictionary:arguments orVAList:nil shouldBind:true];
+}
+
+- (FMResultSet *)executeQuery:(NSString *)sql withArgumentsInArray:(NSArray*)arrayArgs orDictionary:(NSDictionary *)dictionaryArgs orVAList:(va_list)args shouldBind:(BOOL)shouldBind {
+    if (![self databaseExists]) {
+        return 0x00;
+    }
+    
+    if (_isExecutingStatement) {
+        [self warnInUse];
+        return 0x00;
+    }
+    
+    _isExecutingStatement = YES;
+    
+    int rc                  = 0x00;
+    sqlite3_stmt *pStmt     = 0x00;
+    FMStatement *statement  = 0x00;
+    FMResultSet *rs         = 0x00;
+    
+    if (_traceExecution && sql) {
+        NSLog(@"%@ executeQuery: %@", self, sql);
+    }
+    
+    if (_shouldCacheStatements) {
+        statement = [self cachedStatementForQuery:sql];
+        pStmt = statement ? [statement statement] : 0x00;
+        [statement reset];
+    }
+    
+    if (!pStmt) {
+        rc = sqlite3_prepare_v2(_db, [sql UTF8String], -1, &pStmt, 0);
+        
+        if (SQLITE_OK != rc) {
+            if (_logsErrors) {
+                NSLog(@"DB Error: %d \"%@\"", [self lastErrorCode], [self lastErrorMessage]);
+                NSLog(@"DB Query: %@", sql);
+                NSLog(@"DB Path: %@", _databasePath);
+            }
+            
+            if (_crashOnErrors) {
+                NSAssert(false, @"DB Error: %d \"%@\"", [self lastErrorCode], [self lastErrorMessage]);
+                abort();
+            }
+            
+            sqlite3_finalize(pStmt);
+            pStmt = 0x00;
+            _isExecutingStatement = NO;
+            return nil;
+        }
+    }
+
+    if (shouldBind) {
+        BOOL success = [self bindStatement:pStmt WithArgumentsInArray:arrayArgs orDictionary:dictionaryArgs orVAList:args];
+        if (!success) {
+            return nil;
+        }
+    }
+
+    FMDBRetain(statement); // to balance the release below
+    
+    if (!statement) {
+        statement = [[FMStatement alloc] init];
+        [statement setStatement:pStmt];
+        
+        if (_shouldCacheStatements && sql) {
+            [self setCachedStatement:statement forQuery:sql];
+        }
+    }
+    
+    // the statement gets closed in rs's dealloc or [rs close];
+    // we should only autoclose if we're binding automatically when the statement is prepared
+    rs = [FMResultSet resultSetWithStatement:statement usingParentDatabase:self shouldAutoClose:shouldBind];
+    [rs setQuery:sql];
+    
+    NSValue *openResultSet = [NSValue valueWithNonretainedObject:rs];
+    [_openResultSets addObject:openResultSet];
+    
+    [statement setUseCount:[statement useCount] + 1];
+    
+    FMDBRelease(statement);
+    
+    _isExecutingStatement = NO;
+    
+    return rs;
+}
+
+- (BOOL)bindStatement:(sqlite3_stmt *)pStmt WithArgumentsInArray:(NSArray*)arrayArgs orDictionary:(NSDictionary *)dictionaryArgs orVAList:(va_list)args {
+    id obj;
+    int idx = 0;
+    int queryCount = sqlite3_bind_parameter_count(pStmt); // pointed out by Dominic Yu (thanks!)
+
+    // If dictionaryArgs is passed in, that means we are using sqlite's named parameter support
+    if (dictionaryArgs) {
+
+        for (NSString *dictionaryKey in [dictionaryArgs allKeys]) {
+
+            // Prefix the key with a colon.
+            NSString *parameterName = [[NSString alloc] initWithFormat:@":%@", dictionaryKey];
+
+            if (_traceExecution) {
+                NSLog(@"%@ = %@", parameterName, [dictionaryArgs objectForKey:dictionaryKey]);
+            }
+
+            // Get the index for the parameter name.
+            int namedIdx = sqlite3_bind_parameter_index(pStmt, [parameterName UTF8String]);
+
+            FMDBRelease(parameterName);
+
+            if (namedIdx > 0) {
+                // Standard binding from here.
+                int rc = [self bindObject:[dictionaryArgs objectForKey:dictionaryKey] toColumn:namedIdx inStatement:pStmt];
+                if (rc != SQLITE_OK) {
+                    NSLog(@"Error: unable to bind (%d, %s", rc, sqlite3_errmsg(_db));
+                    sqlite3_finalize(pStmt);
+                    pStmt = 0x00;
+                    _isExecutingStatement = NO;
+                    return false;
+                }
+                // increment the binding count, so our check below works out
+                idx++;
+            }
+            else {
+                NSLog(@"Could not find index for %@", dictionaryKey);
+            }
+        }
+    }
+    else {
+        while (idx < queryCount) {
+            if (arrayArgs && idx < (int)[arrayArgs count]) {
+                obj = [arrayArgs objectAtIndex:(NSUInteger)idx];
+            }
+            else if (args) {
+                obj = va_arg(args, id);
+            }
+            else {
+                //We ran out of arguments
+                break;
+            }
+
+            if (_traceExecution) {
+                if ([obj isKindOfClass:[NSData class]]) {
+                    NSLog(@"data: %ld bytes", (unsigned long)[(NSData*)obj length]);
+                }
+                else {
+                    NSLog(@"obj: %@", obj);
+                }
+            }
+
+            idx++;
+
+            int rc = [self bindObject:obj toColumn:idx inStatement:pStmt];
+            if (rc != SQLITE_OK) {
+                NSLog(@"Error: unable to bind (%d, %s", rc, sqlite3_errmsg(_db));
+                sqlite3_finalize(pStmt);
+                pStmt = 0x00;
+                _isExecutingStatement = NO;
+                return false;
+            }
+        }
+    }
+
+    if (idx != queryCount) {
+        NSLog(@"Error: the bind count is not correct for the # of variables (executeQuery)");
+        sqlite3_finalize(pStmt);
+        pStmt = 0x00;
+        _isExecutingStatement = NO;
+        return false;
+    }
+
+    return true;
+}
+
+- (FMResultSet *)executeQuery:(NSString*)sql, ... {
+    va_list args;
+    va_start(args, sql);
+    
+    id result = [self executeQuery:sql withArgumentsInArray:nil orDictionary:nil orVAList:args shouldBind:true];
+    
+    va_end(args);
+    return result;
+}
+
+- (FMResultSet *)executeQueryWithFormat:(NSString*)format, ... {
+    va_list args;
+    va_start(args, format);
+    
+    NSMutableString *sql = [NSMutableString stringWithCapacity:[format length]];
+    NSMutableArray *arguments = [NSMutableArray array];
+    [self extractSQL:format argumentsList:args intoString:sql arguments:arguments];
+    
+    va_end(args);
+    
+    return [self executeQuery:sql withArgumentsInArray:arguments];
+}
+
+- (FMResultSet *)executeQuery:(NSString *)sql withArgumentsInArray:(NSArray *)arguments {
+    return [self executeQuery:sql withArgumentsInArray:arguments orDictionary:nil orVAList:nil shouldBind:true];
+}
+
+- (FMResultSet *)executeQuery:(NSString *)sql values:(NSArray *)values error:(NSError * __autoreleasing *)error {
+    FMResultSet *rs = [self executeQuery:sql withArgumentsInArray:values orDictionary:nil orVAList:nil shouldBind:true];
+    if (!rs && error) {
+        *error = [self lastError];
+    }
+    return rs;
+}
+
+- (FMResultSet *)executeQuery:(NSString*)sql withVAList:(va_list)args {
+    return [self executeQuery:sql withArgumentsInArray:nil orDictionary:nil orVAList:args shouldBind:true];
+}
+
+#pragma mark Execute updates
+
+- (BOOL)executeUpdate:(NSString*)sql error:(NSError * _Nullable __autoreleasing *)outErr withArgumentsInArray:(NSArray*)arrayArgs orDictionary:(NSDictionary *)dictionaryArgs orVAList:(va_list)args {
+    FMResultSet *rs = [self executeQuery:sql withArgumentsInArray:arrayArgs orDictionary:dictionaryArgs orVAList:args shouldBind:true];
+    if (!rs) {
+        if (outErr) {
+            *outErr = [self lastError];
+        }
+        return false;
+    }
+
+    return [rs internalStepWithError:outErr] == SQLITE_DONE;
+}
+
+- (BOOL)executeUpdate:(NSString*)sql, ... {
+    va_list args;
+    va_start(args, sql);
+    
+    BOOL result = [self executeUpdate:sql error:nil withArgumentsInArray:nil orDictionary:nil orVAList:args];
+    
+    va_end(args);
+    return result;
+}
+
+- (BOOL)executeUpdate:(NSString*)sql withArgumentsInArray:(NSArray *)arguments {
+    return [self executeUpdate:sql error:nil withArgumentsInArray:arguments orDictionary:nil orVAList:nil];
+}
+
+- (BOOL)executeUpdate:(NSString*)sql values:(NSArray *)values error:(NSError * __autoreleasing *)error {
+    return [self executeUpdate:sql error:error withArgumentsInArray:values orDictionary:nil orVAList:nil];
+}
+
+- (BOOL)executeUpdate:(NSString*)sql withParameterDictionary:(NSDictionary *)arguments {
+    return [self executeUpdate:sql error:nil withArgumentsInArray:nil orDictionary:arguments orVAList:nil];
+}
+
+- (BOOL)executeUpdate:(NSString*)sql withVAList:(va_list)args {
+    return [self executeUpdate:sql error:nil withArgumentsInArray:nil orDictionary:nil orVAList:args];
+}
+
+- (BOOL)executeUpdateWithFormat:(NSString*)format, ... {
+    va_list args;
+    va_start(args, format);
+    
+    NSMutableString *sql      = [NSMutableString stringWithCapacity:[format length]];
+    NSMutableArray *arguments = [NSMutableArray array];
+    
+    [self extractSQL:format argumentsList:args intoString:sql arguments:arguments];
+    
+    va_end(args);
+    
+    return [self executeUpdate:sql withArgumentsInArray:arguments];
+}
+
+
+int FMDBExecuteBulkSQLCallback(void *theBlockAsVoid, int columns, char **values, char **names); // shhh clang.
+int FMDBExecuteBulkSQLCallback(void *theBlockAsVoid, int columns, char **values, char **names) {
+    
+    if (!theBlockAsVoid) {
+        return SQLITE_OK;
+    }
+    
+    int (^execCallbackBlock)(NSDictionary *resultsDictionary) = (__bridge int (^)(NSDictionary *__strong))(theBlockAsVoid);
+    
+    NSMutableDictionary *dictionary = [NSMutableDictionary dictionaryWithCapacity:(NSUInteger)columns];
+    
+    for (NSInteger i = 0; i < columns; i++) {
+        NSString *key = [NSString stringWithUTF8String:names[i]];
+        id value = values[i] ? [NSString stringWithUTF8String:values[i]] : [NSNull null];
+        value = value ? value : [NSNull null];
+        [dictionary setObject:value forKey:key];
+    }
+    
+    return execCallbackBlock(dictionary);
+}
+
+- (BOOL)executeStatements:(NSString *)sql {
+    return [self executeStatements:sql withResultBlock:nil];
+}
+
+- (BOOL)executeStatements:(NSString *)sql withResultBlock:(__attribute__((noescape)) FMDBExecuteStatementsCallbackBlock)block {
+    
+    int rc;
+    char *errmsg = nil;
+    
+    rc = sqlite3_exec([self sqliteHandle], [sql UTF8String], block ? FMDBExecuteBulkSQLCallback : nil, (__bridge void *)(block), &errmsg);
+    
+    if (errmsg && [self logsErrors]) {
+        NSLog(@"Error inserting batch: %s", errmsg);
+    }
+    if (errmsg) {
+        sqlite3_free(errmsg);
+    }
+    
+    return (rc == SQLITE_OK);
+}
+
+- (BOOL)executeUpdate:(NSString*)sql withErrorAndBindings:(NSError * _Nullable __autoreleasing *)outErr, ... {
+    
+    va_list args;
+    va_start(args, outErr);
+    
+    BOOL result = [self executeUpdate:sql error:outErr withArgumentsInArray:nil orDictionary:nil orVAList:args];
+    
+    va_end(args);
+    return result;
+}
+
+
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-implementations"
+- (BOOL)update:(NSString*)sql withErrorAndBindings:(NSError * _Nullable __autoreleasing *)outErr, ... {
+    va_list args;
+    va_start(args, outErr);
+    
+    BOOL result = [self executeUpdate:sql error:outErr withArgumentsInArray:nil orDictionary:nil orVAList:args];
+    
+    va_end(args);
+    return result;
+}
+
+#pragma clang diagnostic pop
+
+#pragma mark Prepare
+
+- (FMResultSet *)prepare:(NSString *)sql {
+    return [self executeQuery:sql withArgumentsInArray:nil orDictionary:nil orVAList:nil shouldBind:false];
+}
+
+#pragma mark Transactions
+
+- (BOOL)rollback {
+    BOOL b = [self executeUpdate:@"rollback transaction"];
+    
+    if (b) {
+        _isInTransaction = NO;
+    }
+    
+    return b;
+}
+
+- (BOOL)commit {
+    BOOL b =  [self executeUpdate:@"commit transaction"];
+    
+    if (b) {
+        _isInTransaction = NO;
+    }
+    
+    return b;
+}
+
+- (BOOL)beginTransaction {
+    
+    BOOL b = [self executeUpdate:@"begin exclusive transaction"];
+    if (b) {
+        _isInTransaction = YES;
+    }
+    
+    return b;
+}
+
+- (BOOL)beginDeferredTransaction {
+    
+    BOOL b = [self executeUpdate:@"begin deferred transaction"];
+    if (b) {
+        _isInTransaction = YES;
+    }
+    
+    return b;
+}
+
+- (BOOL)beginImmediateTransaction {
+    
+    BOOL b = [self executeUpdate:@"begin immediate transaction"];
+    if (b) {
+        _isInTransaction = YES;
+    }
+    
+    return b;
+}
+
+- (BOOL)beginExclusiveTransaction {
+    
+    BOOL b = [self executeUpdate:@"begin exclusive transaction"];
+    if (b) {
+        _isInTransaction = YES;
+    }
+    
+    return b;
+}
+
+- (BOOL)inTransaction {
+    return _isInTransaction;
+}
+
+- (BOOL)interrupt
+{
+    if (_db) {
+        sqlite3_interrupt([self sqliteHandle]);
+        return YES;
+    }
+    return NO;
+}
+
+static NSString *FMDBEscapeSavePointName(NSString *savepointName) {
+    return [savepointName stringByReplacingOccurrencesOfString:@"'" withString:@"''"];
+}
+
+- (BOOL)startSavePointWithName:(NSString*)name error:(NSError * _Nullable __autoreleasing *)outErr {
+#if SQLITE_VERSION_NUMBER >= 3007000
+    NSParameterAssert(name);
+    
+    NSString *sql = [NSString stringWithFormat:@"savepoint '%@';", FMDBEscapeSavePointName(name)];
+    
+    return [self executeUpdate:sql error:outErr withArgumentsInArray:nil orDictionary:nil orVAList:nil];
+#else
+    NSString *errorMessage = NSLocalizedStringFromTable(@"Save point functions require SQLite 3.7", @"FMDB", nil);
+    if (self.logsErrors) NSLog(@"%@", errorMessage);
+    return NO;
+#endif
+}
+
+- (BOOL)releaseSavePointWithName:(NSString*)name error:(NSError * _Nullable __autoreleasing *)outErr {
+#if SQLITE_VERSION_NUMBER >= 3007000
+    NSParameterAssert(name);
+    
+    NSString *sql = [NSString stringWithFormat:@"release savepoint '%@';", FMDBEscapeSavePointName(name)];
+
+    return [self executeUpdate:sql error:outErr withArgumentsInArray:nil orDictionary:nil orVAList:nil];
+#else
+    NSString *errorMessage = NSLocalizedStringFromTable(@"Save point functions require SQLite 3.7", @"FMDB", nil);
+    if (self.logsErrors) NSLog(@"%@", errorMessage);
+    return NO;
+#endif
+}
+
+- (BOOL)rollbackToSavePointWithName:(NSString*)name error:(NSError * _Nullable __autoreleasing *)outErr {
+#if SQLITE_VERSION_NUMBER >= 3007000
+    NSParameterAssert(name);
+    
+    NSString *sql = [NSString stringWithFormat:@"rollback transaction to savepoint '%@';", FMDBEscapeSavePointName(name)];
+
+    return [self executeUpdate:sql error:outErr withArgumentsInArray:nil orDictionary:nil orVAList:nil];
+#else
+    NSString *errorMessage = NSLocalizedStringFromTable(@"Save point functions require SQLite 3.7", @"FMDB", nil);
+    if (self.logsErrors) NSLog(@"%@", errorMessage);
+    return NO;
+#endif
+}
+
+- (NSError*)inSavePoint:(__attribute__((noescape)) void (^)(BOOL *rollback))block {
+#if SQLITE_VERSION_NUMBER >= 3007000
+    static unsigned long savePointIdx = 0;
+    
+    NSString *name = [NSString stringWithFormat:@"dbSavePoint%ld", savePointIdx++];
+    
+    BOOL shouldRollback = NO;
+    
+    NSError *err = 0x00;
+    
+    if (![self startSavePointWithName:name error:&err]) {
+        return err;
+    }
+    
+    if (block) {
+        block(&shouldRollback);
+    }
+    
+    if (shouldRollback) {
+        // We need to rollback and release this savepoint to remove it
+        [self rollbackToSavePointWithName:name error:&err];
+    }
+    [self releaseSavePointWithName:name error:&err];
+    
+    return err;
+#else
+    NSString *errorMessage = NSLocalizedStringFromTable(@"Save point functions require SQLite 3.7", @"FMDB", nil);
+    if (self.logsErrors) NSLog(@"%@", errorMessage);
+    return [NSError errorWithDomain:@"FMDatabase" code:0 userInfo:@{NSLocalizedDescriptionKey : errorMessage}];
+#endif
+}
+
+- (BOOL)checkpoint:(FMDBCheckpointMode)checkpointMode error:(NSError * __autoreleasing *)error {
+    return [self checkpoint:checkpointMode name:nil logFrameCount:NULL checkpointCount:NULL error:error];
+}
+
+- (BOOL)checkpoint:(FMDBCheckpointMode)checkpointMode name:(NSString *)name error:(NSError * __autoreleasing *)error {
+    return [self checkpoint:checkpointMode name:name logFrameCount:NULL checkpointCount:NULL error:error];
+}
+
+- (BOOL)checkpoint:(FMDBCheckpointMode)checkpointMode name:(NSString *)name logFrameCount:(int *)logFrameCount checkpointCount:(int *)checkpointCount error:(NSError * __autoreleasing *)error
+{
+    const char* dbName = [name UTF8String];
+#if SQLITE_VERSION_NUMBER >= 3007006
+    int err = sqlite3_wal_checkpoint_v2(_db, dbName, checkpointMode, logFrameCount, checkpointCount);
+#else
+    NSLog(@"sqlite3_wal_checkpoint_v2 unavailable before sqlite 3.7.6. Ignoring checkpoint mode: %d", mode);
+    int err = sqlite3_wal_checkpoint(_db, dbName);
+#endif
+    if(err != SQLITE_OK) {
+        if (error) {
+            *error = [self lastError];
+        }
+        if (self.logsErrors) NSLog(@"%@", [self lastErrorMessage]);
+        if (self.crashOnErrors) {
+            NSAssert(false, @"%@", [self lastErrorMessage]);
+            abort();
+        }
+        return NO;
+    } else {
+        return YES;
+    }
+}
+
+#pragma mark Cache statements
+
+- (BOOL)shouldCacheStatements {
+    return _shouldCacheStatements;
+}
+
+- (void)setShouldCacheStatements:(BOOL)value {
+    
+    _shouldCacheStatements = value;
+    
+    if (_shouldCacheStatements && !_cachedStatements) {
+        [self setCachedStatements:[NSMutableDictionary dictionary]];
+    }
+    
+    if (!_shouldCacheStatements) {
+        [self setCachedStatements:nil];
+    }
+}
+
+#pragma mark Callback function
+
+void FMDBBlockSQLiteCallBackFunction(sqlite3_context *context, int argc, sqlite3_value **argv); // -Wmissing-prototypes
+void FMDBBlockSQLiteCallBackFunction(sqlite3_context *context, int argc, sqlite3_value **argv) {
+#if ! __has_feature(objc_arc)
+    void (^block)(sqlite3_context *context, int argc, sqlite3_value **argv) = (id)sqlite3_user_data(context);
+#else
+    void (^block)(sqlite3_context *context, int argc, sqlite3_value **argv) = (__bridge id)sqlite3_user_data(context);
+#endif
+    if (block) {
+        @autoreleasepool {
+            block(context, argc, argv);
+        }
+    }
+}
+
+// deprecated because "arguments" parameter is not maximum argument count, but actual argument count.
+
+- (void)makeFunctionNamed:(NSString *)name maximumArguments:(int)arguments withBlock:(void (^)(void *context, int argc, void **argv))block {
+    [self makeFunctionNamed:name arguments:arguments block:block];
+}
+
+- (void)makeFunctionNamed:(NSString *)name arguments:(int)arguments block:(void (^)(void *context, int argc, void **argv))block {
+    
+    if (!_openFunctions) {
+        _openFunctions = [NSMutableSet new];
+    }
+    
+    id b = FMDBReturnAutoreleased([block copy]);
+    
+    [_openFunctions addObject:b];
+    
+    /* I tried adding custom functions to release the block when the connection is destroyed- but they seemed to never be called, so we use _openFunctions to store the values instead. */
+#if ! __has_feature(objc_arc)
+    sqlite3_create_function([self sqliteHandle], [name UTF8String], arguments, SQLITE_UTF8, (void*)b, &FMDBBlockSQLiteCallBackFunction, 0x00, 0x00);
+#else
+    sqlite3_create_function([self sqliteHandle], [name UTF8String], arguments, SQLITE_UTF8, (__bridge void*)b, &FMDBBlockSQLiteCallBackFunction, 0x00, 0x00);
+#endif
+}
+
+- (SqliteValueType)valueType:(void *)value {
+    return sqlite3_value_type(value);
+}
+
+- (int)valueInt:(void *)value {
+    return sqlite3_value_int(value);
+}
+
+- (long long)valueLong:(void *)value {
+    return sqlite3_value_int64(value);
+}
+
+- (double)valueDouble:(void *)value {
+    return sqlite3_value_double(value);
+}
+
+- (NSData *)valueData:(void *)value {
+    const void *bytes = sqlite3_value_blob(value);
+    int length = sqlite3_value_bytes(value);
+    return bytes ? [NSData dataWithBytes:bytes length:(NSUInteger)length] : nil;
+}
+
+- (NSString *)valueString:(void *)value {
+    const char *cString = (const char *)sqlite3_value_text(value);
+    return cString ? [NSString stringWithUTF8String:cString] : nil;
+}
+
+- (void)resultNullInContext:(void *)context {
+    sqlite3_result_null(context);
+}
+
+- (void)resultInt:(int) value context:(void *)context {
+    sqlite3_result_int(context, value);
+}
+
+- (void)resultLong:(long long)value context:(void *)context {
+    sqlite3_result_int64(context, value);
+}
+
+- (void)resultDouble:(double)value context:(void *)context {
+    sqlite3_result_double(context, value);
+}
+
+- (void)resultData:(NSData *)data context:(void *)context {
+    sqlite3_result_blob(context, data.bytes, (int)data.length, SQLITE_TRANSIENT);
+}
+
+- (void)resultString:(NSString *)value context:(void *)context {
+    sqlite3_result_text(context, [value UTF8String], -1, SQLITE_TRANSIENT);
+}
+
+- (void)resultError:(NSString *)error context:(void *)context {
+    sqlite3_result_error(context, [error UTF8String], -1);
+}
+
+- (void)resultErrorCode:(int)errorCode context:(void *)context {
+    sqlite3_result_error_code(context, errorCode);
+}
+
+- (void)resultErrorNoMemoryInContext:(void *)context {
+    sqlite3_result_error_nomem(context);
+}
+
+- (void)resultErrorTooBigInContext:(void *)context {
+    sqlite3_result_error_toobig(context);
+}
+
+@end
+
+// MARK: - FMStatement
+
+@implementation FMStatement
+
+#if ! __has_feature(objc_arc)
+- (void)finalize {
+    [self close];
+    [super finalize];
+}
+#endif
+
+- (void)dealloc {
+    [self close];
+    FMDBRelease(_query);
+#if ! __has_feature(objc_arc)
+    [super dealloc];
+#endif
+}
+
+- (void)close {
+    if (_statement) {
+        sqlite3_finalize(_statement);
+        _statement = 0x00;
+    }
+    
+    _inUse = NO;
+}
+
+- (void)reset {
+    if (_statement) {
+        sqlite3_reset(_statement);
+    }
+    
+    _inUse = NO;
+}
+
+- (NSString*)description {
+    return [NSString stringWithFormat:@"%@ %ld hit(s) for query %@", [super description], _useCount, _query];
+}
+
+@end
+

+ 243 - 0
Pods/FMDB/src/fmdb/FMDatabaseAdditions.h

@@ -0,0 +1,243 @@
+//
+//  FMDatabaseAdditions.h
+//  fmdb
+//
+//  Created by August Mueller on 10/30/05.
+//  Copyright 2005 Flying Meat Inc.. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import "FMDatabase.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+/** Category of additions for @c FMDatabase  class.
+ 
+ See also
+
+ - @c FMDatabase 
+ */
+
+@interface FMDatabase (FMDatabaseAdditions)
+
+///----------------------------------------
+/// @name Return results of SQL to variable
+///----------------------------------------
+
+/** Return @c int  value for query
+ 
+ @param query The SQL query to be performed, followed by a list of parameters that will be bound to the `?` placeholders in the SQL query.
+
+ @return @c int  value.
+ 
+ @note This is not available from Swift.
+ */
+
+- (int)intForQuery:(NSString*)query, ...;
+
+/** Return @c long  value for query
+
+ @param query The SQL query to be performed, followed by a list of parameters that will be bound to the `?` placeholders in the SQL query.
+
+ @return @c long  value.
+ 
+ @note This is not available from Swift.
+ */
+
+- (long)longForQuery:(NSString*)query, ...;
+
+/** Return `BOOL` value for query
+
+ @param query The SQL query to be performed, followed by a list of parameters that will be bound to the `?` placeholders in the SQL query.
+
+ @return `BOOL` value.
+ 
+ @note This is not available from Swift.
+ */
+
+- (BOOL)boolForQuery:(NSString*)query, ...;
+
+/** Return `double` value for query
+
+ @param query The SQL query to be performed, followed by a list of parameters that will be bound to the `?` placeholders in the SQL query.
+
+ @return `double` value.
+ 
+ @note This is not available from Swift.
+ */
+
+- (double)doubleForQuery:(NSString*)query, ...;
+
+/** Return @c NSString  value for query
+
+ @param query The SQL query to be performed, followed by a list of parameters that will be bound to the `?` placeholders in the SQL query.
+
+ @return @c NSString  value.
+ 
+ @note This is not available from Swift.
+ */
+
+- (NSString * _Nullable)stringForQuery:(NSString*)query, ...;
+
+/** Return @c NSData  value for query
+
+ @param query The SQL query to be performed, followed by a list of parameters that will be bound to the `?` placeholders in the SQL query.
+
+ @return @c NSData  value.
+ 
+ @note This is not available from Swift.
+ */
+
+- (NSData * _Nullable)dataForQuery:(NSString*)query, ...;
+
+/** Return @c NSDate  value for query
+
+ @param query The SQL query to be performed, followed by a list of parameters that will be bound to the `?` placeholders in the SQL query.
+
+ @return @c NSDate  value.
+ 
+ @note This is not available from Swift.
+ */
+
+- (NSDate * _Nullable)dateForQuery:(NSString*)query, ...;
+
+
+// Notice that there's no dataNoCopyForQuery:.
+// That would be a bad idea, because we close out the result set, and then what
+// happens to the data that we just didn't copy?  Who knows, not I.
+
+
+///--------------------------------
+/// @name Schema related operations
+///--------------------------------
+
+/** Does table exist in database?
+
+ @param tableName The name of the table being looked for.
+
+ @return @c YES if table found; @c NO if not found.
+ */
+
+- (BOOL)tableExists:(NSString*)tableName;
+
+/** The schema of the database.
+ 
+ This will be the schema for the entire database. For each entity, each row of the result set will include the following fields:
+ 
+ - `type` - The type of entity (e.g. table, index, view, or trigger)
+ - `name` - The name of the object
+ - `tbl_name` - The name of the table to which the object references
+ - `rootpage` - The page number of the root b-tree page for tables and indices
+ - `sql` - The SQL that created the entity
+
+ @return `FMResultSet` of schema; @c nil  on error.
+ 
+ @see [SQLite File Format](https://sqlite.org/fileformat.html)
+ */
+
+- (FMResultSet * _Nullable)getSchema;
+
+/** The schema of the database.
+
+ This will be the schema for a particular table as report by SQLite `PRAGMA`, for example:
+ 
+    PRAGMA table_info('employees')
+ 
+ This will report:
+ 
+ - `cid` - The column ID number
+ - `name` - The name of the column
+ - `type` - The data type specified for the column
+ - `notnull` - whether the field is defined as NOT NULL (i.e. values required)
+ - `dflt_value` - The default value for the column
+ - `pk` - Whether the field is part of the primary key of the table
+
+ @param tableName The name of the table for whom the schema will be returned.
+ 
+ @return `FMResultSet` of schema; @c nil  on error.
+ 
+ @see [table_info](https://sqlite.org/pragma.html#pragma_table_info)
+ */
+
+- (FMResultSet * _Nullable)getTableSchema:(NSString*)tableName;
+
+/** Test to see if particular column exists for particular table in database
+ 
+ @param columnName The name of the column.
+ 
+ @param tableName The name of the table.
+ 
+ @return @c YES if column exists in table in question; @c NO otherwise.
+ */
+
+- (BOOL)columnExists:(NSString*)columnName inTableWithName:(NSString*)tableName;
+
+/** Test to see if particular column exists for particular table in database
+
+ @param columnName The name of the column.
+
+ @param tableName The name of the table.
+
+ @return @c YES if column exists in table in question; @c NO otherwise.
+ 
+ @see columnExists:inTableWithName:
+ 
+ @warning Deprecated - use `<columnExists:inTableWithName:>` instead.
+ */
+
+- (BOOL)columnExists:(NSString*)tableName columnName:(NSString*)columnName __deprecated_msg("Use columnExists:inTableWithName: instead");
+
+
+/** Validate SQL statement
+ 
+ This validates SQL statement by performing `sqlite3_prepare_v2`, but not returning the results, but instead immediately calling `sqlite3_finalize`.
+ 
+ @param sql The SQL statement being validated.
+ 
+ @param error This is a pointer to a @c NSError  object that will receive the autoreleased @c NSError  object if there was any error. If this is @c nil , no @c NSError  result will be returned.
+ 
+ @return @c YES if validation succeeded without incident; @c NO otherwise.
+ 
+ */
+
+- (BOOL)validateSQL:(NSString*)sql error:(NSError * _Nullable __autoreleasing *)error;
+
+
+///-----------------------------------
+/// @name Application identifier tasks
+///-----------------------------------
+
+/** Retrieve application ID
+ 
+ @return The `uint32_t` numeric value of the application ID.
+ 
+ @see setApplicationID:
+ */
+
+@property (nonatomic) uint32_t applicationID;
+
+#if TARGET_OS_MAC && !TARGET_OS_IPHONE
+
+/** Retrieve application ID string
+
+ @see setApplicationIDString:
+ */
+
+@property (nonatomic, retain) NSString *applicationIDString;
+
+#endif
+
+///-----------------------------------
+/// @name user version identifier tasks
+///-----------------------------------
+
+/** Retrieve user version
+ 
+ @see setUserVersion:
+ */
+
+@property (nonatomic) uint32_t userVersion;
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 245 - 0
Pods/FMDB/src/fmdb/FMDatabaseAdditions.m

@@ -0,0 +1,245 @@
+//
+//  FMDatabaseAdditions.m
+//  fmdb
+//
+//  Created by August Mueller on 10/30/05.
+//  Copyright 2005 Flying Meat Inc.. All rights reserved.
+//
+
+#import "FMDatabase.h"
+#import "FMDatabaseAdditions.h"
+#import "TargetConditionals.h"
+
+#if FMDB_SQLITE_STANDALONE
+#import <sqlite3/sqlite3.h>
+#else
+#import <sqlite3.h>
+#endif
+
+@interface FMDatabase (PrivateStuff)
+- (FMResultSet * _Nullable)executeQuery:(NSString *)sql withArgumentsInArray:(NSArray * _Nullable)arrayArgs orDictionary:(NSDictionary * _Nullable)dictionaryArgs orVAList:(va_list)args shouldBind:(BOOL)shouldBind;
+@end
+
+@implementation FMDatabase (FMDatabaseAdditions)
+
+#define RETURN_RESULT_FOR_QUERY_WITH_SELECTOR(type, sel)             \
+va_list args;                                                        \
+va_start(args, query);                                               \
+FMResultSet *resultSet = [self executeQuery:query withArgumentsInArray:0x00 orDictionary:0x00 orVAList:args shouldBind:true];   \
+va_end(args);                                                        \
+if (![resultSet next]) { return (type)0; }                           \
+type ret = [resultSet sel:0];                                        \
+[resultSet close];                                                   \
+[resultSet setParentDB:nil];                                         \
+return ret;
+
+
+- (NSString *)stringForQuery:(NSString*)query, ... {
+    RETURN_RESULT_FOR_QUERY_WITH_SELECTOR(NSString *, stringForColumnIndex);
+}
+
+- (int)intForQuery:(NSString*)query, ... {
+    RETURN_RESULT_FOR_QUERY_WITH_SELECTOR(int, intForColumnIndex);
+}
+
+- (long)longForQuery:(NSString*)query, ... {
+    RETURN_RESULT_FOR_QUERY_WITH_SELECTOR(long, longForColumnIndex);
+}
+
+- (BOOL)boolForQuery:(NSString*)query, ... {
+    RETURN_RESULT_FOR_QUERY_WITH_SELECTOR(BOOL, boolForColumnIndex);
+}
+
+- (double)doubleForQuery:(NSString*)query, ... {
+    RETURN_RESULT_FOR_QUERY_WITH_SELECTOR(double, doubleForColumnIndex);
+}
+
+- (NSData*)dataForQuery:(NSString*)query, ... {
+    RETURN_RESULT_FOR_QUERY_WITH_SELECTOR(NSData *, dataForColumnIndex);
+}
+
+- (NSDate*)dateForQuery:(NSString*)query, ... {
+    RETURN_RESULT_FOR_QUERY_WITH_SELECTOR(NSDate *, dateForColumnIndex);
+}
+
+
+- (BOOL)tableExists:(NSString*)tableName {
+    
+    tableName = [tableName lowercaseString];
+    
+    FMResultSet *rs = [self executeQuery:@"select [sql] from sqlite_master where [type] = 'table' and lower(name) = ?", tableName];
+    
+    //if at least one next exists, table exists
+    BOOL returnBool = [rs next];
+    
+    //close and free object
+    [rs close];
+    
+    return returnBool;
+}
+
+/*
+ get table with list of tables: result colums: type[STRING], name[STRING],tbl_name[STRING],rootpage[INTEGER],sql[STRING]
+ check if table exist in database  (patch from OZLB)
+*/
+- (FMResultSet * _Nullable)getSchema {
+    
+    //result colums: type[STRING], name[STRING],tbl_name[STRING],rootpage[INTEGER],sql[STRING]
+    FMResultSet *rs = [self executeQuery:@"SELECT type, name, tbl_name, rootpage, sql FROM (SELECT * FROM sqlite_master UNION ALL SELECT * FROM sqlite_temp_master) WHERE type != 'meta' AND name NOT LIKE 'sqlite_%' ORDER BY tbl_name, type DESC, name"];
+    
+    return rs;
+}
+
+/* 
+ get table schema: result colums: cid[INTEGER], name,type [STRING], notnull[INTEGER], dflt_value[],pk[INTEGER]
+*/
+- (FMResultSet * _Nullable)getTableSchema:(NSString*)tableName {
+    
+    //result colums: cid[INTEGER], name,type [STRING], notnull[INTEGER], dflt_value[],pk[INTEGER]
+    FMResultSet *rs = [self executeQuery:[NSString stringWithFormat: @"pragma table_info('%@')", tableName]];
+    
+    return rs;
+}
+
+- (BOOL)columnExists:(NSString*)columnName inTableWithName:(NSString*)tableName {
+    
+    BOOL returnBool = NO;
+    
+    tableName  = [tableName lowercaseString];
+    columnName = [columnName lowercaseString];
+    
+    FMResultSet *rs = [self getTableSchema:tableName];
+    
+    //check if column is present in table schema
+    while ([rs next]) {
+        if ([[[rs stringForColumn:@"name"] lowercaseString] isEqualToString:columnName]) {
+            returnBool = YES;
+            break;
+        }
+    }
+    
+    //If this is not done FMDatabase instance stays out of pool
+    [rs close];
+    
+    return returnBool;
+}
+
+
+
+- (uint32_t)applicationID {
+#if SQLITE_VERSION_NUMBER >= 3007017
+    uint32_t r = 0;
+    
+    FMResultSet *rs = [self executeQuery:@"pragma application_id"];
+    
+    if ([rs next]) {
+        r = (uint32_t)[rs longLongIntForColumnIndex:0];
+    }
+    
+    [rs close];
+    
+    return r;
+#else
+    NSString *errorMessage = NSLocalizedStringFromTable(@"Application ID functions require SQLite 3.7.17", @"FMDB", nil);
+    if (self.logsErrors) NSLog(@"%@", errorMessage);
+    return 0;
+#endif
+}
+
+- (void)setApplicationID:(uint32_t)appID {
+#if SQLITE_VERSION_NUMBER >= 3007017
+    NSString *query = [NSString stringWithFormat:@"pragma application_id=%d", appID];
+    FMResultSet *rs = [self executeQuery:query];
+    [rs next];
+    [rs close];
+#else
+    NSString *errorMessage = NSLocalizedStringFromTable(@"Application ID functions require SQLite 3.7.17", @"FMDB", nil);
+    if (self.logsErrors) NSLog(@"%@", errorMessage);
+#endif
+}
+
+
+#if TARGET_OS_MAC && !TARGET_OS_IPHONE
+
+- (NSString*)applicationIDString {
+#if SQLITE_VERSION_NUMBER >= 3007017
+    NSString *s = NSFileTypeForHFSTypeCode([self applicationID]);
+    
+    assert([s length] == 6);
+    
+    s = [s substringWithRange:NSMakeRange(1, 4)];
+    
+    
+    return s;
+#else
+    NSString *errorMessage = NSLocalizedStringFromTable(@"Application ID functions require SQLite 3.7.17", @"FMDB", nil);
+    if (self.logsErrors) NSLog(@"%@", errorMessage);
+    return nil;
+#endif
+}
+
+- (void)setApplicationIDString:(NSString*)s {
+#if SQLITE_VERSION_NUMBER >= 3007017
+    if ([s length] != 4) {
+        NSLog(@"setApplicationIDString: string passed is not exactly 4 chars long. (was %ld)", [s length]);
+    }
+    
+    [self setApplicationID:NSHFSTypeCodeFromFileType([NSString stringWithFormat:@"'%@'", s])];
+#else
+    NSString *errorMessage = NSLocalizedStringFromTable(@"Application ID functions require SQLite 3.7.17", @"FMDB", nil);
+    if (self.logsErrors) NSLog(@"%@", errorMessage);
+#endif
+}
+
+#endif
+
+- (uint32_t)userVersion {
+    uint32_t r = 0;
+    
+    FMResultSet *rs = [self executeQuery:@"pragma user_version"];
+    
+    if ([rs next]) {
+        r = (uint32_t)[rs longLongIntForColumnIndex:0];
+    }
+    
+    [rs close];
+    return r;
+}
+
+- (void)setUserVersion:(uint32_t)version {
+    NSString *query = [NSString stringWithFormat:@"pragma user_version = %d", version];
+    FMResultSet *rs = [self executeQuery:query];
+    [rs next];
+    [rs close];
+}
+
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-implementations"
+
+- (BOOL)columnExists:(NSString*)tableName columnName:(NSString*)columnName __attribute__ ((deprecated)) {
+    return [self columnExists:columnName inTableWithName:tableName];
+}
+
+#pragma clang diagnostic pop
+
+- (BOOL)validateSQL:(NSString*)sql error:(NSError * _Nullable __autoreleasing *)error {
+    sqlite3_stmt *pStmt = NULL;
+    BOOL validationSucceeded = YES;
+    
+    int rc = sqlite3_prepare_v2([self sqliteHandle], [sql UTF8String], -1, &pStmt, 0);
+    if (rc != SQLITE_OK) {
+        validationSucceeded = NO;
+        if (error) {
+            *error = [NSError errorWithDomain:NSCocoaErrorDomain
+                                         code:[self lastErrorCode]
+                                     userInfo:[NSDictionary dictionaryWithObject:[self lastErrorMessage]
+                                                                          forKey:NSLocalizedDescriptionKey]];
+        }
+    }
+    
+    sqlite3_finalize(pStmt);
+    
+    return validationSucceeded;
+}
+
+@end

+ 280 - 0
Pods/FMDB/src/fmdb/FMDatabasePool.h

@@ -0,0 +1,280 @@
+//
+//  FMDatabasePool.h
+//  fmdb
+//
+//  Created by August Mueller on 6/22/11.
+//  Copyright 2011 Flying Meat Inc. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@class FMDatabase;
+
+/** Pool of @c FMDatabase  objects.
+
+ See also
+ 
+ - @c FMDatabaseQueue 
+ - @c FMDatabase 
+
+ @warning Before using @c FMDatabasePool , please consider using @c FMDatabaseQueue  instead.
+
+ If you really really really know what you're doing and @c FMDatabasePool  is what
+ you really really need (ie, you're using a read only database), OK you can use
+ it.  But just be careful not to deadlock!
+
+ For an example on deadlocking, search for:
+ `ONLY_USE_THE_POOL_IF_YOU_ARE_DOING_READS_OTHERWISE_YOULL_DEADLOCK_USE_FMDATABASEQUEUE_INSTEAD`
+ in the main.m file.
+ */
+
+@interface FMDatabasePool : NSObject
+
+/** Database path */
+
+@property (atomic, copy, nullable) NSString *path;
+
+/** Delegate object */
+
+@property (atomic, unsafe_unretained, nullable) id delegate;
+
+/** Maximum number of databases to create */
+
+@property (atomic, assign) NSUInteger maximumNumberOfDatabasesToCreate;
+
+/** Open flags */
+
+@property (atomic, readonly) int openFlags;
+
+/**  Custom virtual file system name */
+
+@property (atomic, copy, nullable) NSString *vfsName;
+
+
+///---------------------
+/// @name Initialization
+///---------------------
+
+/** Create pool using path.
+ 
+ @param aPath The file path of the database.
+ 
+ @return The @c FMDatabasePool  object. @c nil  on error.
+ */
+
++ (instancetype)databasePoolWithPath:(NSString * _Nullable)aPath;
+
+/** Create pool using file URL.
+ 
+ @param url The file @c NSURL  of the database.
+ 
+ @return The @c FMDatabasePool  object. @c nil  on error.
+ */
+
++ (instancetype)databasePoolWithURL:(NSURL * _Nullable)url;
+
+/** Create pool using path and specified flags
+ 
+ @param aPath The file path of the database.
+ @param openFlags Flags passed to the openWithFlags method of the database.
+ 
+ @return The @c FMDatabasePool  object. @c nil  on error.
+ */
+
++ (instancetype)databasePoolWithPath:(NSString * _Nullable)aPath flags:(int)openFlags;
+
+/** Create pool using file URL and specified flags
+ 
+ @param url The file @c NSURL  of the database.
+ @param openFlags Flags passed to the openWithFlags method of the database.
+ 
+ @return The @c FMDatabasePool  object. @c nil  on error.
+ */
+
++ (instancetype)databasePoolWithURL:(NSURL * _Nullable)url flags:(int)openFlags;
+
+/** Create pool using path.
+ 
+ @param aPath The file path of the database.
+ 
+ @return The @c FMDatabasePool  object. @c nil  on error.
+ */
+
+- (instancetype)initWithPath:(NSString * _Nullable)aPath;
+
+/** Create pool using file URL.
+ 
+ @param url The file `NSURL of the database.
+ 
+ @return The @c FMDatabasePool  object. @c nil  on error.
+ */
+
+- (instancetype)initWithURL:(NSURL * _Nullable)url;
+
+/** Create pool using path and specified flags.
+ 
+ @param aPath The file path of the database.
+ @param openFlags Flags passed to the openWithFlags method of the database
+ 
+ @return The @c FMDatabasePool  object. @c nil  on error.
+ */
+
+- (instancetype)initWithPath:(NSString * _Nullable)aPath flags:(int)openFlags;
+
+/** Create pool using file URL and specified flags.
+ 
+ @param url The file @c NSURL  of the database.
+ @param openFlags Flags passed to the openWithFlags method of the database
+ 
+ @return The @c FMDatabasePool  object. @c nil  on error.
+ */
+
+- (instancetype)initWithURL:(NSURL * _Nullable)url flags:(int)openFlags;
+
+/** Create pool using path and specified flags.
+ 
+ @param aPath The file path of the database.
+ @param openFlags Flags passed to the openWithFlags method of the database
+ @param vfsName The name of a custom virtual file system
+ 
+ @return The @c FMDatabasePool  object. @c nil  on error.
+ */
+
+- (instancetype)initWithPath:(NSString * _Nullable)aPath flags:(int)openFlags vfs:(NSString * _Nullable)vfsName;
+
+/** Create pool using file URL and specified flags.
+ 
+ @param url The file @c NSURL  of the database.
+ @param openFlags Flags passed to the openWithFlags method of the database
+ @param vfsName The name of a custom virtual file system
+ 
+ @return The @c FMDatabasePool  object. @c nil  on error.
+ */
+
+- (instancetype)initWithURL:(NSURL * _Nullable)url flags:(int)openFlags vfs:(NSString * _Nullable)vfsName;
+
+/** Returns the Class of 'FMDatabase' subclass, that will be used to instantiate database object.
+
+ Subclasses can override this method to return specified Class of 'FMDatabase' subclass.
+
+ @return The Class of 'FMDatabase' subclass, that will be used to instantiate database object.
+ */
+
++ (Class)databaseClass;
+
+///------------------------------------------------
+/// @name Keeping track of checked in/out databases
+///------------------------------------------------
+
+/** Number of checked-in databases in pool
+ */
+
+@property (nonatomic, readonly) NSUInteger countOfCheckedInDatabases;
+
+/** Number of checked-out databases in pool
+ */
+
+@property (nonatomic, readonly) NSUInteger countOfCheckedOutDatabases;
+
+/** Total number of databases in pool
+ */
+
+@property (nonatomic, readonly) NSUInteger countOfOpenDatabases;
+
+/** Release all databases in pool */
+
+- (void)releaseAllDatabases;
+
+///------------------------------------------
+/// @name Perform database operations in pool
+///------------------------------------------
+
+/** Synchronously perform database operations in pool.
+
+ @param block The code to be run on the @c FMDatabasePool  pool.
+ */
+
+- (void)inDatabase:(__attribute__((noescape)) void (^)(FMDatabase *db))block;
+
+/** Synchronously perform database operations in pool using transaction.
+ 
+ @param block The code to be run on the @c FMDatabasePool  pool.
+ 
+ @warning   Unlike SQLite's `BEGIN TRANSACTION`, this method currently performs
+            an exclusive transaction, not a deferred transaction. This behavior
+            is likely to change in future versions of FMDB, whereby this method
+            will likely eventually adopt standard SQLite behavior and perform
+            deferred transactions. If you really need exclusive tranaction, it is
+            recommended that you use `inExclusiveTransaction`, instead, not only
+            to make your intent explicit, but also to future-proof your code.
+  */
+
+- (void)inTransaction:(__attribute__((noescape)) void (^)(FMDatabase *db, BOOL *rollback))block;
+
+/** Synchronously perform database operations in pool using exclusive transaction.
+ 
+ @param block The code to be run on the @c FMDatabasePool  pool.
+ */
+
+- (void)inExclusiveTransaction:(__attribute__((noescape)) void (^)(FMDatabase *db, BOOL *rollback))block;
+
+/** Synchronously perform database operations in pool using deferred transaction.
+
+ @param block The code to be run on the @c FMDatabasePool  pool.
+ */
+
+- (void)inDeferredTransaction:(__attribute__((noescape)) void (^)(FMDatabase *db, BOOL *rollback))block;
+
+/** Synchronously perform database operations on queue, using immediate transactions.
+
+ @param block The code to be run on the queue of @c FMDatabaseQueue 
+ */
+
+- (void)inImmediateTransaction:(__attribute__((noescape)) void (^)(FMDatabase *db, BOOL *rollback))block;
+
+/** Synchronously perform database operations in pool using save point.
+
+ @param block The code to be run on the @c FMDatabasePool  pool.
+ 
+ @return @c NSError  object if error; @c nil  if successful.
+
+ @warning You can not nest these, since calling it will pull another database out of the pool and you'll get a deadlock. If you need to nest, use @c startSavePointWithName:error:  instead.
+*/
+
+- (NSError * _Nullable)inSavePoint:(__attribute__((noescape)) void (^)(FMDatabase *db, BOOL *rollback))block;
+
+@end
+
+
+/** FMDatabasePool delegate category
+ 
+ This is a category that defines the protocol for the FMDatabasePool delegate
+ */
+
+@interface NSObject (FMDatabasePoolDelegate)
+
+/** Asks the delegate whether database should be added to the pool. 
+ 
+ @param pool     The @c FMDatabasePool  object.
+ @param database The @c FMDatabase  object.
+ 
+ @return @c YES if it should add database to pool; @c NO if not.
+ 
+ */
+
+- (BOOL)databasePool:(FMDatabasePool*)pool shouldAddDatabaseToPool:(FMDatabase*)database;
+
+/** Tells the delegate that database was added to the pool.
+ 
+ @param pool     The @c FMDatabasePool  object.
+ @param database The @c FMDatabase  object.
+
+ */
+
+- (void)databasePool:(FMDatabasePool*)pool didAddDatabase:(FMDatabase*)database;
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 335 - 0
Pods/FMDB/src/fmdb/FMDatabasePool.m

@@ -0,0 +1,335 @@
+//
+//  FMDatabasePool.m
+//  fmdb
+//
+//  Created by August Mueller on 6/22/11.
+//  Copyright 2011 Flying Meat Inc. All rights reserved.
+//
+
+#if FMDB_SQLITE_STANDALONE
+#import <sqlite3/sqlite3.h>
+#else
+#import <sqlite3.h>
+#endif
+
+#import "FMDatabasePool.h"
+#import "FMDatabase.h"
+
+typedef NS_ENUM(NSInteger, FMDBTransaction) {
+    FMDBTransactionExclusive,
+    FMDBTransactionDeferred,
+    FMDBTransactionImmediate,
+};
+
+@interface FMDatabasePool () {
+    dispatch_queue_t    _lockQueue;
+    
+    NSMutableArray      *_databaseInPool;
+    NSMutableArray      *_databaseOutPool;
+}
+
+- (void)pushDatabaseBackInPool:(FMDatabase*)db;
+- (FMDatabase*)db;
+
+@end
+
+
+@implementation FMDatabasePool
+@synthesize path=_path;
+@synthesize delegate=_delegate;
+@synthesize maximumNumberOfDatabasesToCreate=_maximumNumberOfDatabasesToCreate;
+@synthesize openFlags=_openFlags;
+
+
++ (instancetype)databasePoolWithPath:(NSString *)aPath {
+    return FMDBReturnAutoreleased([[self alloc] initWithPath:aPath]);
+}
+
++ (instancetype)databasePoolWithURL:(NSURL *)url {
+    return FMDBReturnAutoreleased([[self alloc] initWithPath:url.path]);
+}
+
++ (instancetype)databasePoolWithPath:(NSString *)aPath flags:(int)openFlags {
+    return FMDBReturnAutoreleased([[self alloc] initWithPath:aPath flags:openFlags]);
+}
+
++ (instancetype)databasePoolWithURL:(NSURL *)url flags:(int)openFlags {
+    return FMDBReturnAutoreleased([[self alloc] initWithPath:url.path flags:openFlags]);
+}
+
+- (instancetype)initWithURL:(NSURL *)url flags:(int)openFlags vfs:(NSString *)vfsName {
+    return [self initWithPath:url.path flags:openFlags vfs:vfsName];
+}
+
+- (instancetype)initWithPath:(NSString*)aPath flags:(int)openFlags vfs:(NSString *)vfsName {
+    
+    self = [super init];
+    
+    if (self != nil) {
+        _path               = [aPath copy];
+        _lockQueue          = dispatch_queue_create([[NSString stringWithFormat:@"fmdb.%@", self] UTF8String], NULL);
+        _databaseInPool     = FMDBReturnRetained([NSMutableArray array]);
+        _databaseOutPool    = FMDBReturnRetained([NSMutableArray array]);
+        _openFlags          = openFlags;
+        _vfsName            = [vfsName copy];
+    }
+    
+    return self;
+}
+
+- (instancetype)initWithPath:(NSString *)aPath flags:(int)openFlags {
+    return [self initWithPath:aPath flags:openFlags vfs:nil];
+}
+
+- (instancetype)initWithURL:(NSURL *)url flags:(int)openFlags {
+    return [self initWithPath:url.path flags:openFlags vfs:nil];
+}
+
+- (instancetype)initWithPath:(NSString*)aPath {
+    // default flags for sqlite3_open
+    return [self initWithPath:aPath flags:SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE];
+}
+
+- (instancetype)initWithURL:(NSURL *)url {
+    return [self initWithPath:url.path];
+}
+
+- (instancetype)init {
+    return [self initWithPath:nil];
+}
+
++ (Class)databaseClass {
+    return [FMDatabase class];
+}
+
+- (void)dealloc {
+    
+    _delegate = 0x00;
+    FMDBRelease(_path);
+    FMDBRelease(_databaseInPool);
+    FMDBRelease(_databaseOutPool);
+    FMDBRelease(_vfsName);
+    
+    if (_lockQueue) {
+        FMDBDispatchQueueRelease(_lockQueue);
+        _lockQueue = 0x00;
+    }
+#if ! __has_feature(objc_arc)
+    [super dealloc];
+#endif
+}
+
+
+- (void)executeLocked:(void (^)(void))aBlock {
+    dispatch_sync(_lockQueue, aBlock);
+}
+
+- (void)pushDatabaseBackInPool:(FMDatabase*)db {
+    
+    if (!db) { // db can be null if we set an upper bound on the # of databases to create.
+        return;
+    }
+    
+    [self executeLocked:^() {
+        
+        if ([self->_databaseInPool containsObject:db]) {
+            [[NSException exceptionWithName:@"Database already in pool" reason:@"The FMDatabase being put back into the pool is already present in the pool" userInfo:nil] raise];
+        }
+        
+        [self->_databaseInPool addObject:db];
+        [self->_databaseOutPool removeObject:db];
+        
+    }];
+}
+
+- (FMDatabase*)db {
+    
+    __block FMDatabase *db;
+    
+    
+    [self executeLocked:^() {
+        db = [self->_databaseInPool lastObject];
+        
+        BOOL shouldNotifyDelegate = NO;
+        
+        if (db) {
+            [self->_databaseOutPool addObject:db];
+            [self->_databaseInPool removeLastObject];
+        }
+        else {
+            
+            if (self->_maximumNumberOfDatabasesToCreate) {
+                NSUInteger currentCount = [self->_databaseOutPool count] + [self->_databaseInPool count];
+                
+                if (currentCount >= self->_maximumNumberOfDatabasesToCreate) {
+                    NSLog(@"Maximum number of databases (%ld) has already been reached!", (long)currentCount);
+                    return;
+                }
+            }
+            
+            db = [[[self class] databaseClass] databaseWithPath:self->_path];
+            shouldNotifyDelegate = YES;
+        }
+        
+        //This ensures that the db is opened before returning
+#if SQLITE_VERSION_NUMBER >= 3005000
+        BOOL success = [db openWithFlags:self->_openFlags vfs:self->_vfsName];
+#else
+        BOOL success = [db open];
+#endif
+        if (success) {
+            if ([self->_delegate respondsToSelector:@selector(databasePool:shouldAddDatabaseToPool:)] && ![self->_delegate databasePool:self shouldAddDatabaseToPool:db]) {
+                [db close];
+                db = 0x00;
+            }
+            else {
+                //It should not get added in the pool twice if lastObject was found
+                if (![self->_databaseOutPool containsObject:db]) {
+                    [self->_databaseOutPool addObject:db];
+                    
+                    if (shouldNotifyDelegate && [self->_delegate respondsToSelector:@selector(databasePool:didAddDatabase:)]) {
+                        [self->_delegate databasePool:self didAddDatabase:db];
+                    }
+                }
+            }
+        }
+        else {
+            NSLog(@"Could not open up the database at path %@", self->_path);
+            db = 0x00;
+        }
+    }];
+    
+    return db;
+}
+
+- (NSUInteger)countOfCheckedInDatabases {
+    
+    __block NSUInteger count;
+    
+    [self executeLocked:^() {
+        count = [self->_databaseInPool count];
+    }];
+    
+    return count;
+}
+
+- (NSUInteger)countOfCheckedOutDatabases {
+    
+    __block NSUInteger count;
+    
+    [self executeLocked:^() {
+        count = [self->_databaseOutPool count];
+    }];
+    
+    return count;
+}
+
+- (NSUInteger)countOfOpenDatabases {
+    __block NSUInteger count;
+    
+    [self executeLocked:^() {
+        count = [self->_databaseOutPool count] + [self->_databaseInPool count];
+    }];
+    
+    return count;
+}
+
+- (void)releaseAllDatabases {
+    [self executeLocked:^() {
+        [self->_databaseOutPool removeAllObjects];
+        [self->_databaseInPool removeAllObjects];
+    }];
+}
+
+- (void)inDatabase:(__attribute__((noescape)) void (^)(FMDatabase *db))block {
+    
+    FMDatabase *db = [self db];
+    
+    block(db);
+    
+    [self pushDatabaseBackInPool:db];
+}
+
+- (void)beginTransaction:(FMDBTransaction)transaction withBlock:(void (^)(FMDatabase *db, BOOL *rollback))block {
+    
+    BOOL shouldRollback = NO;
+    
+    FMDatabase *db = [self db];
+    
+    switch (transaction) {
+        case FMDBTransactionExclusive:
+            [db beginTransaction];
+            break;
+        case FMDBTransactionDeferred:
+            [db beginDeferredTransaction];
+            break;
+        case FMDBTransactionImmediate:
+            [db beginImmediateTransaction];
+            break;
+    }
+    
+    
+    block(db, &shouldRollback);
+    
+    if (shouldRollback) {
+        [db rollback];
+    }
+    else {
+        [db commit];
+    }
+    
+    [self pushDatabaseBackInPool:db];
+}
+
+- (void)inTransaction:(__attribute__((noescape)) void (^)(FMDatabase *db, BOOL *rollback))block {
+    [self beginTransaction:FMDBTransactionExclusive withBlock:block];
+}
+
+- (void)inDeferredTransaction:(__attribute__((noescape)) void (^)(FMDatabase *db, BOOL *rollback))block {
+    [self beginTransaction:FMDBTransactionDeferred withBlock:block];
+}
+
+- (void)inExclusiveTransaction:(__attribute__((noescape)) void (^)(FMDatabase *db, BOOL *rollback))block {
+    [self beginTransaction:FMDBTransactionExclusive withBlock:block];
+}
+
+- (void)inImmediateTransaction:(__attribute__((noescape)) void (^)(FMDatabase *db, BOOL *rollback))block {
+    [self beginTransaction:FMDBTransactionImmediate withBlock:block];
+}
+
+- (NSError*)inSavePoint:(__attribute__((noescape)) void (^)(FMDatabase *db, BOOL *rollback))block {
+#if SQLITE_VERSION_NUMBER >= 3007000
+    static unsigned long savePointIdx = 0;
+    
+    NSString *name = [NSString stringWithFormat:@"savePoint%ld", savePointIdx++];
+    
+    BOOL shouldRollback = NO;
+    
+    FMDatabase *db = [self db];
+    
+    NSError *err = 0x00;
+    
+    if (![db startSavePointWithName:name error:&err]) {
+        [self pushDatabaseBackInPool:db];
+        return err;
+    }
+    
+    block(db, &shouldRollback);
+    
+    if (shouldRollback) {
+        // We need to rollback and release this savepoint to remove it
+        [db rollbackToSavePointWithName:name error:&err];
+    }
+    [db releaseSavePointWithName:name error:&err];
+    
+    [self pushDatabaseBackInPool:db];
+    
+    return err;
+#else
+    NSString *errorMessage = NSLocalizedStringFromTable(@"Save point functions require SQLite 3.7", @"FMDB", nil);
+    if (self.logsErrors) NSLog(@"%@", errorMessage);
+    return [NSError errorWithDomain:@"FMDatabase" code:0 userInfo:@{NSLocalizedDescriptionKey : errorMessage}];
+#endif
+}
+
+@end

+ 295 - 0
Pods/FMDB/src/fmdb/FMDatabaseQueue.h

@@ -0,0 +1,295 @@
+//
+//  FMDatabaseQueue.h
+//  fmdb
+//
+//  Created by August Mueller on 6/22/11.
+//  Copyright 2011 Flying Meat Inc. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import "FMDatabase.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+/** To perform queries and updates on multiple threads, you'll want to use @c FMDatabaseQueue .
+
+ Using a single instance of @c FMDatabase from multiple threads at once is a bad idea.  It has always been OK to make a @c FMDatabase  object *per thread*.  Just don't share a single instance across threads, and definitely not across multiple threads at the same time.
+
+ Instead, use @c FMDatabaseQueue . Here's how to use it:
+
+ First, make your queue.
+
+@code
+FMDatabaseQueue *queue = [FMDatabaseQueue databaseQueueWithPath:aPath];
+@endcode
+
+ Then use it like so:
+
+@code
+[queue inDatabase:^(FMDatabase *db) {
+    [db executeUpdate:@"INSERT INTO myTable VALUES (?)", [NSNumber numberWithInt:1]];
+    [db executeUpdate:@"INSERT INTO myTable VALUES (?)", [NSNumber numberWithInt:2]];
+    [db executeUpdate:@"INSERT INTO myTable VALUES (?)", [NSNumber numberWithInt:3]];
+
+    FMResultSet *rs = [db executeQuery:@"select * from foo"];
+    while ([rs next]) {
+        //…
+    }
+}];
+@endcode
+
+ An easy way to wrap things up in a transaction can be done like this:
+
+@code
+[queue inTransaction:^(FMDatabase *db, BOOL *rollback) {
+    [db executeUpdate:@"INSERT INTO myTable VALUES (?)", [NSNumber numberWithInt:1]];
+    [db executeUpdate:@"INSERT INTO myTable VALUES (?)", [NSNumber numberWithInt:2]];
+    [db executeUpdate:@"INSERT INTO myTable VALUES (?)", [NSNumber numberWithInt:3]];
+
+    // if (whoopsSomethingWrongHappened) {
+    //     *rollback = YES;
+    //     return;
+    // }
+
+    // etc…
+    [db executeUpdate:@"INSERT INTO myTable VALUES (?)", [NSNumber numberWithInt:4]];
+}];
+@endcode
+
+ @c FMDatabaseQueue will run the blocks on a serialized queue (hence the name of the class).  So if you call @c FMDatabaseQueue 's methods from multiple threads at the same time, they will be executed in the order they are received.  This way queries and updates won't step on each other's toes, and every one is happy.
+
+ @warning Do not instantiate a single @c FMDatabase  object and use it across multiple threads. Use @c FMDatabaseQueue  instead.
+ 
+ @warning The calls to @c FMDatabaseQueue 's methods are blocking.  So even though you are passing along blocks, they will **not** be run on another thread.
+
+ @sa FMDatabase
+
+ */
+
+@interface FMDatabaseQueue : NSObject
+
+/** Path of database */
+
+@property (atomic, retain, nullable) NSString *path;
+
+/** Open flags */
+
+@property (atomic, readonly) int openFlags;
+
+/**  Custom virtual file system name */
+
+@property (atomic, copy, nullable) NSString *vfsName;
+
+///----------------------------------------------------
+/// @name Initialization, opening, and closing of queue
+///----------------------------------------------------
+
+/** Create queue using path.
+ 
+ @param aPath The file path of the database.
+ 
+ @return The @c FMDatabaseQueue  object. @c nil  on error.
+ */
+
++ (nullable instancetype)databaseQueueWithPath:(NSString * _Nullable)aPath;
+
+/** Create queue using file URL.
+ 
+ @param url The file @c NSURL  of the database.
+ 
+ @return The @c FMDatabaseQueue  object. @c nil  on error.
+ */
+
++ (nullable instancetype)databaseQueueWithURL:(NSURL * _Nullable)url;
+
+/** Create queue using path and specified flags.
+ 
+ @param aPath The file path of the database.
+ @param openFlags Flags passed to the openWithFlags method of the database.
+ 
+ @return The @c FMDatabaseQueue  object. @c nil  on error.
+ */
++ (nullable instancetype)databaseQueueWithPath:(NSString * _Nullable)aPath flags:(int)openFlags;
+
+/** Create queue using file URL and specified flags.
+ 
+ @param url The file @c NSURL  of the database.
+ @param openFlags Flags passed to the openWithFlags method of the database.
+ 
+ @return The @c FMDatabaseQueue  object. @c nil  on error.
+ */
++ (nullable instancetype)databaseQueueWithURL:(NSURL * _Nullable)url flags:(int)openFlags;
+
+/** Create queue using path.
+ 
+ @param aPath The file path of the database.
+ 
+ @return The @c FMDatabaseQueue  object. @c nil  on error.
+ */
+
+- (nullable instancetype)initWithPath:(NSString * _Nullable)aPath;
+
+/** Create queue using file URL.
+ 
+ @param url The file `NSURL of the database.
+ 
+ @return The @c FMDatabaseQueue  object. @c nil  on error.
+ */
+
+- (nullable instancetype)initWithURL:(NSURL * _Nullable)url;
+
+/** Create queue using path and specified flags.
+ 
+ @param aPath The file path of the database.
+ @param openFlags Flags passed to the openWithFlags method of the database.
+ 
+ @return The @c FMDatabaseQueue  object. @c nil  on error.
+ */
+
+- (nullable instancetype)initWithPath:(NSString * _Nullable)aPath flags:(int)openFlags;
+
+/** Create queue using file URL and specified flags.
+ 
+ @param url The file path of the database.
+ @param openFlags Flags passed to the openWithFlags method of the database.
+ 
+ @return The @c FMDatabaseQueue  object. @c nil  on error.
+ */
+
+- (nullable instancetype)initWithURL:(NSURL * _Nullable)url flags:(int)openFlags;
+
+/** Create queue using path and specified flags.
+ 
+ @param aPath The file path of the database.
+ @param openFlags Flags passed to the openWithFlags method of the database
+ @param vfsName The name of a custom virtual file system
+ 
+ @return The @c FMDatabaseQueue  object. @c nil  on error.
+ */
+
+- (nullable instancetype)initWithPath:(NSString * _Nullable)aPath flags:(int)openFlags vfs:(NSString * _Nullable)vfsName;
+
+/** Create queue using file URL and specified flags.
+ 
+ @param url The file `NSURL of the database.
+ @param openFlags Flags passed to the openWithFlags method of the database
+ @param vfsName The name of a custom virtual file system
+ 
+ @return The @c FMDatabaseQueue  object. @c nil  on error.
+ */
+
+- (nullable instancetype)initWithURL:(NSURL * _Nullable)url flags:(int)openFlags vfs:(NSString * _Nullable)vfsName;
+
+/** Returns the Class of 'FMDatabase' subclass, that will be used to instantiate database object.
+ 
+ Subclasses can override this method to return specified Class of 'FMDatabase' subclass.
+ 
+ @return The Class of 'FMDatabase' subclass, that will be used to instantiate database object.
+ */
+
++ (Class)databaseClass;
+
+/** Close database used by queue. */
+
+- (void)close;
+
+/** Interupt pending database operation. */
+
+- (void)interrupt;
+
+///-----------------------------------------------
+/// @name Dispatching database operations to queue
+///-----------------------------------------------
+
+/** Synchronously perform database operations on queue.
+ 
+ @param block The code to be run on the queue of @c FMDatabaseQueue 
+ */
+
+- (void)inDatabase:(__attribute__((noescape)) void (^)(FMDatabase *db))block;
+
+/** Synchronously perform database operations on queue, using transactions.
+
+ @param block The code to be run on the queue of @c FMDatabaseQueue 
+ 
+ @warning    Unlike SQLite's `BEGIN TRANSACTION`, this method currently performs
+             an exclusive transaction, not a deferred transaction. This behavior
+             is likely to change in future versions of FMDB, whereby this method
+             will likely eventually adopt standard SQLite behavior and perform
+             deferred transactions. If you really need exclusive tranaction, it is
+             recommended that you use `inExclusiveTransaction`, instead, not only
+             to make your intent explicit, but also to future-proof your code.
+
+ */
+
+- (void)inTransaction:(__attribute__((noescape)) void (^)(FMDatabase *db, BOOL *rollback))block;
+
+/** Synchronously perform database operations on queue, using deferred transactions.
+ 
+ @param block The code to be run on the queue of @c FMDatabaseQueue 
+ */
+
+- (void)inDeferredTransaction:(__attribute__((noescape)) void (^)(FMDatabase *db, BOOL *rollback))block;
+
+/** Synchronously perform database operations on queue, using exclusive transactions.
+ 
+ @param block The code to be run on the queue of @c FMDatabaseQueue 
+ */
+
+- (void)inExclusiveTransaction:(__attribute__((noescape)) void (^)(FMDatabase *db, BOOL *rollback))block;
+
+/** Synchronously perform database operations on queue, using immediate transactions.
+
+ @param block The code to be run on the queue of @c FMDatabaseQueue 
+ */
+
+- (void)inImmediateTransaction:(__attribute__((noescape)) void (^)(FMDatabase *db, BOOL *rollback))block;
+
+///-----------------------------------------------
+/// @name Dispatching database operations to queue
+///-----------------------------------------------
+
+/** Synchronously perform database operations using save point.
+
+ @param block The code to be run on the queue of @c FMDatabaseQueue 
+ */
+
+// NOTE: you can not nest these, since calling it will pull another database out of the pool and you'll get a deadlock.
+// If you need to nest, use FMDatabase's startSavePointWithName:error: instead.
+- (NSError * _Nullable)inSavePoint:(__attribute__((noescape)) void (^)(FMDatabase *db, BOOL *rollback))block;
+
+///-----------------
+/// @name Checkpoint
+///-----------------
+
+/** Performs a WAL checkpoint
+ 
+ @param checkpointMode The checkpoint mode for sqlite3_wal_checkpoint_v2
+ @param error The NSError corresponding to the error, if any.
+ @return YES on success, otherwise NO.
+ */
+- (BOOL)checkpoint:(FMDBCheckpointMode)checkpointMode error:(NSError * _Nullable *)error;
+
+/** Performs a WAL checkpoint
+ 
+ @param checkpointMode The checkpoint mode for sqlite3_wal_checkpoint_v2
+ @param name The db name for sqlite3_wal_checkpoint_v2
+ @param error The NSError corresponding to the error, if any.
+ @return YES on success, otherwise NO.
+ */
+- (BOOL)checkpoint:(FMDBCheckpointMode)checkpointMode name:(NSString * _Nullable)name error:(NSError * _Nullable *)error;
+
+/** Performs a WAL checkpoint
+ 
+ @param checkpointMode The checkpoint mode for sqlite3_wal_checkpoint_v2
+ @param name The db name for sqlite3_wal_checkpoint_v2
+ @param error The NSError corresponding to the error, if any.
+ @param logFrameCount If not NULL, then this is set to the total number of frames in the log file or to -1 if the checkpoint could not run because of an error or because the database is not in WAL mode.
+ @param checkpointCount If not NULL, then this is set to the total number of checkpointed frames in the log file (including any that were already checkpointed before the function was called) or to -1 if the checkpoint could not run due to an error or because the database is not in WAL mode.
+ @return YES on success, otherwise NO.
+ */
+- (BOOL)checkpoint:(FMDBCheckpointMode)checkpointMode name:(NSString * _Nullable)name logFrameCount:(int * _Nullable)logFrameCount checkpointCount:(int * _Nullable)checkpointCount error:(NSError * _Nullable *)error;
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 314 - 0
Pods/FMDB/src/fmdb/FMDatabaseQueue.m

@@ -0,0 +1,314 @@
+//
+//  FMDatabaseQueue.m
+//  fmdb
+//
+//  Created by August Mueller on 6/22/11.
+//  Copyright 2011 Flying Meat Inc. All rights reserved.
+//
+
+#import "FMDatabaseQueue.h"
+#import "FMDatabase.h"
+
+#if FMDB_SQLITE_STANDALONE
+#import <sqlite3/sqlite3.h>
+#else
+#import <sqlite3.h>
+#endif
+
+typedef NS_ENUM(NSInteger, FMDBTransaction) {
+    FMDBTransactionExclusive,
+    FMDBTransactionDeferred,
+    FMDBTransactionImmediate,
+};
+
+/*
+ 
+ Note: we call [self retain]; before using dispatch_sync, just incase 
+ FMDatabaseQueue is released on another thread and we're in the middle of doing
+ something in dispatch_sync
+ 
+ */
+
+/*
+ * A key used to associate the FMDatabaseQueue object with the dispatch_queue_t it uses.
+ * This in turn is used for deadlock detection by seeing if inDatabase: is called on
+ * the queue's dispatch queue, which should not happen and causes a deadlock.
+ */
+static const void * const kDispatchQueueSpecificKey = &kDispatchQueueSpecificKey;
+
+@interface FMDatabaseQueue () {
+    dispatch_queue_t    _queue;
+    FMDatabase          *_db;
+}
+@end
+
+@implementation FMDatabaseQueue
+
++ (instancetype)databaseQueueWithPath:(NSString *)aPath {
+    FMDatabaseQueue *q = [[self alloc] initWithPath:aPath];
+    
+    FMDBAutorelease(q);
+    
+    return q;
+}
+
++ (instancetype)databaseQueueWithURL:(NSURL *)url {
+    return [self databaseQueueWithPath:url.path];
+}
+
++ (instancetype)databaseQueueWithPath:(NSString *)aPath flags:(int)openFlags {
+    FMDatabaseQueue *q = [[self alloc] initWithPath:aPath flags:openFlags];
+    
+    FMDBAutorelease(q);
+    
+    return q;
+}
+
++ (instancetype)databaseQueueWithURL:(NSURL *)url flags:(int)openFlags {
+    return [self databaseQueueWithPath:url.path flags:openFlags];
+}
+
++ (Class)databaseClass {
+    return [FMDatabase class];
+}
+
+- (instancetype)initWithURL:(NSURL *)url flags:(int)openFlags vfs:(NSString *)vfsName {
+    return [self initWithPath:url.path flags:openFlags vfs:vfsName];
+}
+
+- (instancetype)initWithPath:(NSString*)aPath flags:(int)openFlags vfs:(NSString *)vfsName {
+    self = [super init];
+    
+    if (self != nil) {
+        
+        _db = [[[self class] databaseClass] databaseWithPath:aPath];
+        FMDBRetain(_db);
+        
+#if SQLITE_VERSION_NUMBER >= 3005000
+        BOOL success = [_db openWithFlags:openFlags vfs:vfsName];
+#else
+        BOOL success = [_db open];
+#endif
+        if (!success) {
+            NSLog(@"Could not create database queue for path %@", aPath);
+            FMDBRelease(self);
+            return 0x00;
+        }
+        
+        _path = FMDBReturnRetained(aPath);
+        
+        _queue = dispatch_queue_create([[NSString stringWithFormat:@"fmdb.%@", self] UTF8String], NULL);
+        dispatch_queue_set_specific(_queue, kDispatchQueueSpecificKey, (__bridge void *)self, NULL);
+        _openFlags = openFlags;
+        _vfsName = [vfsName copy];
+    }
+    
+    return self;
+}
+
+- (instancetype)initWithPath:(NSString *)aPath flags:(int)openFlags {
+    return [self initWithPath:aPath flags:openFlags vfs:nil];
+}
+
+- (instancetype)initWithURL:(NSURL *)url flags:(int)openFlags {
+    return [self initWithPath:url.path flags:openFlags vfs:nil];
+}
+
+- (instancetype)initWithURL:(NSURL *)url {
+    return [self initWithPath:url.path];
+}
+
+- (instancetype)initWithPath:(NSString *)aPath {
+    // default flags for sqlite3_open
+    return [self initWithPath:aPath flags:SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE vfs:nil];
+}
+
+- (instancetype)init {
+    return [self initWithPath:nil];
+}
+
+- (void)dealloc {
+    FMDBRelease(_db);
+    FMDBRelease(_path);
+    FMDBRelease(_vfsName);
+    
+    if (_queue) {
+        FMDBDispatchQueueRelease(_queue);
+        _queue = 0x00;
+    }
+#if ! __has_feature(objc_arc)
+    [super dealloc];
+#endif
+}
+
+- (void)close {
+    FMDBRetain(self);
+    dispatch_sync(_queue, ^() {
+        [self->_db close];
+        FMDBRelease(_db);
+        self->_db = 0x00;
+    });
+    FMDBRelease(self);
+}
+
+- (void)interrupt {
+    [[self database] interrupt];
+}
+
+- (FMDatabase*)database {
+    if (![_db isOpen]) {
+        if (!_db) {
+           _db = FMDBReturnRetained([[[self class] databaseClass] databaseWithPath:_path]);
+        }
+        
+#if SQLITE_VERSION_NUMBER >= 3005000
+        BOOL success = [_db openWithFlags:_openFlags vfs:_vfsName];
+#else
+        BOOL success = [_db open];
+#endif
+        if (!success) {
+            NSLog(@"FMDatabaseQueue could not reopen database for path %@", _path);
+            FMDBRelease(_db);
+            _db  = 0x00;
+            return 0x00;
+        }
+    }
+    
+    return _db;
+}
+
+- (void)inDatabase:(__attribute__((noescape)) void (^)(FMDatabase *db))block {
+#ifndef NDEBUG
+    /* Get the currently executing queue (which should probably be nil, but in theory could be another DB queue
+     * and then check it against self to make sure we're not about to deadlock. */
+    FMDatabaseQueue *currentSyncQueue = (__bridge id)dispatch_get_specific(kDispatchQueueSpecificKey);
+    assert(currentSyncQueue != self && "inDatabase: was called reentrantly on the same queue, which would lead to a deadlock");
+#endif
+    
+    FMDBRetain(self);
+    
+    dispatch_sync(_queue, ^() {
+        
+        FMDatabase *db = [self database];
+        
+        block(db);
+        
+        if ([db hasOpenResultSets]) {
+            NSLog(@"Warning: there is at least one open result set around after performing [FMDatabaseQueue inDatabase:]");
+            
+#if defined(DEBUG) && DEBUG
+            NSSet *openSetCopy = FMDBReturnAutoreleased([[db valueForKey:@"_openResultSets"] copy]);
+            for (NSValue *rsInWrappedInATastyValueMeal in openSetCopy) {
+                FMResultSet *rs = (FMResultSet *)[rsInWrappedInATastyValueMeal pointerValue];
+                NSLog(@"query: '%@'", [rs query]);
+            }
+#endif
+        }
+    });
+    
+    FMDBRelease(self);
+}
+
+- (void)beginTransaction:(FMDBTransaction)transaction withBlock:(void (^)(FMDatabase *db, BOOL *rollback))block {
+    FMDBRetain(self);
+    dispatch_sync(_queue, ^() { 
+        
+        BOOL shouldRollback = NO;
+
+        switch (transaction) {
+            case FMDBTransactionExclusive:
+                [[self database] beginTransaction];
+                break;
+            case FMDBTransactionDeferred:
+                [[self database] beginDeferredTransaction];
+                break;
+            case FMDBTransactionImmediate:
+                [[self database] beginImmediateTransaction];
+                break;
+        }
+        
+        block([self database], &shouldRollback);
+        
+        if (shouldRollback) {
+            [[self database] rollback];
+        }
+        else {
+            [[self database] commit];
+        }
+    });
+    
+    FMDBRelease(self);
+}
+
+- (void)inTransaction:(__attribute__((noescape)) void (^)(FMDatabase *db, BOOL *rollback))block {
+    [self beginTransaction:FMDBTransactionExclusive withBlock:block];
+}
+
+- (void)inDeferredTransaction:(__attribute__((noescape)) void (^)(FMDatabase *db, BOOL *rollback))block {
+    [self beginTransaction:FMDBTransactionDeferred withBlock:block];
+}
+
+- (void)inExclusiveTransaction:(__attribute__((noescape)) void (^)(FMDatabase *db, BOOL *rollback))block {
+    [self beginTransaction:FMDBTransactionExclusive withBlock:block];
+}
+
+- (void)inImmediateTransaction:(__attribute__((noescape)) void (^)(FMDatabase * _Nonnull, BOOL * _Nonnull))block {
+    [self beginTransaction:FMDBTransactionImmediate withBlock:block];
+}
+
+- (NSError*)inSavePoint:(__attribute__((noescape)) void (^)(FMDatabase *db, BOOL *rollback))block {
+#if SQLITE_VERSION_NUMBER >= 3007000
+    static unsigned long savePointIdx = 0;
+    __block NSError *err = 0x00;
+    FMDBRetain(self);
+    dispatch_sync(_queue, ^() { 
+        
+        NSString *name = [NSString stringWithFormat:@"savePoint%ld", savePointIdx++];
+        
+        BOOL shouldRollback = NO;
+        
+        if ([[self database] startSavePointWithName:name error:&err]) {
+            
+            block([self database], &shouldRollback);
+            
+            if (shouldRollback) {
+                // We need to rollback and release this savepoint to remove it
+                [[self database] rollbackToSavePointWithName:name error:&err];
+            }
+            [[self database] releaseSavePointWithName:name error:&err];
+            
+        }
+    });
+    FMDBRelease(self);
+    return err;
+#else
+    NSString *errorMessage = NSLocalizedStringFromTable(@"Save point functions require SQLite 3.7", @"FMDB", nil);
+    if (_db.logsErrors) NSLog(@"%@", errorMessage);
+    return [NSError errorWithDomain:@"FMDatabase" code:0 userInfo:@{NSLocalizedDescriptionKey : errorMessage}];
+#endif
+}
+
+- (BOOL)checkpoint:(FMDBCheckpointMode)mode error:(NSError * __autoreleasing *)error
+{
+    return [self checkpoint:mode name:nil logFrameCount:NULL checkpointCount:NULL error:error];
+}
+
+- (BOOL)checkpoint:(FMDBCheckpointMode)mode name:(NSString *)name error:(NSError * __autoreleasing *)error
+{
+    return [self checkpoint:mode name:name logFrameCount:NULL checkpointCount:NULL error:error];
+}
+
+- (BOOL)checkpoint:(FMDBCheckpointMode)mode name:(NSString *)name logFrameCount:(int * _Nullable)logFrameCount checkpointCount:(int * _Nullable)checkpointCount error:(NSError * __autoreleasing _Nullable * _Nullable)error
+{
+    __block BOOL result;
+
+    FMDBRetain(self);
+    dispatch_sync(_queue, ^() {
+        result = [self.database checkpoint:mode name:name logFrameCount:logFrameCount checkpointCount:checkpointCount error:error];
+    });
+    FMDBRelease(self);
+    
+    return result;
+}
+
+@end

Някои файлове не бяха показани, защото твърде много файлове са промени