浏览代码

1.修改分享

wenweiwei 3 年之前
父节点
当前提交
7a8210667a
共有 100 个文件被更改,包括 5 次插入21364 次删除
  1. 1 1
      BFFramework/Classes/Utils/PQBFConfig.swift
  2. 4 4
      Example/BFFramework.xcodeproj/project.pbxproj
  3. 0 19
      Example/Pods/Alamofire/LICENSE
  4. 0 234
      Example/Pods/Alamofire/README.md
  5. 0 460
      Example/Pods/Alamofire/Source/AFError.swift
  6. 0 465
      Example/Pods/Alamofire/Source/Alamofire.swift
  7. 0 37
      Example/Pods/Alamofire/Source/DispatchQueue+Alamofire.swift
  8. 0 580
      Example/Pods/Alamofire/Source/MultipartFormData.swift
  9. 0 238
      Example/Pods/Alamofire/Source/NetworkReachabilityManager.swift
  10. 0 55
      Example/Pods/Alamofire/Source/Notifications.swift
  11. 0 483
      Example/Pods/Alamofire/Source/ParameterEncoding.swift
  12. 0 660
      Example/Pods/Alamofire/Source/Request.swift
  13. 0 574
      Example/Pods/Alamofire/Source/Response.swift
  14. 0 715
      Example/Pods/Alamofire/Source/ResponseSerialization.swift
  15. 0 300
      Example/Pods/Alamofire/Source/Result.swift
  16. 0 310
      Example/Pods/Alamofire/Source/ServerTrustPolicy.swift
  17. 0 725
      Example/Pods/Alamofire/Source/SessionDelegate.swift
  18. 0 899
      Example/Pods/Alamofire/Source/SessionManager.swift
  19. 0 466
      Example/Pods/Alamofire/Source/TaskDelegate.swift
  20. 0 136
      Example/Pods/Alamofire/Source/Timeline.swift
  21. 0 321
      Example/Pods/Alamofire/Source/Validation.swift
  22. 0 19
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/NSDate+OSS.h
  23. 0 49
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/NSDate+OSS.m
  24. 0 15
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/NSMutableData+OSS_CRC.h
  25. 0 19
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/NSMutableData+OSS_CRC.m
  26. 0 15
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/NSMutableDictionary+OSS.h
  27. 0 19
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/NSMutableDictionary+OSS.m
  28. 0 33
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSAllRequestNeededMessage.h
  29. 0 72
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSAllRequestNeededMessage.m
  30. 0 445
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSClient.h
  31. 0 2067
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSClient.m
  32. 0 85
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSCompat.h
  33. 0 260
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSCompat.m
  34. 0 129
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSConstants.h
  35. 0 21
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSConstants.m
  36. 0 84
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSDefine.h
  37. 0 31
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSDeleteMultipleObjectsRequest.h
  38. 0 22
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSDeleteMultipleObjectsRequest.m
  39. 0 17
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSDeleteMultipleObjectsResult.h
  40. 0 13
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSDeleteMultipleObjectsResult.m
  41. 0 75
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSFileLog/OSSCocoaLumberjack.h
  42. 0 860
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSFileLog/OSSDDLog.h
  43. 0 1247
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSFileLog/OSSDDLog.m
  44. 0 509
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSFileLog/OSSFileLogger.h
  45. 0 1460
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSFileLog/OSSFileLogger.m
  46. 0 82
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSFileLog/OSSLogMacros.h
  47. 0 14
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSFileLog/OSSNSLogger.h
  48. 0 32
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSFileLog/OSSNSLogger.m
  49. 0 64
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSFileLog/OSSReachability.h
  50. 0 248
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSFileLog/OSSReachability.m
  51. 0 15
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSGetBucketInfoRequest.h
  52. 0 17
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSGetBucketInfoRequest.m
  53. 0 57
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSGetBucketInfoResult.h
  54. 0 23
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSGetBucketInfoResult.m
  55. 0 26
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSGetObjectACLRequest.h
  56. 0 13
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSGetObjectACLRequest.m
  57. 0 19
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSGetObjectACLResult.h
  58. 0 13
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSGetObjectACLResult.m
  59. 0 17
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSGetSymlinkRequest.h
  60. 0 17
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSGetSymlinkRequest.m
  61. 0 13
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSGetSymlinkResult.h
  62. 0 13
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSGetSymlinkResult.m
  63. 0 39
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSHttpResponseParser.h
  64. 0 655
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSHttpResponseParser.m
  65. 0 16
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSHttpdns.h
  66. 0 147
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSHttpdns.m
  67. 0 114
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSIPv6/OSSIPv6Adapter.h
  68. 0 197
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSIPv6/OSSIPv6Adapter.m
  69. 0 23
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSIPv6/OSSIPv6PrefixResolver.h
  70. 0 205
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSIPv6/OSSIPv6PrefixResolver.m
  71. 0 15
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSIPv6/OSSReachabilityManager.h
  72. 0 97
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSIPv6/OSSReachabilityManager.m
  73. 0 22
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSInputStreamHelper.h
  74. 0 80
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSInputStreamHelper.m
  75. 0 54
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSLog.h
  76. 0 31
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSLog.m
  77. 0 1498
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSModel.h
  78. 0 856
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSModel.m
  79. 0 45
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSNetworking.h
  80. 0 526
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSNetworking.m
  81. 0 76
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSNetworkingRequestDelegate.h
  82. 0 169
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSNetworkingRequestDelegate.m
  83. 0 25
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSPutSymlinkRequest.h
  84. 0 17
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSPutSymlinkRequest.m
  85. 0 13
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSPutSymlinkResult.h
  86. 0 13
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSPutSymlinkResult.m
  87. 0 41
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSRequest.h
  88. 0 41
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSRequest.m
  89. 0 17
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSRestoreObjectRequest.h
  90. 0 17
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSRestoreObjectRequest.m
  91. 0 13
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSRestoreObjectResult.h
  92. 0 13
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSRestoreObjectResult.m
  93. 0 42
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSResult.h
  94. 0 18
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSResult.m
  95. 0 40
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSService.h
  96. 0 26
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSTask/OSSBolts.h
  97. 0 17
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSTask/OSSBolts.m
  98. 0 42
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSTask/OSSCancellationToken.h
  99. 0 144
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSTask/OSSCancellationToken.m
  100. 0 29
      Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSTask/OSSCancellationTokenRegistration.h

+ 1 - 1
BFFramework/Classes/Utils/PQBFConfig.swift

@@ -3,7 +3,7 @@
 //  BFFramework
 //
 //  Created by SanW on 2021/6/4.
-//
+//  111
 
 import UIKit
 

+ 4 - 4
Example/BFFramework.xcodeproj/project.pbxproj

@@ -144,8 +144,8 @@
 				607FACCC1AFB9204008FA782 /* Sources */,
 				607FACCD1AFB9204008FA782 /* Frameworks */,
 				607FACCE1AFB9204008FA782 /* Resources */,
-				9F3A3F4FAFB7ECE85C8992D1 /* [CP] Embed Pods Frameworks */,
-				1DB36BDEEA2A85B996B807D0 /* [CP] Copy Pods Resources */,
+				68636FD305DCBD3BD3EF31A1 /* [CP] Embed Pods Frameworks */,
+				23CB217A6D12671E8F083CFA /* [CP] Copy Pods Resources */,
 			);
 			buildRules = (
 			);
@@ -226,7 +226,7 @@
 			shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n    # print error to STDERR\n    echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n    exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
 			showEnvVarsInLog = 0;
 		};
-		1DB36BDEEA2A85B996B807D0 /* [CP] Copy Pods Resources */ = {
+		23CB217A6D12671E8F083CFA /* [CP] Copy Pods Resources */ = {
 			isa = PBXShellScriptBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
@@ -244,7 +244,7 @@
 			shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-BFFramework_Example/Pods-BFFramework_Example-resources.sh\"\n";
 			showEnvVarsInLog = 0;
 		};
-		9F3A3F4FAFB7ECE85C8992D1 /* [CP] Embed Pods Frameworks */ = {
+		68636FD305DCBD3BD3EF31A1 /* [CP] Embed Pods Frameworks */ = {
 			isa = PBXShellScriptBuildPhase;
 			buildActionMask = 2147483647;
 			files = (

+ 0 - 19
Example/Pods/Alamofire/LICENSE

@@ -1,19 +0,0 @@
-Copyright (c) 2014 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.

+ 0 - 234
Example/Pods/Alamofire/README.md

@@ -1,234 +0,0 @@
-![Alamofire: Elegant Networking in Swift](https://raw.githubusercontent.com/Alamofire/Alamofire/master/alamofire.png)
-
-[![Build Status](https://travis-ci.org/Alamofire/Alamofire.svg?branch=master)](https://travis-ci.org/Alamofire/Alamofire)
-[![CocoaPods Compatible](https://img.shields.io/cocoapods/v/Alamofire.svg)](https://img.shields.io/cocoapods/v/Alamofire.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/Alamofire.svg?style=flat)](https://alamofire.github.io/Alamofire)
-[![Twitter](https://img.shields.io/badge/twitter-@AlamofireSF-blue.svg?style=flat)](https://twitter.com/AlamofireSF)
-[![Gitter](https://badges.gitter.im/Alamofire/Alamofire.svg)](https://gitter.im/Alamofire/Alamofire?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
-
-Alamofire is an HTTP networking library written in Swift.
-
-- [Features](#features)
-- [Component Libraries](#component-libraries)
-- [Requirements](#requirements)
-- [Migration Guides](#migration-guides)
-- [Communication](#communication)
-- [Installation](#installation)
-- [Usage](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md)
-    - **Intro -** [Making a Request](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#making-a-request), [Response Handling](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#response-handling), [Response Validation](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#response-validation), [Response Caching](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#response-caching)
-	- **HTTP -** [HTTP Methods](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#http-methods), [Parameter Encoding](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#parameter-encoding), [HTTP Headers](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#http-headers), [Authentication](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#authentication)
-	- **Large Data -** [Downloading Data to a File](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#downloading-data-to-a-file), [Uploading Data to a Server](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#uploading-data-to-a-server)
-	- **Tools -** [Statistical Metrics](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#statistical-metrics), [cURL Command Output](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#curl-command-output)
-- [Advanced Usage](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md)
-	- **URL Session -** [Session Manager](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#session-manager), [Session Delegate](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#session-delegate), [Request](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#request)
-	- **Routing -** [Routing Requests](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#routing-requests), [Adapting and Retrying Requests](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#adapting-and-retrying-requests)
-	- **Model Objects -** [Custom Response Serialization](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#custom-response-serialization)
-	- **Connection -** [Security](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#security), [Network Reachability](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#network-reachability)
-- [Open Radars](#open-radars)
-- [FAQ](#faq)
-- [Credits](#credits)
-- [Donations](#donations)
-- [License](#license)
-
-## Features
-
-- [x] Chainable Request / Response Methods
-- [x] URL / JSON / plist Parameter Encoding
-- [x] Upload File / Data / Stream / MultipartFormData
-- [x] Download File using Request or Resume Data
-- [x] Authentication with URLCredential
-- [x] HTTP Response Validation
-- [x] Upload and Download Progress Closures with Progress
-- [x] cURL Command Output
-- [x] Dynamically Adapt and Retry Requests
-- [x] TLS Certificate and Public Key Pinning
-- [x] Network Reachability
-- [x] Comprehensive Unit and Integration Test Coverage
-- [x] [Complete Documentation](https://alamofire.github.io/Alamofire)
-
-## Component Libraries
-
-In order to keep Alamofire focused specifically on core networking implementations, additional component libraries have been created by the [Alamofire Software Foundation](https://github.com/Alamofire/Foundation) to bring additional functionality to the Alamofire ecosystem.
-
-- [AlamofireImage](https://github.com/Alamofire/AlamofireImage) - An image library including image response serializers, `UIImage` and `UIImageView` extensions, custom image filters, an auto-purging in-memory cache and a priority-based image downloading system.
-- [AlamofireNetworkActivityIndicator](https://github.com/Alamofire/AlamofireNetworkActivityIndicator) - Controls the visibility of the network activity indicator on iOS using Alamofire. It contains configurable delay timers to help mitigate flicker and can support `URLSession` instances not managed by Alamofire.
-
-## Requirements
-
-- iOS 8.0+ / macOS 10.10+ / tvOS 9.0+ / watchOS 2.0+
-- Xcode 9.3+
-- Swift 4.0+
-
-## Migration Guides
-
-- [Alamofire 4.0 Migration Guide](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Alamofire%204.0%20Migration%20Guide.md)
-- [Alamofire 3.0 Migration Guide](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Alamofire%203.0%20Migration%20Guide.md)
-- [Alamofire 2.0 Migration Guide](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Alamofire%202.0%20Migration%20Guide.md)
-
-## Communication
-- If you **need help with making network requests**, use [Stack Overflow](https://stackoverflow.com/questions/tagged/alamofire) and tag `alamofire`.
-- If you need to **find or understand an API**, check [our documentation](http://alamofire.github.io/Alamofire/) or [Apple's documentation for `URLSession`](https://developer.apple.com/documentation/foundation/url_loading_system), on top of which Alamofire is built.
-- If you need **help with an Alamofire feature**, use [our forum on swift.org](https://forums.swift.org/c/related-projects/alamofire).
-- If you'd like to **discuss Alamofire best practices**, use [our forum on swift.org](https://forums.swift.org/c/related-projects/alamofire).
-- If you'd like to **discuss a feature request**, use [our forum on swift.org](https://forums.swift.org/c/related-projects/alamofire). 
-- If you **found a bug**, open an issue and follow the guide. The more detail the better!
-- If you **want to contribute**, submit a pull request.
-
-## Installation
-
-### CocoaPods
-
-[CocoaPods](https://cocoapods.org) is a dependency manager for Cocoa projects. You can install it with the following command:
-
-```bash
-$ gem install cocoapods
-```
-
-> CocoaPods 1.7+ is required to build Alamofire 4.9+.
-
-To integrate Alamofire into your Xcode project using CocoaPods, specify it in your `Podfile`:
-
-```ruby
-source 'https://github.com/CocoaPods/Specs.git'
-platform :ios, '10.0'
-use_frameworks!
-
-target '<Your Target Name>' do
-  pod 'Alamofire', '~> 4.9'
-end
-```
-
-Then, run the following command:
-
-```bash
-$ pod install
-```
-
-### Carthage
-
-[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.
-
-You can install Carthage with [Homebrew](https://brew.sh/) using the following command:
-
-```bash
-$ brew install carthage
-```
-
-To integrate Alamofire into your Xcode project using Carthage, specify it in your `Cartfile`:
-
-```ogdl
-github "Alamofire/Alamofire" ~> 4.9
-```
-
-Run `carthage update` to build the framework and drag the built `Alamofire.framework` into your Xcode project.
-
-### Swift Package Manager
-
-The [Swift Package Manager](https://swift.org/package-manager/) is a tool for automating the distribution of Swift code and is integrated into the `swift` compiler. It is in early development, but Alamofire does support its use on supported platforms. 
-
-Once you have your Swift package set up, adding Alamofire as a dependency is as easy as adding it to the `dependencies` value of your `Package.swift`.
-
-#### Swift 4
-
-```swift
-dependencies: [
-    .package(url: "https://github.com/Alamofire/Alamofire.git", from: "4.9")
-]
-```
-
-### Manually
-
-If you prefer not to use any of the aforementioned dependency managers, you can integrate Alamofire into your project manually.
-
-#### Embedded Framework
-
-- Open up Terminal, `cd` into your top-level project directory, and run the following command "if" your project is not initialized as a git repository:
-
-  ```bash
-  $ git init
-  ```
-
-- Add Alamofire as a git [submodule](https://git-scm.com/docs/git-submodule) by running the following command:
-
-  ```bash
-  $ git submodule add https://github.com/Alamofire/Alamofire.git
-  ```
-
-- Open the new `Alamofire` folder, and drag the `Alamofire.xcodeproj` into the Project Navigator of your application's Xcode project.
-
-    > It should appear nested underneath your application's blue project icon. Whether it is above or below all the other Xcode groups does not matter.
-
-- Select the `Alamofire.xcodeproj` in the Project Navigator and verify the deployment target matches that of your application target.
-- Next, select your application project in the Project Navigator (blue project icon) to navigate to the target configuration window and select the application target under the "Targets" heading in the sidebar.
-- In the tab bar at the top of that window, open the "General" panel.
-- Click on the `+` button under the "Embedded Binaries" section.
-- You will see two different `Alamofire.xcodeproj` folders each with two different versions of the `Alamofire.framework` nested inside a `Products` folder.
-
-    > It does not matter which `Products` folder you choose from, but it does matter whether you choose the top or bottom `Alamofire.framework`.
-
-- Select the top `Alamofire.framework` for iOS and the bottom one for OS X.
-
-    > You can verify which one you selected by inspecting the build log for your project. The build target for `Alamofire` will be listed as either `Alamofire iOS`, `Alamofire macOS`, `Alamofire tvOS` or `Alamofire watchOS`.
-
-- And that's it!
-
-  > The `Alamofire.framework` is automagically added as a target dependency, linked framework and embedded framework in a copy files build phase which is all you need to build on the simulator and a device.
-
-## Open Radars
-
-The following radars have some effect on the current implementation of Alamofire.
-
-- [`rdar://21349340`](http://www.openradar.me/radar?id=5517037090635776) - Compiler throwing warning due to toll-free bridging issue in test case
-- `rdar://26870455` - Background URL Session Configurations do not work in the simulator
-- `rdar://26849668` - Some URLProtocol APIs do not properly handle `URLRequest`
-- [`rdar://36082113`](http://openradar.appspot.com/radar?id=4942308441063424) - `URLSessionTaskMetrics` failing to link on watchOS 3.0+
-
-## Resolved Radars
-
-The following radars have been resolved over time after being filed against the Alamofire project.
-
-- [`rdar://26761490`](http://www.openradar.me/radar?id=5010235949318144) - Swift string interpolation causing memory leak with common usage (Resolved on 9/1/17 in Xcode 9 beta 6).
-
-## FAQ
-
-### What's the origin of the name Alamofire?
-
-Alamofire is named after the [Alamo Fire flower](https://aggie-horticulture.tamu.edu/wildseed/alamofire.html), a hybrid variant of the Bluebonnet, the official state flower of Texas.
-
-### What logic belongs in a Router vs. a Request Adapter?
-
-Simple, static data such as paths, parameters and common headers belong in the `Router`. Dynamic data such as an `Authorization` header whose value can changed based on an authentication system belongs in a `RequestAdapter`.
-
-The reason the dynamic data MUST be placed into the `RequestAdapter` is to support retry operations. When a `Request` is retried, the original request is not rebuilt meaning the `Router` will not be called again. The `RequestAdapter` is called again allowing the dynamic data to be updated on the original request before retrying the `Request`.
-
-## Credits
-
-Alamofire is owned and maintained by the [Alamofire Software Foundation](http://alamofire.org). You can follow them on Twitter at [@AlamofireSF](https://twitter.com/AlamofireSF) for project updates and releases.
-
-### Security Disclosure
-
-If you believe you have identified a security vulnerability with Alamofire, you should report it as soon as possible via email to security@alamofire.org. Please do not post it to a public issue tracker.
-
-## Donations
-
-The [ASF](https://github.com/Alamofire/Foundation#members) is looking to raise money to officially stay registered as a federal non-profit organization.
-Registering will allow us members to gain some legal protections and also allow us to put donations to use, tax free.
-Donating to the ASF will enable us to:
-
-- Pay our yearly legal fees to keep the non-profit in good status
-- Pay for our mail servers to help us stay on top of all questions and security issues
-- Potentially fund test servers to make it easier for us to test the edge cases
-- Potentially fund developers to work on one of our projects full-time
-
-The community adoption of the ASF libraries has been amazing.
-We are greatly humbled by your enthusiasm around the projects, and want to continue to do everything we can to move the needle forward.
-With your continued support, the ASF will be able to improve its reach and also provide better legal safety for the core members.
-If you use any of our libraries for work, see if your employers would be interested in donating.
-Any amount you can donate today to help us reach our goal would be greatly appreciated.
-
-[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=W34WPEE74APJQ)
-
-## License
-
-Alamofire is released under the MIT license. [See LICENSE](https://github.com/Alamofire/Alamofire/blob/master/LICENSE) for details.

+ 0 - 460
Example/Pods/Alamofire/Source/AFError.swift

@@ -1,460 +0,0 @@
-//
-//  AFError.swift
-//
-//  Copyright (c) 2014 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
-
-/// `AFError` is the error type returned by Alamofire. It encompasses a few different types of errors, each with
-/// their own associated reasons.
-///
-/// - invalidURL:                  Returned when a `URLConvertible` type fails to create a valid `URL`.
-/// - parameterEncodingFailed:     Returned when a parameter encoding object throws an error during the encoding process.
-/// - multipartEncodingFailed:     Returned when some step in the multipart encoding process fails.
-/// - responseValidationFailed:    Returned when a `validate()` call fails.
-/// - responseSerializationFailed: Returned when a response serializer encounters an error in the serialization process.
-public enum AFError: Error {
-    /// The underlying reason the parameter encoding error occurred.
-    ///
-    /// - missingURL:                 The URL request did not have a URL to encode.
-    /// - jsonEncodingFailed:         JSON serialization failed with an underlying system error during the
-    ///                               encoding process.
-    /// - propertyListEncodingFailed: Property list serialization failed with an underlying system error during
-    ///                               encoding process.
-    public enum ParameterEncodingFailureReason {
-        case missingURL
-        case jsonEncodingFailed(error: Error)
-        case propertyListEncodingFailed(error: Error)
-    }
-
-    /// The underlying reason the multipart encoding error occurred.
-    ///
-    /// - bodyPartURLInvalid:                   The `fileURL` provided for reading an encodable body part isn't a
-    ///                                         file URL.
-    /// - bodyPartFilenameInvalid:              The filename of the `fileURL` provided has either an empty
-    ///                                         `lastPathComponent` or `pathExtension.
-    /// - bodyPartFileNotReachable:             The file at the `fileURL` provided was not reachable.
-    /// - bodyPartFileNotReachableWithError:    Attempting to check the reachability of the `fileURL` provided threw
-    ///                                         an error.
-    /// - bodyPartFileIsDirectory:              The file at the `fileURL` provided is actually a directory.
-    /// - bodyPartFileSizeNotAvailable:         The size of the file at the `fileURL` provided was not returned by
-    ///                                         the system.
-    /// - bodyPartFileSizeQueryFailedWithError: The attempt to find the size of the file at the `fileURL` provided
-    ///                                         threw an error.
-    /// - bodyPartInputStreamCreationFailed:    An `InputStream` could not be created for the provided `fileURL`.
-    /// - outputStreamCreationFailed:           An `OutputStream` could not be created when attempting to write the
-    ///                                         encoded data to disk.
-    /// - outputStreamFileAlreadyExists:        The encoded body data could not be writtent disk because a file
-    ///                                         already exists at the provided `fileURL`.
-    /// - outputStreamURLInvalid:               The `fileURL` provided for writing the encoded body data to disk is
-    ///                                         not a file URL.
-    /// - outputStreamWriteFailed:              The attempt to write the encoded body data to disk failed with an
-    ///                                         underlying error.
-    /// - inputStreamReadFailed:                The attempt to read an encoded body part `InputStream` failed with
-    ///                                         underlying system error.
-    public enum MultipartEncodingFailureReason {
-        case bodyPartURLInvalid(url: URL)
-        case bodyPartFilenameInvalid(in: URL)
-        case bodyPartFileNotReachable(at: URL)
-        case bodyPartFileNotReachableWithError(atURL: URL, error: Error)
-        case bodyPartFileIsDirectory(at: URL)
-        case bodyPartFileSizeNotAvailable(at: URL)
-        case bodyPartFileSizeQueryFailedWithError(forURL: URL, error: Error)
-        case bodyPartInputStreamCreationFailed(for: URL)
-
-        case outputStreamCreationFailed(for: URL)
-        case outputStreamFileAlreadyExists(at: URL)
-        case outputStreamURLInvalid(url: URL)
-        case outputStreamWriteFailed(error: Error)
-
-        case inputStreamReadFailed(error: Error)
-    }
-
-    /// The underlying reason the response validation error occurred.
-    ///
-    /// - dataFileNil:             The data file containing the server response did not exist.
-    /// - dataFileReadFailed:      The data file containing the server response could not be read.
-    /// - missingContentType:      The response did not contain a `Content-Type` and the `acceptableContentTypes`
-    ///                            provided did not contain wildcard type.
-    /// - unacceptableContentType: The response `Content-Type` did not match any type in the provided
-    ///                            `acceptableContentTypes`.
-    /// - unacceptableStatusCode:  The response status code was not acceptable.
-    public enum ResponseValidationFailureReason {
-        case dataFileNil
-        case dataFileReadFailed(at: URL)
-        case missingContentType(acceptableContentTypes: [String])
-        case unacceptableContentType(acceptableContentTypes: [String], responseContentType: String)
-        case unacceptableStatusCode(code: Int)
-    }
-
-    /// The underlying reason the response serialization error occurred.
-    ///
-    /// - inputDataNil:                    The server response contained no data.
-    /// - inputDataNilOrZeroLength:        The server response contained no data or the data was zero length.
-    /// - inputFileNil:                    The file containing the server response did not exist.
-    /// - inputFileReadFailed:             The file containing the server response could not be read.
-    /// - stringSerializationFailed:       String serialization failed using the provided `String.Encoding`.
-    /// - jsonSerializationFailed:         JSON serialization failed with an underlying system error.
-    /// - propertyListSerializationFailed: Property list serialization failed with an underlying system error.
-    public enum ResponseSerializationFailureReason {
-        case inputDataNil
-        case inputDataNilOrZeroLength
-        case inputFileNil
-        case inputFileReadFailed(at: URL)
-        case stringSerializationFailed(encoding: String.Encoding)
-        case jsonSerializationFailed(error: Error)
-        case propertyListSerializationFailed(error: Error)
-    }
-
-    case invalidURL(url: URLConvertible)
-    case parameterEncodingFailed(reason: ParameterEncodingFailureReason)
-    case multipartEncodingFailed(reason: MultipartEncodingFailureReason)
-    case responseValidationFailed(reason: ResponseValidationFailureReason)
-    case responseSerializationFailed(reason: ResponseSerializationFailureReason)
-}
-
-// MARK: - Adapt Error
-
-struct AdaptError: Error {
-    let error: Error
-}
-
-extension Error {
-    var underlyingAdaptError: Error? { return (self as? AdaptError)?.error }
-}
-
-// MARK: - Error Booleans
-
-extension AFError {
-    /// Returns whether the AFError is an invalid URL error.
-    public var isInvalidURLError: Bool {
-        if case .invalidURL = self { return true }
-        return false
-    }
-
-    /// Returns whether the AFError is a parameter encoding error. When `true`, the `underlyingError` property will
-    /// contain the associated value.
-    public var isParameterEncodingError: Bool {
-        if case .parameterEncodingFailed = self { return true }
-        return false
-    }
-
-    /// Returns whether the AFError is a multipart encoding error. When `true`, the `url` and `underlyingError` properties
-    /// will contain the associated values.
-    public var isMultipartEncodingError: Bool {
-        if case .multipartEncodingFailed = self { return true }
-        return false
-    }
-
-    /// Returns whether the `AFError` is a response validation error. When `true`, the `acceptableContentTypes`,
-    /// `responseContentType`, and `responseCode` properties will contain the associated values.
-    public var isResponseValidationError: Bool {
-        if case .responseValidationFailed = self { return true }
-        return false
-    }
-
-    /// Returns whether the `AFError` is a response serialization error. When `true`, the `failedStringEncoding` and
-    /// `underlyingError` properties will contain the associated values.
-    public var isResponseSerializationError: Bool {
-        if case .responseSerializationFailed = self { return true }
-        return false
-    }
-}
-
-// MARK: - Convenience Properties
-
-extension AFError {
-    /// The `URLConvertible` associated with the error.
-    public var urlConvertible: URLConvertible? {
-        switch self {
-        case .invalidURL(let url):
-            return url
-        default:
-            return nil
-        }
-    }
-
-    /// The `URL` associated with the error.
-    public var url: URL? {
-        switch self {
-        case .multipartEncodingFailed(let reason):
-            return reason.url
-        default:
-            return nil
-        }
-    }
-
-    /// The `Error` returned by a system framework associated with a `.parameterEncodingFailed`,
-    /// `.multipartEncodingFailed` or `.responseSerializationFailed` error.
-    public var underlyingError: Error? {
-        switch self {
-        case .parameterEncodingFailed(let reason):
-            return reason.underlyingError
-        case .multipartEncodingFailed(let reason):
-            return reason.underlyingError
-        case .responseSerializationFailed(let reason):
-            return reason.underlyingError
-        default:
-            return nil
-        }
-    }
-
-    /// The acceptable `Content-Type`s of a `.responseValidationFailed` error.
-    public var acceptableContentTypes: [String]? {
-        switch self {
-        case .responseValidationFailed(let reason):
-            return reason.acceptableContentTypes
-        default:
-            return nil
-        }
-    }
-
-    /// The response `Content-Type` of a `.responseValidationFailed` error.
-    public var responseContentType: String? {
-        switch self {
-        case .responseValidationFailed(let reason):
-            return reason.responseContentType
-        default:
-            return nil
-        }
-    }
-
-    /// The response code of a `.responseValidationFailed` error.
-    public var responseCode: Int? {
-        switch self {
-        case .responseValidationFailed(let reason):
-            return reason.responseCode
-        default:
-            return nil
-        }
-    }
-
-    /// The `String.Encoding` associated with a failed `.stringResponse()` call.
-    public var failedStringEncoding: String.Encoding? {
-        switch self {
-        case .responseSerializationFailed(let reason):
-            return reason.failedStringEncoding
-        default:
-            return nil
-        }
-    }
-}
-
-extension AFError.ParameterEncodingFailureReason {
-    var underlyingError: Error? {
-        switch self {
-        case .jsonEncodingFailed(let error), .propertyListEncodingFailed(let error):
-            return error
-        default:
-            return nil
-        }
-    }
-}
-
-extension AFError.MultipartEncodingFailureReason {
-    var url: URL? {
-        switch self {
-        case .bodyPartURLInvalid(let url), .bodyPartFilenameInvalid(let url), .bodyPartFileNotReachable(let url),
-             .bodyPartFileIsDirectory(let url), .bodyPartFileSizeNotAvailable(let url),
-             .bodyPartInputStreamCreationFailed(let url), .outputStreamCreationFailed(let url),
-             .outputStreamFileAlreadyExists(let url), .outputStreamURLInvalid(let url),
-             .bodyPartFileNotReachableWithError(let url, _), .bodyPartFileSizeQueryFailedWithError(let url, _):
-            return url
-        default:
-            return nil
-        }
-    }
-
-    var underlyingError: Error? {
-        switch self {
-        case .bodyPartFileNotReachableWithError(_, let error), .bodyPartFileSizeQueryFailedWithError(_, let error),
-             .outputStreamWriteFailed(let error), .inputStreamReadFailed(let error):
-            return error
-        default:
-            return nil
-        }
-    }
-}
-
-extension AFError.ResponseValidationFailureReason {
-    var acceptableContentTypes: [String]? {
-        switch self {
-        case .missingContentType(let types), .unacceptableContentType(let types, _):
-            return types
-        default:
-            return nil
-        }
-    }
-
-    var responseContentType: String? {
-        switch self {
-        case .unacceptableContentType(_, let responseType):
-            return responseType
-        default:
-            return nil
-        }
-    }
-
-    var responseCode: Int? {
-        switch self {
-        case .unacceptableStatusCode(let code):
-            return code
-        default:
-            return nil
-        }
-    }
-}
-
-extension AFError.ResponseSerializationFailureReason {
-    var failedStringEncoding: String.Encoding? {
-        switch self {
-        case .stringSerializationFailed(let encoding):
-            return encoding
-        default:
-            return nil
-        }
-    }
-
-    var underlyingError: Error? {
-        switch self {
-        case .jsonSerializationFailed(let error), .propertyListSerializationFailed(let error):
-            return error
-        default:
-            return nil
-        }
-    }
-}
-
-// MARK: - Error Descriptions
-
-extension AFError: LocalizedError {
-    public var errorDescription: String? {
-        switch self {
-        case .invalidURL(let url):
-            return "URL is not valid: \(url)"
-        case .parameterEncodingFailed(let reason):
-            return reason.localizedDescription
-        case .multipartEncodingFailed(let reason):
-            return reason.localizedDescription
-        case .responseValidationFailed(let reason):
-            return reason.localizedDescription
-        case .responseSerializationFailed(let reason):
-            return reason.localizedDescription
-        }
-    }
-}
-
-extension AFError.ParameterEncodingFailureReason {
-    var localizedDescription: String {
-        switch self {
-        case .missingURL:
-            return "URL request to encode was missing a URL"
-        case .jsonEncodingFailed(let error):
-            return "JSON could not be encoded because of error:\n\(error.localizedDescription)"
-        case .propertyListEncodingFailed(let error):
-            return "PropertyList could not be encoded because of error:\n\(error.localizedDescription)"
-        }
-    }
-}
-
-extension AFError.MultipartEncodingFailureReason {
-    var localizedDescription: String {
-        switch self {
-        case .bodyPartURLInvalid(let url):
-            return "The URL provided is not a file URL: \(url)"
-        case .bodyPartFilenameInvalid(let url):
-            return "The URL provided does not have a valid filename: \(url)"
-        case .bodyPartFileNotReachable(let url):
-            return "The URL provided is not reachable: \(url)"
-        case .bodyPartFileNotReachableWithError(let url, let error):
-            return (
-                "The system returned an error while checking the provided URL for " +
-                "reachability.\nURL: \(url)\nError: \(error)"
-            )
-        case .bodyPartFileIsDirectory(let url):
-            return "The URL provided is a directory: \(url)"
-        case .bodyPartFileSizeNotAvailable(let url):
-            return "Could not fetch the file size from the provided URL: \(url)"
-        case .bodyPartFileSizeQueryFailedWithError(let url, let error):
-            return (
-                "The system returned an error while attempting to fetch the file size from the " +
-                "provided URL.\nURL: \(url)\nError: \(error)"
-            )
-        case .bodyPartInputStreamCreationFailed(let url):
-            return "Failed to create an InputStream for the provided URL: \(url)"
-        case .outputStreamCreationFailed(let url):
-            return "Failed to create an OutputStream for URL: \(url)"
-        case .outputStreamFileAlreadyExists(let url):
-            return "A file already exists at the provided URL: \(url)"
-        case .outputStreamURLInvalid(let url):
-            return "The provided OutputStream URL is invalid: \(url)"
-        case .outputStreamWriteFailed(let error):
-            return "OutputStream write failed with error: \(error)"
-        case .inputStreamReadFailed(let error):
-            return "InputStream read failed with error: \(error)"
-        }
-    }
-}
-
-extension AFError.ResponseSerializationFailureReason {
-    var localizedDescription: String {
-        switch self {
-        case .inputDataNil:
-            return "Response could not be serialized, input data was nil."
-        case .inputDataNilOrZeroLength:
-            return "Response could not be serialized, input data was nil or zero length."
-        case .inputFileNil:
-            return "Response could not be serialized, input file was nil."
-        case .inputFileReadFailed(let url):
-            return "Response could not be serialized, input file could not be read: \(url)."
-        case .stringSerializationFailed(let encoding):
-            return "String could not be serialized with encoding: \(encoding)."
-        case .jsonSerializationFailed(let error):
-            return "JSON could not be serialized because of error:\n\(error.localizedDescription)"
-        case .propertyListSerializationFailed(let error):
-            return "PropertyList could not be serialized because of error:\n\(error.localizedDescription)"
-        }
-    }
-}
-
-extension AFError.ResponseValidationFailureReason {
-    var localizedDescription: String {
-        switch self {
-        case .dataFileNil:
-            return "Response could not be validated, data file was nil."
-        case .dataFileReadFailed(let url):
-            return "Response could not be validated, data file could not be read: \(url)."
-        case .missingContentType(let types):
-            return (
-                "Response Content-Type was missing and acceptable content types " +
-                "(\(types.joined(separator: ","))) do not match \"*/*\"."
-            )
-        case .unacceptableContentType(let acceptableTypes, let responseType):
-            return (
-                "Response Content-Type \"\(responseType)\" does not match any acceptable types: " +
-                "\(acceptableTypes.joined(separator: ","))."
-            )
-        case .unacceptableStatusCode(let code):
-            return "Response status code was unacceptable: \(code)."
-        }
-    }
-}

+ 0 - 465
Example/Pods/Alamofire/Source/Alamofire.swift

@@ -1,465 +0,0 @@
-//
-//  Alamofire.swift
-//
-//  Copyright (c) 2014 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
-
-/// Types adopting the `URLConvertible` protocol can be used to construct URLs, which are then used to construct
-/// URL requests.
-public protocol URLConvertible {
-    /// Returns a URL that conforms to RFC 2396 or throws an `Error`.
-    ///
-    /// - throws: An `Error` if the type cannot be converted to a `URL`.
-    ///
-    /// - returns: A URL or throws an `Error`.
-    func asURL() throws -> URL
-}
-
-extension String: URLConvertible {
-    /// Returns a URL if `self` represents a valid URL string that conforms to RFC 2396 or throws an `AFError`.
-    ///
-    /// - throws: An `AFError.invalidURL` if `self` is not a valid URL string.
-    ///
-    /// - returns: A URL or throws an `AFError`.
-    public func asURL() throws -> URL {
-        guard let url = URL(string: self) else { throw AFError.invalidURL(url: self) }
-        return url
-    }
-}
-
-extension URL: URLConvertible {
-    /// Returns self.
-    public func asURL() throws -> URL { return self }
-}
-
-extension URLComponents: URLConvertible {
-    /// Returns a URL if `url` is not nil, otherwise throws an `Error`.
-    ///
-    /// - throws: An `AFError.invalidURL` if `url` is `nil`.
-    ///
-    /// - returns: A URL or throws an `AFError`.
-    public func asURL() throws -> URL {
-        guard let url = url else { throw AFError.invalidURL(url: self) }
-        return url
-    }
-}
-
-// MARK: -
-
-/// Types adopting the `URLRequestConvertible` protocol can be used to construct URL requests.
-public protocol URLRequestConvertible {
-    /// Returns a URL request or throws if an `Error` was encountered.
-    ///
-    /// - throws: An `Error` if the underlying `URLRequest` is `nil`.
-    ///
-    /// - returns: A URL request.
-    func asURLRequest() throws -> URLRequest
-}
-
-extension URLRequestConvertible {
-    /// The URL request.
-    public var urlRequest: URLRequest? { return try? asURLRequest() }
-}
-
-extension URLRequest: URLRequestConvertible {
-    /// Returns a URL request or throws if an `Error` was encountered.
-    public func asURLRequest() throws -> URLRequest { return self }
-}
-
-// MARK: -
-
-extension URLRequest {
-    /// Creates an instance with the specified `method`, `urlString` and `headers`.
-    ///
-    /// - parameter url:     The URL.
-    /// - parameter method:  The HTTP method.
-    /// - parameter headers: The HTTP headers. `nil` by default.
-    ///
-    /// - returns: The new `URLRequest` instance.
-    public init(url: URLConvertible, method: HTTPMethod, headers: HTTPHeaders? = nil) throws {
-        let url = try url.asURL()
-
-        self.init(url: url)
-
-        httpMethod = method.rawValue
-
-        if let headers = headers {
-            for (headerField, headerValue) in headers {
-                setValue(headerValue, forHTTPHeaderField: headerField)
-            }
-        }
-    }
-
-    func adapt(using adapter: RequestAdapter?) throws -> URLRequest {
-        guard let adapter = adapter else { return self }
-        return try adapter.adapt(self)
-    }
-}
-
-// MARK: - Data Request
-
-/// Creates a `DataRequest` using the default `SessionManager` to retrieve the contents of the specified `url`,
-/// `method`, `parameters`, `encoding` and `headers`.
-///
-/// - parameter url:        The URL.
-/// - parameter method:     The HTTP method. `.get` by default.
-/// - parameter parameters: The parameters. `nil` by default.
-/// - parameter encoding:   The parameter encoding. `URLEncoding.default` by default.
-/// - parameter headers:    The HTTP headers. `nil` by default.
-///
-/// - returns: The created `DataRequest`.
-@discardableResult
-public func request(
-    _ url: URLConvertible,
-    method: HTTPMethod = .get,
-    parameters: Parameters? = nil,
-    encoding: ParameterEncoding = URLEncoding.default,
-    headers: HTTPHeaders? = nil)
-    -> DataRequest
-{
-    return SessionManager.default.request(
-        url,
-        method: method,
-        parameters: parameters,
-        encoding: encoding,
-        headers: headers
-    )
-}
-
-/// Creates a `DataRequest` using the default `SessionManager` to retrieve the contents of a URL based on the
-/// specified `urlRequest`.
-///
-/// - parameter urlRequest: The URL request
-///
-/// - returns: The created `DataRequest`.
-@discardableResult
-public func request(_ urlRequest: URLRequestConvertible) -> DataRequest {
-    return SessionManager.default.request(urlRequest)
-}
-
-// MARK: - Download Request
-
-// MARK: URL Request
-
-/// Creates a `DownloadRequest` using the default `SessionManager` to retrieve the contents of the specified `url`,
-/// `method`, `parameters`, `encoding`, `headers` and save them to the `destination`.
-///
-/// If `destination` is not specified, the contents will remain in the temporary location determined by the
-/// underlying URL session.
-///
-/// - parameter url:         The URL.
-/// - parameter method:      The HTTP method. `.get` by default.
-/// - parameter parameters:  The parameters. `nil` by default.
-/// - parameter encoding:    The parameter encoding. `URLEncoding.default` by default.
-/// - parameter headers:     The HTTP headers. `nil` by default.
-/// - parameter destination: The closure used to determine the destination of the downloaded file. `nil` by default.
-///
-/// - returns: The created `DownloadRequest`.
-@discardableResult
-public func download(
-    _ url: URLConvertible,
-    method: HTTPMethod = .get,
-    parameters: Parameters? = nil,
-    encoding: ParameterEncoding = URLEncoding.default,
-    headers: HTTPHeaders? = nil,
-    to destination: DownloadRequest.DownloadFileDestination? = nil)
-    -> DownloadRequest
-{
-    return SessionManager.default.download(
-        url,
-        method: method,
-        parameters: parameters,
-        encoding: encoding,
-        headers: headers,
-        to: destination
-    )
-}
-
-/// Creates a `DownloadRequest` using the default `SessionManager` to retrieve the contents of a URL based on the
-/// specified `urlRequest` and save them to the `destination`.
-///
-/// If `destination` is not specified, the contents will remain in the temporary location determined by the
-/// underlying URL session.
-///
-/// - parameter urlRequest:  The URL request.
-/// - parameter destination: The closure used to determine the destination of the downloaded file. `nil` by default.
-///
-/// - returns: The created `DownloadRequest`.
-@discardableResult
-public func download(
-    _ urlRequest: URLRequestConvertible,
-    to destination: DownloadRequest.DownloadFileDestination? = nil)
-    -> DownloadRequest
-{
-    return SessionManager.default.download(urlRequest, to: destination)
-}
-
-// MARK: Resume Data
-
-/// Creates a `DownloadRequest` using the default `SessionManager` from the `resumeData` produced from a
-/// previous request cancellation to retrieve the contents of the original request and save them to the `destination`.
-///
-/// If `destination` is not specified, the contents will remain in the temporary location determined by the
-/// underlying URL session.
-///
-/// On the latest release of all the Apple platforms (iOS 10, macOS 10.12, tvOS 10, watchOS 3), `resumeData` is broken
-/// on background URL session configurations. There's an underlying bug in the `resumeData` generation logic where the
-/// data is written incorrectly and will always fail to resume the download. For more information about the bug and
-/// possible workarounds, please refer to the following Stack Overflow post:
-///
-///    - http://stackoverflow.com/a/39347461/1342462
-///
-/// - parameter resumeData:  The resume data. This is an opaque data blob produced by `URLSessionDownloadTask`
-///                          when a task is cancelled. See `URLSession -downloadTask(withResumeData:)` for additional
-///                          information.
-/// - parameter destination: The closure used to determine the destination of the downloaded file. `nil` by default.
-///
-/// - returns: The created `DownloadRequest`.
-@discardableResult
-public func download(
-    resumingWith resumeData: Data,
-    to destination: DownloadRequest.DownloadFileDestination? = nil)
-    -> DownloadRequest
-{
-    return SessionManager.default.download(resumingWith: resumeData, to: destination)
-}
-
-// MARK: - Upload Request
-
-// MARK: File
-
-/// Creates an `UploadRequest` using the default `SessionManager` from the specified `url`, `method` and `headers`
-/// for uploading the `file`.
-///
-/// - parameter file:    The file to upload.
-/// - parameter url:     The URL.
-/// - parameter method:  The HTTP method. `.post` by default.
-/// - parameter headers: The HTTP headers. `nil` by default.
-///
-/// - returns: The created `UploadRequest`.
-@discardableResult
-public func upload(
-    _ fileURL: URL,
-    to url: URLConvertible,
-    method: HTTPMethod = .post,
-    headers: HTTPHeaders? = nil)
-    -> UploadRequest
-{
-    return SessionManager.default.upload(fileURL, to: url, method: method, headers: headers)
-}
-
-/// Creates a `UploadRequest` using the default `SessionManager` from the specified `urlRequest` for
-/// uploading the `file`.
-///
-/// - parameter file:       The file to upload.
-/// - parameter urlRequest: The URL request.
-///
-/// - returns: The created `UploadRequest`.
-@discardableResult
-public func upload(_ fileURL: URL, with urlRequest: URLRequestConvertible) -> UploadRequest {
-    return SessionManager.default.upload(fileURL, with: urlRequest)
-}
-
-// MARK: Data
-
-/// Creates an `UploadRequest` using the default `SessionManager` from the specified `url`, `method` and `headers`
-/// for uploading the `data`.
-///
-/// - parameter data:    The data to upload.
-/// - parameter url:     The URL.
-/// - parameter method:  The HTTP method. `.post` by default.
-/// - parameter headers: The HTTP headers. `nil` by default.
-///
-/// - returns: The created `UploadRequest`.
-@discardableResult
-public func upload(
-    _ data: Data,
-    to url: URLConvertible,
-    method: HTTPMethod = .post,
-    headers: HTTPHeaders? = nil)
-    -> UploadRequest
-{
-    return SessionManager.default.upload(data, to: url, method: method, headers: headers)
-}
-
-/// Creates an `UploadRequest` using the default `SessionManager` from the specified `urlRequest` for
-/// uploading the `data`.
-///
-/// - parameter data:       The data to upload.
-/// - parameter urlRequest: The URL request.
-///
-/// - returns: The created `UploadRequest`.
-@discardableResult
-public func upload(_ data: Data, with urlRequest: URLRequestConvertible) -> UploadRequest {
-    return SessionManager.default.upload(data, with: urlRequest)
-}
-
-// MARK: InputStream
-
-/// Creates an `UploadRequest` using the default `SessionManager` from the specified `url`, `method` and `headers`
-/// for uploading the `stream`.
-///
-/// - parameter stream:  The stream to upload.
-/// - parameter url:     The URL.
-/// - parameter method:  The HTTP method. `.post` by default.
-/// - parameter headers: The HTTP headers. `nil` by default.
-///
-/// - returns: The created `UploadRequest`.
-@discardableResult
-public func upload(
-    _ stream: InputStream,
-    to url: URLConvertible,
-    method: HTTPMethod = .post,
-    headers: HTTPHeaders? = nil)
-    -> UploadRequest
-{
-    return SessionManager.default.upload(stream, to: url, method: method, headers: headers)
-}
-
-/// Creates an `UploadRequest` using the default `SessionManager` from the specified `urlRequest` for
-/// uploading the `stream`.
-///
-/// - parameter urlRequest: The URL request.
-/// - parameter stream:     The stream to upload.
-///
-/// - returns: The created `UploadRequest`.
-@discardableResult
-public func upload(_ stream: InputStream, with urlRequest: URLRequestConvertible) -> UploadRequest {
-    return SessionManager.default.upload(stream, with: urlRequest)
-}
-
-// MARK: MultipartFormData
-
-/// Encodes `multipartFormData` using `encodingMemoryThreshold` with the default `SessionManager` and calls
-/// `encodingCompletion` with new `UploadRequest` using the `url`, `method` and `headers`.
-///
-/// It is important to understand the memory implications of uploading `MultipartFormData`. If the cummulative
-/// payload is small, encoding the data in-memory and directly uploading to a server is the by far the most
-/// efficient approach. However, if the payload is too large, encoding the data in-memory could cause your app to
-/// be terminated. Larger payloads must first be written to disk using input and output streams to keep the memory
-/// footprint low, then the data can be uploaded as a stream from the resulting file. Streaming from disk MUST be
-/// used for larger payloads such as video content.
-///
-/// The `encodingMemoryThreshold` parameter allows Alamofire to automatically determine whether to encode in-memory
-/// or stream from disk. If the content length of the `MultipartFormData` is below the `encodingMemoryThreshold`,
-/// encoding takes place in-memory. If the content length exceeds the threshold, the data is streamed to disk
-/// during the encoding process. Then the result is uploaded as data or as a stream depending on which encoding
-/// technique was used.
-///
-/// - parameter multipartFormData:       The closure used to append body parts to the `MultipartFormData`.
-/// - parameter encodingMemoryThreshold: The encoding memory threshold in bytes.
-///                                      `multipartFormDataEncodingMemoryThreshold` by default.
-/// - parameter url:                     The URL.
-/// - parameter method:                  The HTTP method. `.post` by default.
-/// - parameter headers:                 The HTTP headers. `nil` by default.
-/// - parameter encodingCompletion:      The closure called when the `MultipartFormData` encoding is complete.
-public func upload(
-    multipartFormData: @escaping (MultipartFormData) -> Void,
-    usingThreshold encodingMemoryThreshold: UInt64 = SessionManager.multipartFormDataEncodingMemoryThreshold,
-    to url: URLConvertible,
-    method: HTTPMethod = .post,
-    headers: HTTPHeaders? = nil,
-    encodingCompletion: ((SessionManager.MultipartFormDataEncodingResult) -> Void)?)
-{
-    return SessionManager.default.upload(
-        multipartFormData: multipartFormData,
-        usingThreshold: encodingMemoryThreshold,
-        to: url,
-        method: method,
-        headers: headers,
-        encodingCompletion: encodingCompletion
-    )
-}
-
-/// Encodes `multipartFormData` using `encodingMemoryThreshold` and the default `SessionManager` and
-/// calls `encodingCompletion` with new `UploadRequest` using the `urlRequest`.
-///
-/// It is important to understand the memory implications of uploading `MultipartFormData`. If the cummulative
-/// payload is small, encoding the data in-memory and directly uploading to a server is the by far the most
-/// efficient approach. However, if the payload is too large, encoding the data in-memory could cause your app to
-/// be terminated. Larger payloads must first be written to disk using input and output streams to keep the memory
-/// footprint low, then the data can be uploaded as a stream from the resulting file. Streaming from disk MUST be
-/// used for larger payloads such as video content.
-///
-/// The `encodingMemoryThreshold` parameter allows Alamofire to automatically determine whether to encode in-memory
-/// or stream from disk. If the content length of the `MultipartFormData` is below the `encodingMemoryThreshold`,
-/// encoding takes place in-memory. If the content length exceeds the threshold, the data is streamed to disk
-/// during the encoding process. Then the result is uploaded as data or as a stream depending on which encoding
-/// technique was used.
-///
-/// - parameter multipartFormData:       The closure used to append body parts to the `MultipartFormData`.
-/// - parameter encodingMemoryThreshold: The encoding memory threshold in bytes.
-///                                      `multipartFormDataEncodingMemoryThreshold` by default.
-/// - parameter urlRequest:              The URL request.
-/// - parameter encodingCompletion:      The closure called when the `MultipartFormData` encoding is complete.
-public func upload(
-    multipartFormData: @escaping (MultipartFormData) -> Void,
-    usingThreshold encodingMemoryThreshold: UInt64 = SessionManager.multipartFormDataEncodingMemoryThreshold,
-    with urlRequest: URLRequestConvertible,
-    encodingCompletion: ((SessionManager.MultipartFormDataEncodingResult) -> Void)?)
-{
-    return SessionManager.default.upload(
-        multipartFormData: multipartFormData,
-        usingThreshold: encodingMemoryThreshold,
-        with: urlRequest,
-        encodingCompletion: encodingCompletion
-    )
-}
-
-#if !os(watchOS)
-
-// MARK: - Stream Request
-
-// MARK: Hostname and Port
-
-/// Creates a `StreamRequest` using the default `SessionManager` for bidirectional streaming with the `hostname`
-/// and `port`.
-///
-/// If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned.
-///
-/// - parameter hostName: The hostname of the server to connect to.
-/// - parameter port:     The port of the server to connect to.
-///
-/// - returns: The created `StreamRequest`.
-@discardableResult
-@available(iOS 9.0, macOS 10.11, tvOS 9.0, *)
-public func stream(withHostName hostName: String, port: Int) -> StreamRequest {
-    return SessionManager.default.stream(withHostName: hostName, port: port)
-}
-
-// MARK: NetService
-
-/// Creates a `StreamRequest` using the default `SessionManager` for bidirectional streaming with the `netService`.
-///
-/// If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned.
-///
-/// - parameter netService: The net service used to identify the endpoint.
-///
-/// - returns: The created `StreamRequest`.
-@discardableResult
-@available(iOS 9.0, macOS 10.11, tvOS 9.0, *)
-public func stream(with netService: NetService) -> StreamRequest {
-    return SessionManager.default.stream(with: netService)
-}
-
-#endif

+ 0 - 37
Example/Pods/Alamofire/Source/DispatchQueue+Alamofire.swift

@@ -1,37 +0,0 @@
-//
-//  DispatchQueue+Alamofire.swift
-//
-//  Copyright (c) 2014 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 Dispatch
-import Foundation
-
-extension DispatchQueue {
-    static var userInteractive: DispatchQueue { return DispatchQueue.global(qos: .userInteractive) }
-    static var userInitiated: DispatchQueue { return DispatchQueue.global(qos: .userInitiated) }
-    static var utility: DispatchQueue { return DispatchQueue.global(qos: .utility) }
-    static var background: DispatchQueue { return DispatchQueue.global(qos: .background) }
-
-    func after(_ delay: TimeInterval, execute closure: @escaping () -> Void) {
-        asyncAfter(deadline: .now() + delay, execute: closure)
-    }
-}

+ 0 - 580
Example/Pods/Alamofire/Source/MultipartFormData.swift

@@ -1,580 +0,0 @@
-//
-//  MultipartFormData.swift
-//
-//  Copyright (c) 2014 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
-
-#if os(iOS) || os(watchOS) || os(tvOS)
-import MobileCoreServices
-#elseif os(macOS)
-import CoreServices
-#endif
-
-/// Constructs `multipart/form-data` for uploads within an HTTP or HTTPS body. There are currently two ways to encode
-/// multipart form data. The first way is to encode the data directly in memory. This is very efficient, but can lead
-/// to memory issues if the dataset is too large. The second way is designed for larger datasets and will write all the
-/// data to a single file on disk with all the proper boundary segmentation. The second approach MUST be used for
-/// larger datasets such as video content, otherwise your app may run out of memory when trying to encode the dataset.
-///
-/// For more information on `multipart/form-data` in general, please refer to the RFC-2388 and RFC-2045 specs as well
-/// and the w3 form documentation.
-///
-/// - https://www.ietf.org/rfc/rfc2388.txt
-/// - https://www.ietf.org/rfc/rfc2045.txt
-/// - https://www.w3.org/TR/html401/interact/forms.html#h-17.13
-open class MultipartFormData {
-
-    // MARK: - Helper Types
-
-    struct EncodingCharacters {
-        static let crlf = "\r\n"
-    }
-
-    struct BoundaryGenerator {
-        enum BoundaryType {
-            case initial, encapsulated, final
-        }
-
-        static func randomBoundary() -> String {
-            return String(format: "alamofire.boundary.%08x%08x", arc4random(), arc4random())
-        }
-
-        static func boundaryData(forBoundaryType boundaryType: BoundaryType, boundary: String) -> Data {
-            let boundaryText: String
-
-            switch boundaryType {
-            case .initial:
-                boundaryText = "--\(boundary)\(EncodingCharacters.crlf)"
-            case .encapsulated:
-                boundaryText = "\(EncodingCharacters.crlf)--\(boundary)\(EncodingCharacters.crlf)"
-            case .final:
-                boundaryText = "\(EncodingCharacters.crlf)--\(boundary)--\(EncodingCharacters.crlf)"
-            }
-
-            return boundaryText.data(using: String.Encoding.utf8, allowLossyConversion: false)!
-        }
-    }
-
-    class BodyPart {
-        let headers: HTTPHeaders
-        let bodyStream: InputStream
-        let bodyContentLength: UInt64
-        var hasInitialBoundary = false
-        var hasFinalBoundary = false
-
-        init(headers: HTTPHeaders, bodyStream: InputStream, bodyContentLength: UInt64) {
-            self.headers = headers
-            self.bodyStream = bodyStream
-            self.bodyContentLength = bodyContentLength
-        }
-    }
-
-    // MARK: - Properties
-
-    /// The `Content-Type` header value containing the boundary used to generate the `multipart/form-data`.
-    open lazy var contentType: String = "multipart/form-data; boundary=\(self.boundary)"
-
-    /// The content length of all body parts used to generate the `multipart/form-data` not including the boundaries.
-    public var contentLength: UInt64 { return bodyParts.reduce(0) { $0 + $1.bodyContentLength } }
-
-    /// The boundary used to separate the body parts in the encoded form data.
-    public var boundary: String
-
-    private var bodyParts: [BodyPart]
-    private var bodyPartError: AFError?
-    private let streamBufferSize: Int
-
-    // MARK: - Lifecycle
-
-    /// Creates a multipart form data object.
-    ///
-    /// - returns: The multipart form data object.
-    public init() {
-        self.boundary = BoundaryGenerator.randomBoundary()
-        self.bodyParts = []
-
-        ///
-        /// The optimal read/write buffer size in bytes for input and output streams is 1024 (1KB). For more
-        /// information, please refer to the following article:
-        ///   - https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/Streams/Articles/ReadingInputStreams.html
-        ///
-
-        self.streamBufferSize = 1024
-    }
-
-    // MARK: - Body Parts
-
-    /// Creates a body part from the data and appends it to the multipart form data object.
-    ///
-    /// The body part data will be encoded using the following format:
-    ///
-    /// - `Content-Disposition: form-data; name=#{name}` (HTTP Header)
-    /// - Encoded data
-    /// - Multipart form boundary
-    ///
-    /// - parameter data: The data to encode into the multipart form data.
-    /// - parameter name: The name to associate with the data in the `Content-Disposition` HTTP header.
-    public func append(_ data: Data, withName name: String) {
-        let headers = contentHeaders(withName: name)
-        let stream = InputStream(data: data)
-        let length = UInt64(data.count)
-
-        append(stream, withLength: length, headers: headers)
-    }
-
-    /// Creates a body part from the data and appends it to the multipart form data object.
-    ///
-    /// The body part data will be encoded using the following format:
-    ///
-    /// - `Content-Disposition: form-data; name=#{name}` (HTTP Header)
-    /// - `Content-Type: #{generated mimeType}` (HTTP Header)
-    /// - Encoded data
-    /// - Multipart form boundary
-    ///
-    /// - parameter data:     The data to encode into the multipart form data.
-    /// - parameter name:     The name to associate with the data in the `Content-Disposition` HTTP header.
-    /// - parameter mimeType: The MIME type to associate with the data content type in the `Content-Type` HTTP header.
-    public func append(_ data: Data, withName name: String, mimeType: String) {
-        let headers = contentHeaders(withName: name, mimeType: mimeType)
-        let stream = InputStream(data: data)
-        let length = UInt64(data.count)
-
-        append(stream, withLength: length, headers: headers)
-    }
-
-    /// Creates a body part from the data and appends it to the multipart form data object.
-    ///
-    /// The body part data will be encoded using the following format:
-    ///
-    /// - `Content-Disposition: form-data; name=#{name}; filename=#{filename}` (HTTP Header)
-    /// - `Content-Type: #{mimeType}` (HTTP Header)
-    /// - Encoded file data
-    /// - Multipart form boundary
-    ///
-    /// - parameter data:     The data to encode into the multipart form data.
-    /// - parameter name:     The name to associate with the data in the `Content-Disposition` HTTP header.
-    /// - parameter fileName: The filename to associate with the data in the `Content-Disposition` HTTP header.
-    /// - parameter mimeType: The MIME type to associate with the data in the `Content-Type` HTTP header.
-    public func append(_ data: Data, withName name: String, fileName: String, mimeType: String) {
-        let headers = contentHeaders(withName: name, fileName: fileName, mimeType: mimeType)
-        let stream = InputStream(data: data)
-        let length = UInt64(data.count)
-
-        append(stream, withLength: length, headers: headers)
-    }
-
-    /// Creates a body part from the file and appends it to the multipart form data object.
-    ///
-    /// The body part data will be encoded using the following format:
-    ///
-    /// - `Content-Disposition: form-data; name=#{name}; filename=#{generated filename}` (HTTP Header)
-    /// - `Content-Type: #{generated mimeType}` (HTTP Header)
-    /// - Encoded file data
-    /// - Multipart form boundary
-    ///
-    /// The filename in the `Content-Disposition` HTTP header is generated from the last path component of the
-    /// `fileURL`. The `Content-Type` HTTP header MIME type is generated by mapping the `fileURL` extension to the
-    /// system associated MIME type.
-    ///
-    /// - parameter fileURL: The URL of the file whose content will be encoded into the multipart form data.
-    /// - parameter name:    The name to associate with the file content in the `Content-Disposition` HTTP header.
-    public func append(_ fileURL: URL, withName name: String) {
-        let fileName = fileURL.lastPathComponent
-        let pathExtension = fileURL.pathExtension
-
-        if !fileName.isEmpty && !pathExtension.isEmpty {
-            let mime = mimeType(forPathExtension: pathExtension)
-            append(fileURL, withName: name, fileName: fileName, mimeType: mime)
-        } else {
-            setBodyPartError(withReason: .bodyPartFilenameInvalid(in: fileURL))
-        }
-    }
-
-    /// Creates a body part from the file and appends it to the multipart form data object.
-    ///
-    /// The body part data will be encoded using the following format:
-    ///
-    /// - Content-Disposition: form-data; name=#{name}; filename=#{filename} (HTTP Header)
-    /// - Content-Type: #{mimeType} (HTTP Header)
-    /// - Encoded file data
-    /// - Multipart form boundary
-    ///
-    /// - parameter fileURL:  The URL of the file whose content will be encoded into the multipart form data.
-    /// - parameter name:     The name to associate with the file content in the `Content-Disposition` HTTP header.
-    /// - parameter fileName: The filename to associate with the file content in the `Content-Disposition` HTTP header.
-    /// - parameter mimeType: The MIME type to associate with the file content in the `Content-Type` HTTP header.
-    public func append(_ fileURL: URL, withName name: String, fileName: String, mimeType: String) {
-        let headers = contentHeaders(withName: name, fileName: fileName, mimeType: mimeType)
-
-        //============================================================
-        //                 Check 1 - is file URL?
-        //============================================================
-
-        guard fileURL.isFileURL else {
-            setBodyPartError(withReason: .bodyPartURLInvalid(url: fileURL))
-            return
-        }
-
-        //============================================================
-        //              Check 2 - is file URL reachable?
-        //============================================================
-
-        do {
-            let isReachable = try fileURL.checkPromisedItemIsReachable()
-            guard isReachable else {
-                setBodyPartError(withReason: .bodyPartFileNotReachable(at: fileURL))
-                return
-            }
-        } catch {
-            setBodyPartError(withReason: .bodyPartFileNotReachableWithError(atURL: fileURL, error: error))
-            return
-        }
-
-        //============================================================
-        //            Check 3 - is file URL a directory?
-        //============================================================
-
-        var isDirectory: ObjCBool = false
-        let path = fileURL.path
-
-        guard FileManager.default.fileExists(atPath: path, isDirectory: &isDirectory) && !isDirectory.boolValue else {
-            setBodyPartError(withReason: .bodyPartFileIsDirectory(at: fileURL))
-            return
-        }
-
-        //============================================================
-        //          Check 4 - can the file size be extracted?
-        //============================================================
-
-        let bodyContentLength: UInt64
-
-        do {
-            guard let fileSize = try FileManager.default.attributesOfItem(atPath: path)[.size] as? NSNumber else {
-                setBodyPartError(withReason: .bodyPartFileSizeNotAvailable(at: fileURL))
-                return
-            }
-
-            bodyContentLength = fileSize.uint64Value
-        }
-        catch {
-            setBodyPartError(withReason: .bodyPartFileSizeQueryFailedWithError(forURL: fileURL, error: error))
-            return
-        }
-
-        //============================================================
-        //       Check 5 - can a stream be created from file URL?
-        //============================================================
-
-        guard let stream = InputStream(url: fileURL) else {
-            setBodyPartError(withReason: .bodyPartInputStreamCreationFailed(for: fileURL))
-            return
-        }
-
-        append(stream, withLength: bodyContentLength, headers: headers)
-    }
-
-    /// Creates a body part from the stream and appends it to the multipart form data object.
-    ///
-    /// The body part data will be encoded using the following format:
-    ///
-    /// - `Content-Disposition: form-data; name=#{name}; filename=#{filename}` (HTTP Header)
-    /// - `Content-Type: #{mimeType}` (HTTP Header)
-    /// - Encoded stream data
-    /// - Multipart form boundary
-    ///
-    /// - parameter stream:   The input stream to encode in the multipart form data.
-    /// - parameter length:   The content length of the stream.
-    /// - parameter name:     The name to associate with the stream content in the `Content-Disposition` HTTP header.
-    /// - parameter fileName: The filename to associate with the stream content in the `Content-Disposition` HTTP header.
-    /// - parameter mimeType: The MIME type to associate with the stream content in the `Content-Type` HTTP header.
-    public func append(
-        _ stream: InputStream,
-        withLength length: UInt64,
-        name: String,
-        fileName: String,
-        mimeType: String)
-    {
-        let headers = contentHeaders(withName: name, fileName: fileName, mimeType: mimeType)
-        append(stream, withLength: length, headers: headers)
-    }
-
-    /// Creates a body part with the headers, stream and length and appends it to the multipart form data object.
-    ///
-    /// The body part data will be encoded using the following format:
-    ///
-    /// - HTTP headers
-    /// - Encoded stream data
-    /// - Multipart form boundary
-    ///
-    /// - parameter stream:  The input stream to encode in the multipart form data.
-    /// - parameter length:  The content length of the stream.
-    /// - parameter headers: The HTTP headers for the body part.
-    public func append(_ stream: InputStream, withLength length: UInt64, headers: HTTPHeaders) {
-        let bodyPart = BodyPart(headers: headers, bodyStream: stream, bodyContentLength: length)
-        bodyParts.append(bodyPart)
-    }
-
-    // MARK: - Data Encoding
-
-    /// Encodes all the appended body parts into a single `Data` value.
-    ///
-    /// It is important to note that this method will load all the appended body parts into memory all at the same
-    /// time. This method should only be used when the encoded data will have a small memory footprint. For large data
-    /// cases, please use the `writeEncodedDataToDisk(fileURL:completionHandler:)` method.
-    ///
-    /// - throws: An `AFError` if encoding encounters an error.
-    ///
-    /// - returns: The encoded `Data` if encoding is successful.
-    public func encode() throws -> Data {
-        if let bodyPartError = bodyPartError {
-            throw bodyPartError
-        }
-
-        var encoded = Data()
-
-        bodyParts.first?.hasInitialBoundary = true
-        bodyParts.last?.hasFinalBoundary = true
-
-        for bodyPart in bodyParts {
-            let encodedData = try encode(bodyPart)
-            encoded.append(encodedData)
-        }
-
-        return encoded
-    }
-
-    /// Writes the appended body parts into the given file URL.
-    ///
-    /// This process is facilitated by reading and writing with input and output streams, respectively. Thus,
-    /// this approach is very memory efficient and should be used for large body part data.
-    ///
-    /// - parameter fileURL: The file URL to write the multipart form data into.
-    ///
-    /// - throws: An `AFError` if encoding encounters an error.
-    public func writeEncodedData(to fileURL: URL) throws {
-        if let bodyPartError = bodyPartError {
-            throw bodyPartError
-        }
-
-        if FileManager.default.fileExists(atPath: fileURL.path) {
-            throw AFError.multipartEncodingFailed(reason: .outputStreamFileAlreadyExists(at: fileURL))
-        } else if !fileURL.isFileURL {
-            throw AFError.multipartEncodingFailed(reason: .outputStreamURLInvalid(url: fileURL))
-        }
-
-        guard let outputStream = OutputStream(url: fileURL, append: false) else {
-            throw AFError.multipartEncodingFailed(reason: .outputStreamCreationFailed(for: fileURL))
-        }
-
-        outputStream.open()
-        defer { outputStream.close() }
-
-        self.bodyParts.first?.hasInitialBoundary = true
-        self.bodyParts.last?.hasFinalBoundary = true
-
-        for bodyPart in self.bodyParts {
-            try write(bodyPart, to: outputStream)
-        }
-    }
-
-    // MARK: - Private - Body Part Encoding
-
-    private func encode(_ bodyPart: BodyPart) throws -> Data {
-        var encoded = Data()
-
-        let initialData = bodyPart.hasInitialBoundary ? initialBoundaryData() : encapsulatedBoundaryData()
-        encoded.append(initialData)
-
-        let headerData = encodeHeaders(for: bodyPart)
-        encoded.append(headerData)
-
-        let bodyStreamData = try encodeBodyStream(for: bodyPart)
-        encoded.append(bodyStreamData)
-
-        if bodyPart.hasFinalBoundary {
-            encoded.append(finalBoundaryData())
-        }
-
-        return encoded
-    }
-
-    private func encodeHeaders(for bodyPart: BodyPart) -> Data {
-        var headerText = ""
-
-        for (key, value) in bodyPart.headers {
-            headerText += "\(key): \(value)\(EncodingCharacters.crlf)"
-        }
-        headerText += EncodingCharacters.crlf
-
-        return headerText.data(using: String.Encoding.utf8, allowLossyConversion: false)!
-    }
-
-    private func encodeBodyStream(for bodyPart: BodyPart) throws -> Data {
-        let inputStream = bodyPart.bodyStream
-        inputStream.open()
-        defer { inputStream.close() }
-
-        var encoded = Data()
-
-        while inputStream.hasBytesAvailable {
-            var buffer = [UInt8](repeating: 0, count: streamBufferSize)
-            let bytesRead = inputStream.read(&buffer, maxLength: streamBufferSize)
-
-            if let error = inputStream.streamError {
-                throw AFError.multipartEncodingFailed(reason: .inputStreamReadFailed(error: error))
-            }
-
-            if bytesRead > 0 {
-                encoded.append(buffer, count: bytesRead)
-            } else {
-                break
-            }
-        }
-
-        return encoded
-    }
-
-    // MARK: - Private - Writing Body Part to Output Stream
-
-    private func write(_ bodyPart: BodyPart, to outputStream: OutputStream) throws {
-        try writeInitialBoundaryData(for: bodyPart, to: outputStream)
-        try writeHeaderData(for: bodyPart, to: outputStream)
-        try writeBodyStream(for: bodyPart, to: outputStream)
-        try writeFinalBoundaryData(for: bodyPart, to: outputStream)
-    }
-
-    private func writeInitialBoundaryData(for bodyPart: BodyPart, to outputStream: OutputStream) throws {
-        let initialData = bodyPart.hasInitialBoundary ? initialBoundaryData() : encapsulatedBoundaryData()
-        return try write(initialData, to: outputStream)
-    }
-
-    private func writeHeaderData(for bodyPart: BodyPart, to outputStream: OutputStream) throws {
-        let headerData = encodeHeaders(for: bodyPart)
-        return try write(headerData, to: outputStream)
-    }
-
-    private func writeBodyStream(for bodyPart: BodyPart, to outputStream: OutputStream) throws {
-        let inputStream = bodyPart.bodyStream
-
-        inputStream.open()
-        defer { inputStream.close() }
-
-        while inputStream.hasBytesAvailable {
-            var buffer = [UInt8](repeating: 0, count: streamBufferSize)
-            let bytesRead = inputStream.read(&buffer, maxLength: streamBufferSize)
-
-            if let streamError = inputStream.streamError {
-                throw AFError.multipartEncodingFailed(reason: .inputStreamReadFailed(error: streamError))
-            }
-
-            if bytesRead > 0 {
-                if buffer.count != bytesRead {
-                    buffer = Array(buffer[0..<bytesRead])
-                }
-
-                try write(&buffer, to: outputStream)
-            } else {
-                break
-            }
-        }
-    }
-
-    private func writeFinalBoundaryData(for bodyPart: BodyPart, to outputStream: OutputStream) throws {
-        if bodyPart.hasFinalBoundary {
-            return try write(finalBoundaryData(), to: outputStream)
-        }
-    }
-
-    // MARK: - Private - Writing Buffered Data to Output Stream
-
-    private func write(_ data: Data, to outputStream: OutputStream) throws {
-        var buffer = [UInt8](repeating: 0, count: data.count)
-        data.copyBytes(to: &buffer, count: data.count)
-
-        return try write(&buffer, to: outputStream)
-    }
-
-    private func write(_ buffer: inout [UInt8], to outputStream: OutputStream) throws {
-        var bytesToWrite = buffer.count
-
-        while bytesToWrite > 0, outputStream.hasSpaceAvailable {
-            let bytesWritten = outputStream.write(buffer, maxLength: bytesToWrite)
-
-            if let error = outputStream.streamError {
-                throw AFError.multipartEncodingFailed(reason: .outputStreamWriteFailed(error: error))
-            }
-
-            bytesToWrite -= bytesWritten
-
-            if bytesToWrite > 0 {
-                buffer = Array(buffer[bytesWritten..<buffer.count])
-            }
-        }
-    }
-
-    // MARK: - Private - Mime Type
-
-    private func mimeType(forPathExtension pathExtension: String) -> String {
-        if
-            let id = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, pathExtension as CFString, nil)?.takeRetainedValue(),
-            let contentType = UTTypeCopyPreferredTagWithClass(id, kUTTagClassMIMEType)?.takeRetainedValue()
-        {
-            return contentType as String
-        }
-
-        return "application/octet-stream"
-    }
-
-    // MARK: - Private - Content Headers
-
-    private func contentHeaders(withName name: String, fileName: String? = nil, mimeType: String? = nil) -> [String: String] {
-        var disposition = "form-data; name=\"\(name)\""
-        if let fileName = fileName { disposition += "; filename=\"\(fileName)\"" }
-
-        var headers = ["Content-Disposition": disposition]
-        if let mimeType = mimeType { headers["Content-Type"] = mimeType }
-
-        return headers
-    }
-
-    // MARK: - Private - Boundary Encoding
-
-    private func initialBoundaryData() -> Data {
-        return BoundaryGenerator.boundaryData(forBoundaryType: .initial, boundary: boundary)
-    }
-
-    private func encapsulatedBoundaryData() -> Data {
-        return BoundaryGenerator.boundaryData(forBoundaryType: .encapsulated, boundary: boundary)
-    }
-
-    private func finalBoundaryData() -> Data {
-        return BoundaryGenerator.boundaryData(forBoundaryType: .final, boundary: boundary)
-    }
-
-    // MARK: - Private - Errors
-
-    private func setBodyPartError(withReason reason: AFError.MultipartEncodingFailureReason) {
-        guard bodyPartError == nil else { return }
-        bodyPartError = AFError.multipartEncodingFailed(reason: reason)
-    }
-}

+ 0 - 238
Example/Pods/Alamofire/Source/NetworkReachabilityManager.swift

@@ -1,238 +0,0 @@
-//
-//  NetworkReachabilityManager.swift
-//
-//  Copyright (c) 2014 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.
-//
-
-#if !os(watchOS)
-
-import Foundation
-import SystemConfiguration
-
-/// The `NetworkReachabilityManager` class listens for reachability changes of hosts 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 retry
-/// network requests 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.
-open class NetworkReachabilityManager {
-    /// Defines the various states of network reachability.
-    ///
-    /// - unknown:      It is unknown whether the network is reachable.
-    /// - notReachable: The network is not reachable.
-    /// - reachable:    The network is reachable.
-    public enum NetworkReachabilityStatus {
-        case unknown
-        case notReachable
-        case reachable(ConnectionType)
-    }
-
-    /// Defines the various connection types detected by reachability flags.
-    ///
-    /// - ethernetOrWiFi: The connection type is either over Ethernet or WiFi.
-    /// - wwan:           The connection type is a WWAN connection.
-    public enum ConnectionType {
-        case ethernetOrWiFi
-        case wwan
-    }
-
-    /// A closure executed when the network reachability status changes. The closure takes a single argument: the
-    /// network reachability status.
-    public typealias Listener = (NetworkReachabilityStatus) -> Void
-
-    // MARK: - Properties
-
-    /// Whether the network is currently reachable.
-    open var isReachable: Bool { return isReachableOnWWAN || isReachableOnEthernetOrWiFi }
-
-    /// Whether the network is currently reachable over the WWAN interface.
-    open var isReachableOnWWAN: Bool { return networkReachabilityStatus == .reachable(.wwan) }
-
-    /// Whether the network is currently reachable over Ethernet or WiFi interface.
-    open var isReachableOnEthernetOrWiFi: Bool { return networkReachabilityStatus == .reachable(.ethernetOrWiFi) }
-
-    /// The current network reachability status.
-    open var networkReachabilityStatus: NetworkReachabilityStatus {
-        guard let flags = self.flags else { return .unknown }
-        return networkReachabilityStatusForFlags(flags)
-    }
-
-    /// The dispatch queue to execute the `listener` closure on.
-    open var listenerQueue: DispatchQueue = DispatchQueue.main
-
-    /// A closure executed when the network reachability status changes.
-    open var listener: Listener?
-
-    open var flags: SCNetworkReachabilityFlags? {
-        var flags = SCNetworkReachabilityFlags()
-
-        if SCNetworkReachabilityGetFlags(reachability, &flags) {
-            return flags
-        }
-
-        return nil
-    }
-
-    private let reachability: SCNetworkReachability
-    open var previousFlags: SCNetworkReachabilityFlags
-
-    // MARK: - Initialization
-
-    /// Creates a `NetworkReachabilityManager` instance with the specified host.
-    ///
-    /// - parameter host: The host used to evaluate network reachability.
-    ///
-    /// - returns: The new `NetworkReachabilityManager` instance.
-    public convenience init?(host: String) {
-        guard let reachability = SCNetworkReachabilityCreateWithName(nil, host) else { return nil }
-        self.init(reachability: reachability)
-    }
-
-    /// Creates a `NetworkReachabilityManager` instance that monitors the address 0.0.0.0.
-    ///
-    /// Reachability treats the 0.0.0.0 address as a special token that causes it to monitor the general routing
-    /// status of the device, both IPv4 and IPv6.
-    ///
-    /// - returns: The new `NetworkReachabilityManager` instance.
-    public convenience init?() {
-        var address = sockaddr_in()
-        address.sin_len = UInt8(MemoryLayout<sockaddr_in>.size)
-        address.sin_family = sa_family_t(AF_INET)
-
-        guard let reachability = withUnsafePointer(to: &address, { pointer in
-            return pointer.withMemoryRebound(to: sockaddr.self, capacity: MemoryLayout<sockaddr>.size) {
-                return SCNetworkReachabilityCreateWithAddress(nil, $0)
-            }
-        }) else { return nil }
-
-        self.init(reachability: reachability)
-    }
-
-    private init(reachability: SCNetworkReachability) {
-        self.reachability = reachability
-
-        // Set the previous flags to an unreserved value to represent unknown status
-        self.previousFlags = SCNetworkReachabilityFlags(rawValue: 1 << 30)
-    }
-
-    deinit {
-        stopListening()
-    }
-
-    // MARK: - Listening
-
-    /// Starts listening for changes in network reachability status.
-    ///
-    /// - returns: `true` if listening was started successfully, `false` otherwise.
-    @discardableResult
-    open func startListening() -> Bool {
-        var context = SCNetworkReachabilityContext(version: 0, info: nil, retain: nil, release: nil, copyDescription: nil)
-        context.info = Unmanaged.passUnretained(self).toOpaque()
-
-        let callbackEnabled = SCNetworkReachabilitySetCallback(
-            reachability,
-            { (_, flags, info) in
-                let reachability = Unmanaged<NetworkReachabilityManager>.fromOpaque(info!).takeUnretainedValue()
-                reachability.notifyListener(flags)
-            },
-            &context
-        )
-
-        let queueEnabled = SCNetworkReachabilitySetDispatchQueue(reachability, listenerQueue)
-
-        listenerQueue.async {
-            self.previousFlags = SCNetworkReachabilityFlags(rawValue: 1 << 30)
-
-            guard let flags = self.flags else { return }
-
-            self.notifyListener(flags)
-        }
-
-        return callbackEnabled && queueEnabled
-    }
-
-    /// Stops listening for changes in network reachability status.
-    open func stopListening() {
-        SCNetworkReachabilitySetCallback(reachability, nil, nil)
-        SCNetworkReachabilitySetDispatchQueue(reachability, nil)
-    }
-
-    // MARK: - Internal - Listener Notification
-
-    func notifyListener(_ flags: SCNetworkReachabilityFlags) {
-        guard previousFlags != flags else { return }
-        previousFlags = flags
-
-        listener?(networkReachabilityStatusForFlags(flags))
-    }
-
-    // MARK: - Internal - Network Reachability Status
-
-    func networkReachabilityStatusForFlags(_ flags: SCNetworkReachabilityFlags) -> NetworkReachabilityStatus {
-        guard isNetworkReachable(with: flags) else { return .notReachable }
-
-        var networkStatus: NetworkReachabilityStatus = .reachable(.ethernetOrWiFi)
-
-    #if os(iOS)
-        if flags.contains(.isWWAN) { networkStatus = .reachable(.wwan) }
-    #endif
-
-        return networkStatus
-    }
-
-    func isNetworkReachable(with flags: SCNetworkReachabilityFlags) -> Bool {
-        let isReachable = flags.contains(.reachable)
-        let needsConnection = flags.contains(.connectionRequired)
-        let canConnectAutomatically = flags.contains(.connectionOnDemand) || flags.contains(.connectionOnTraffic)
-        let canConnectWithoutUserInteraction = canConnectAutomatically && !flags.contains(.interventionRequired)
-
-        return isReachable && (!needsConnection || canConnectWithoutUserInteraction)
-    }
-}
-
-// MARK: -
-
-extension NetworkReachabilityManager.NetworkReachabilityStatus: Equatable {}
-
-/// Returns whether the two network reachability status values are equal.
-///
-/// - parameter lhs: The left-hand side value to compare.
-/// - parameter rhs: The right-hand side value to compare.
-///
-/// - returns: `true` if the two values are equal, `false` otherwise.
-public func ==(
-    lhs: NetworkReachabilityManager.NetworkReachabilityStatus,
-    rhs: NetworkReachabilityManager.NetworkReachabilityStatus)
-    -> Bool
-{
-    switch (lhs, rhs) {
-    case (.unknown, .unknown):
-        return true
-    case (.notReachable, .notReachable):
-        return true
-    case let (.reachable(lhsConnectionType), .reachable(rhsConnectionType)):
-        return lhsConnectionType == rhsConnectionType
-    default:
-        return false
-    }
-}
-
-#endif

+ 0 - 55
Example/Pods/Alamofire/Source/Notifications.swift

@@ -1,55 +0,0 @@
-//
-//  Notifications.swift
-//
-//  Copyright (c) 2014 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
-
-extension Notification.Name {
-    /// Used as a namespace for all `URLSessionTask` related notifications.
-    public struct Task {
-        /// Posted when a `URLSessionTask` is resumed. The notification `object` contains the resumed `URLSessionTask`.
-        public static let DidResume = Notification.Name(rawValue: "org.alamofire.notification.name.task.didResume")
-
-        /// Posted when a `URLSessionTask` is suspended. The notification `object` contains the suspended `URLSessionTask`.
-        public static let DidSuspend = Notification.Name(rawValue: "org.alamofire.notification.name.task.didSuspend")
-
-        /// Posted when a `URLSessionTask` is cancelled. The notification `object` contains the cancelled `URLSessionTask`.
-        public static let DidCancel = Notification.Name(rawValue: "org.alamofire.notification.name.task.didCancel")
-
-        /// Posted when a `URLSessionTask` is completed. The notification `object` contains the completed `URLSessionTask`.
-        public static let DidComplete = Notification.Name(rawValue: "org.alamofire.notification.name.task.didComplete")
-    }
-}
-
-// MARK: -
-
-extension Notification {
-    /// Used as a namespace for all `Notification` user info dictionary keys.
-    public struct Key {
-        /// User info dictionary key representing the `URLSessionTask` associated with the notification.
-        public static let Task = "org.alamofire.notification.key.task"
-
-        /// User info dictionary key representing the responseData associated with the notification.
-        public static let ResponseData = "org.alamofire.notification.key.responseData"
-    }
-}

+ 0 - 483
Example/Pods/Alamofire/Source/ParameterEncoding.swift

@@ -1,483 +0,0 @@
-//
-//  ParameterEncoding.swift
-//
-//  Copyright (c) 2014 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
-
-/// HTTP method definitions.
-///
-/// See https://tools.ietf.org/html/rfc7231#section-4.3
-public enum HTTPMethod: String {
-    case options = "OPTIONS"
-    case get     = "GET"
-    case head    = "HEAD"
-    case post    = "POST"
-    case put     = "PUT"
-    case patch   = "PATCH"
-    case delete  = "DELETE"
-    case trace   = "TRACE"
-    case connect = "CONNECT"
-}
-
-// MARK: -
-
-/// A dictionary of parameters to apply to a `URLRequest`.
-public typealias Parameters = [String: Any]
-
-/// A type used to define how a set of parameters are applied to a `URLRequest`.
-public protocol ParameterEncoding {
-    /// Creates a URL request by encoding parameters and applying them onto an existing request.
-    ///
-    /// - parameter urlRequest: The request to have parameters applied.
-    /// - parameter parameters: The parameters to apply.
-    ///
-    /// - throws: An `AFError.parameterEncodingFailed` error if encoding fails.
-    ///
-    /// - returns: The encoded request.
-    func encode(_ urlRequest: URLRequestConvertible, with parameters: Parameters?) throws -> URLRequest
-}
-
-// MARK: -
-
-/// Creates a url-encoded query string to be set as or appended to any existing URL query string or set as the HTTP
-/// body of the URL request. Whether the query string is set or appended to any existing URL query string or set as
-/// the HTTP body depends on the destination of the encoding.
-///
-/// The `Content-Type` HTTP header field of an encoded request with HTTP body is set to
-/// `application/x-www-form-urlencoded; charset=utf-8`.
-///
-/// There is no published specification for how to encode collection types. By default the convention of appending
-/// `[]` to the key for array values (`foo[]=1&foo[]=2`), and appending the key surrounded by square brackets for
-/// nested dictionary values (`foo[bar]=baz`) is used. Optionally, `ArrayEncoding` can be used to omit the
-/// square brackets appended to array keys.
-///
-/// `BoolEncoding` can be used to configure how boolean values are encoded. The default behavior is to encode
-/// `true` as 1 and `false` as 0.
-public struct URLEncoding: ParameterEncoding {
-
-    // MARK: Helper Types
-
-    /// Defines whether the url-encoded query string is applied to the existing query string or HTTP body of the
-    /// resulting URL request.
-    ///
-    /// - methodDependent: Applies encoded query string result to existing query string for `GET`, `HEAD` and `DELETE`
-    ///                    requests and sets as the HTTP body for requests with any other HTTP method.
-    /// - queryString:     Sets or appends encoded query string result to existing query string.
-    /// - httpBody:        Sets encoded query string result as the HTTP body of the URL request.
-    public enum Destination {
-        case methodDependent, queryString, httpBody
-    }
-
-    /// Configures how `Array` parameters are encoded.
-    ///
-    /// - brackets:        An empty set of square brackets is appended to the key for every value.
-    ///                    This is the default behavior.
-    /// - noBrackets:      No brackets are appended. The key is encoded as is.
-    public enum ArrayEncoding {
-        case brackets, noBrackets
-
-        func encode(key: String) -> String {
-            switch self {
-            case .brackets:
-                return "\(key)[]"
-            case .noBrackets:
-                return key
-            }
-        }
-    }
-
-    /// Configures how `Bool` parameters are encoded.
-    ///
-    /// - numeric:         Encode `true` as `1` and `false` as `0`. This is the default behavior.
-    /// - literal:         Encode `true` and `false` as string literals.
-    public enum BoolEncoding {
-        case numeric, literal
-
-        func encode(value: Bool) -> String {
-            switch self {
-            case .numeric:
-                return value ? "1" : "0"
-            case .literal:
-                return value ? "true" : "false"
-            }
-        }
-    }
-
-    // MARK: Properties
-
-    /// Returns a default `URLEncoding` instance.
-    public static var `default`: URLEncoding { return URLEncoding() }
-
-    /// Returns a `URLEncoding` instance with a `.methodDependent` destination.
-    public static var methodDependent: URLEncoding { return URLEncoding() }
-
-    /// Returns a `URLEncoding` instance with a `.queryString` destination.
-    public static var queryString: URLEncoding { return URLEncoding(destination: .queryString) }
-
-    /// Returns a `URLEncoding` instance with an `.httpBody` destination.
-    public static var httpBody: URLEncoding { return URLEncoding(destination: .httpBody) }
-
-    /// The destination defining where the encoded query string is to be applied to the URL request.
-    public let destination: Destination
-
-    /// The encoding to use for `Array` parameters.
-    public let arrayEncoding: ArrayEncoding
-
-    /// The encoding to use for `Bool` parameters.
-    public let boolEncoding: BoolEncoding
-
-    // MARK: Initialization
-
-    /// Creates a `URLEncoding` instance using the specified destination.
-    ///
-    /// - parameter destination: The destination defining where the encoded query string is to be applied.
-    /// - parameter arrayEncoding: The encoding to use for `Array` parameters.
-    /// - parameter boolEncoding: The encoding to use for `Bool` parameters.
-    ///
-    /// - returns: The new `URLEncoding` instance.
-    public init(destination: Destination = .methodDependent, arrayEncoding: ArrayEncoding = .brackets, boolEncoding: BoolEncoding = .numeric) {
-        self.destination = destination
-        self.arrayEncoding = arrayEncoding
-        self.boolEncoding = boolEncoding
-    }
-
-    // MARK: Encoding
-
-    /// Creates a URL request by encoding parameters and applying them onto an existing request.
-    ///
-    /// - parameter urlRequest: The request to have parameters applied.
-    /// - parameter parameters: The parameters to apply.
-    ///
-    /// - throws: An `Error` if the encoding process encounters an error.
-    ///
-    /// - returns: The encoded request.
-    public func encode(_ urlRequest: URLRequestConvertible, with parameters: Parameters?) throws -> URLRequest {
-        var urlRequest = try urlRequest.asURLRequest()
-
-        guard let parameters = parameters else { return urlRequest }
-
-        if let method = HTTPMethod(rawValue: urlRequest.httpMethod ?? "GET"), encodesParametersInURL(with: method) {
-            guard let url = urlRequest.url else {
-                throw AFError.parameterEncodingFailed(reason: .missingURL)
-            }
-
-            if var urlComponents = URLComponents(url: url, resolvingAgainstBaseURL: false), !parameters.isEmpty {
-                let percentEncodedQuery = (urlComponents.percentEncodedQuery.map { $0 + "&" } ?? "") + query(parameters)
-                urlComponents.percentEncodedQuery = percentEncodedQuery
-                urlRequest.url = urlComponents.url
-            }
-        } else {
-            if urlRequest.value(forHTTPHeaderField: "Content-Type") == nil {
-                urlRequest.setValue("application/x-www-form-urlencoded; charset=utf-8", forHTTPHeaderField: "Content-Type")
-            }
-
-            urlRequest.httpBody = query(parameters).data(using: .utf8, allowLossyConversion: false)
-        }
-
-        return urlRequest
-    }
-
-    /// Creates percent-escaped, URL encoded query string components from the given key-value pair using recursion.
-    ///
-    /// - parameter key:   The key of the query component.
-    /// - parameter value: The value of the query component.
-    ///
-    /// - returns: The percent-escaped, URL encoded query string components.
-    public func queryComponents(fromKey key: String, value: Any) -> [(String, String)] {
-        var components: [(String, String)] = []
-
-        if let dictionary = value as? [String: Any] {
-            for (nestedKey, value) in dictionary {
-                components += queryComponents(fromKey: "\(key)[\(nestedKey)]", value: value)
-            }
-        } else if let array = value as? [Any] {
-            for value in array {
-                components += queryComponents(fromKey: arrayEncoding.encode(key: key), value: value)
-            }
-        } else if let value = value as? NSNumber {
-            if value.isBool {
-                components.append((escape(key), escape(boolEncoding.encode(value: value.boolValue))))
-            } else {
-                components.append((escape(key), escape("\(value)")))
-            }
-        } else if let bool = value as? Bool {
-            components.append((escape(key), escape(boolEncoding.encode(value: bool))))
-        } else {
-            components.append((escape(key), escape("\(value)")))
-        }
-
-        return components
-    }
-
-    /// 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.
-    public func escape(_ string: String) -> String {
-        let generalDelimitersToEncode = ":#[]@" // does not include "?" or "/" due to RFC 3986 - Section 3.4
-        let subDelimitersToEncode = "!$&'()*+,;="
-
-        var allowedCharacterSet = CharacterSet.urlQueryAllowed
-        allowedCharacterSet.remove(charactersIn: "\(generalDelimitersToEncode)\(subDelimitersToEncode)")
-
-        var escaped = ""
-
-        //==========================================================================================================
-        //
-        //  Batching is required for escaping due to an internal bug in iOS 8.1 and 8.2. Encoding more than a few
-        //  hundred Chinese characters causes various malloc error crashes. To avoid this issue until iOS 8 is no
-        //  longer supported, batching MUST be used for encoding. This introduces roughly a 20% overhead. For more
-        //  info, please refer to:
-        //
-        //      - https://github.com/Alamofire/Alamofire/issues/206
-        //
-        //==========================================================================================================
-
-        if #available(iOS 8.3, *) {
-            escaped = string.addingPercentEncoding(withAllowedCharacters: allowedCharacterSet) ?? string
-        } else {
-            let batchSize = 50
-            var index = string.startIndex
-
-            while index != string.endIndex {
-                let startIndex = index
-                let endIndex = string.index(index, offsetBy: batchSize, limitedBy: string.endIndex) ?? string.endIndex
-                let range = startIndex..<endIndex
-
-                let substring = string[range]
-
-                escaped += substring.addingPercentEncoding(withAllowedCharacters: allowedCharacterSet) ?? String(substring)
-
-                index = endIndex
-            }
-        }
-
-        return escaped
-    }
-
-    private func query(_ parameters: [String: Any]) -> String {
-        var components: [(String, String)] = []
-
-        for key in parameters.keys.sorted(by: <) {
-            let value = parameters[key]!
-            components += queryComponents(fromKey: key, value: value)
-        }
-        return components.map { "\($0)=\($1)" }.joined(separator: "&")
-    }
-
-    private func encodesParametersInURL(with method: HTTPMethod) -> Bool {
-        switch destination {
-        case .queryString:
-            return true
-        case .httpBody:
-            return false
-        default:
-            break
-        }
-
-        switch method {
-        case .get, .head, .delete:
-            return true
-        default:
-            return false
-        }
-    }
-}
-
-// MARK: -
-
-/// Uses `JSONSerialization` to create a JSON representation of the parameters object, which is set as the body of the
-/// request. The `Content-Type` HTTP header field of an encoded request is set to `application/json`.
-public struct JSONEncoding: ParameterEncoding {
-
-    // MARK: Properties
-
-    /// Returns a `JSONEncoding` instance with default writing options.
-    public static var `default`: JSONEncoding { return JSONEncoding() }
-
-    /// Returns a `JSONEncoding` instance with `.prettyPrinted` writing options.
-    public static var prettyPrinted: JSONEncoding { return JSONEncoding(options: .prettyPrinted) }
-
-    /// The options for writing the parameters as JSON data.
-    public let options: JSONSerialization.WritingOptions
-
-    // MARK: Initialization
-
-    /// Creates a `JSONEncoding` instance using the specified options.
-    ///
-    /// - parameter options: The options for writing the parameters as JSON data.
-    ///
-    /// - returns: The new `JSONEncoding` instance.
-    public init(options: JSONSerialization.WritingOptions = []) {
-        self.options = options
-    }
-
-    // MARK: Encoding
-
-    /// Creates a URL request by encoding parameters and applying them onto an existing request.
-    ///
-    /// - parameter urlRequest: The request to have parameters applied.
-    /// - parameter parameters: The parameters to apply.
-    ///
-    /// - throws: An `Error` if the encoding process encounters an error.
-    ///
-    /// - returns: The encoded request.
-    public func encode(_ urlRequest: URLRequestConvertible, with parameters: Parameters?) throws -> URLRequest {
-        var urlRequest = try urlRequest.asURLRequest()
-
-        guard let parameters = parameters else { return urlRequest }
-
-        do {
-            let data = try JSONSerialization.data(withJSONObject: parameters, options: options)
-
-            if urlRequest.value(forHTTPHeaderField: "Content-Type") == nil {
-                urlRequest.setValue("application/json", forHTTPHeaderField: "Content-Type")
-            }
-
-            urlRequest.httpBody = data
-        } catch {
-            throw AFError.parameterEncodingFailed(reason: .jsonEncodingFailed(error: error))
-        }
-
-        return urlRequest
-    }
-
-    /// Creates a URL request by encoding the JSON object and setting the resulting data on the HTTP body.
-    ///
-    /// - parameter urlRequest: The request to apply the JSON object to.
-    /// - parameter jsonObject: The JSON object to apply to the request.
-    ///
-    /// - throws: An `Error` if the encoding process encounters an error.
-    ///
-    /// - returns: The encoded request.
-    public func encode(_ urlRequest: URLRequestConvertible, withJSONObject jsonObject: Any? = nil) throws -> URLRequest {
-        var urlRequest = try urlRequest.asURLRequest()
-
-        guard let jsonObject = jsonObject else { return urlRequest }
-
-        do {
-            let data = try JSONSerialization.data(withJSONObject: jsonObject, options: options)
-
-            if urlRequest.value(forHTTPHeaderField: "Content-Type") == nil {
-                urlRequest.setValue("application/json", forHTTPHeaderField: "Content-Type")
-            }
-
-            urlRequest.httpBody = data
-        } catch {
-            throw AFError.parameterEncodingFailed(reason: .jsonEncodingFailed(error: error))
-        }
-
-        return urlRequest
-    }
-}
-
-// MARK: -
-
-/// Uses `PropertyListSerialization` to create a plist representation of the parameters object, according to the
-/// associated format and write options values, which is set as the body of the request. The `Content-Type` HTTP header
-/// field of an encoded request is set to `application/x-plist`.
-public struct PropertyListEncoding: ParameterEncoding {
-
-    // MARK: Properties
-
-    /// Returns a default `PropertyListEncoding` instance.
-    public static var `default`: PropertyListEncoding { return PropertyListEncoding() }
-
-    /// Returns a `PropertyListEncoding` instance with xml formatting and default writing options.
-    public static var xml: PropertyListEncoding { return PropertyListEncoding(format: .xml) }
-
-    /// Returns a `PropertyListEncoding` instance with binary formatting and default writing options.
-    public static var binary: PropertyListEncoding { return PropertyListEncoding(format: .binary) }
-
-    /// The property list serialization format.
-    public let format: PropertyListSerialization.PropertyListFormat
-
-    /// The options for writing the parameters as plist data.
-    public let options: PropertyListSerialization.WriteOptions
-
-    // MARK: Initialization
-
-    /// Creates a `PropertyListEncoding` instance using the specified format and options.
-    ///
-    /// - parameter format:  The property list serialization format.
-    /// - parameter options: The options for writing the parameters as plist data.
-    ///
-    /// - returns: The new `PropertyListEncoding` instance.
-    public init(
-        format: PropertyListSerialization.PropertyListFormat = .xml,
-        options: PropertyListSerialization.WriteOptions = 0)
-    {
-        self.format = format
-        self.options = options
-    }
-
-    // MARK: Encoding
-
-    /// Creates a URL request by encoding parameters and applying them onto an existing request.
-    ///
-    /// - parameter urlRequest: The request to have parameters applied.
-    /// - parameter parameters: The parameters to apply.
-    ///
-    /// - throws: An `Error` if the encoding process encounters an error.
-    ///
-    /// - returns: The encoded request.
-    public func encode(_ urlRequest: URLRequestConvertible, with parameters: Parameters?) throws -> URLRequest {
-        var urlRequest = try urlRequest.asURLRequest()
-
-        guard let parameters = parameters else { return urlRequest }
-
-        do {
-            let data = try PropertyListSerialization.data(
-                fromPropertyList: parameters,
-                format: format,
-                options: options
-            )
-
-            if urlRequest.value(forHTTPHeaderField: "Content-Type") == nil {
-                urlRequest.setValue("application/x-plist", forHTTPHeaderField: "Content-Type")
-            }
-
-            urlRequest.httpBody = data
-        } catch {
-            throw AFError.parameterEncodingFailed(reason: .propertyListEncodingFailed(error: error))
-        }
-
-        return urlRequest
-    }
-}
-
-// MARK: -
-
-extension NSNumber {
-    fileprivate var isBool: Bool { return CFBooleanGetTypeID() == CFGetTypeID(self) }
-}

+ 0 - 660
Example/Pods/Alamofire/Source/Request.swift

@@ -1,660 +0,0 @@
-//
-//  Request.swift
-//
-//  Copyright (c) 2014 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
-
-/// A type that can inspect and optionally adapt a `URLRequest` in some manner if necessary.
-public protocol RequestAdapter {
-    /// Inspects and adapts the specified `URLRequest` in some manner if necessary and returns the result.
-    ///
-    /// - parameter urlRequest: The URL request to adapt.
-    ///
-    /// - throws: An `Error` if the adaptation encounters an error.
-    ///
-    /// - returns: The adapted `URLRequest`.
-    func adapt(_ urlRequest: URLRequest) throws -> URLRequest
-}
-
-// MARK: -
-
-/// A closure executed when the `RequestRetrier` determines whether a `Request` should be retried or not.
-public typealias RequestRetryCompletion = (_ shouldRetry: Bool, _ timeDelay: TimeInterval) -> Void
-
-/// A type that determines whether a request should be retried after being executed by the specified session manager
-/// and encountering an error.
-public protocol RequestRetrier {
-    /// Determines whether the `Request` should be retried by calling the `completion` closure.
-    ///
-    /// This operation is fully asynchronous. Any amount of time can be taken to determine whether the request needs
-    /// to be retried. The one requirement is that the completion closure is called to ensure the request is properly
-    /// cleaned up after.
-    ///
-    /// - parameter manager:    The session manager the request was executed on.
-    /// - parameter request:    The request that failed due to the encountered error.
-    /// - parameter error:      The error encountered when executing the request.
-    /// - parameter completion: The completion closure to be executed when retry decision has been determined.
-    func should(_ manager: SessionManager, retry request: Request, with error: Error, completion: @escaping RequestRetryCompletion)
-}
-
-// MARK: -
-
-protocol TaskConvertible {
-    func task(session: URLSession, adapter: RequestAdapter?, queue: DispatchQueue) throws -> URLSessionTask
-}
-
-/// A dictionary of headers to apply to a `URLRequest`.
-public typealias HTTPHeaders = [String: String]
-
-// MARK: -
-
-/// Responsible for sending a request and receiving the response and associated data from the server, as well as
-/// managing its underlying `URLSessionTask`.
-open class Request {
-
-    // MARK: Helper Types
-
-    /// A closure executed when monitoring upload or download progress of a request.
-    public typealias ProgressHandler = (Progress) -> Void
-
-    enum RequestTask {
-        case data(TaskConvertible?, URLSessionTask?)
-        case download(TaskConvertible?, URLSessionTask?)
-        case upload(TaskConvertible?, URLSessionTask?)
-        case stream(TaskConvertible?, URLSessionTask?)
-    }
-
-    // MARK: Properties
-
-    /// The delegate for the underlying task.
-    open internal(set) var delegate: TaskDelegate {
-        get {
-            taskDelegateLock.lock() ; defer { taskDelegateLock.unlock() }
-            return taskDelegate
-        }
-        set {
-            taskDelegateLock.lock() ; defer { taskDelegateLock.unlock() }
-            taskDelegate = newValue
-        }
-    }
-
-    /// The underlying task.
-    open var task: URLSessionTask? { return delegate.task }
-
-    /// The session belonging to the underlying task.
-    public let session: URLSession
-
-    /// The request sent or to be sent to the server.
-    open var request: URLRequest? { return task?.originalRequest }
-
-    /// The response received from the server, if any.
-    open var response: HTTPURLResponse? { return task?.response as? HTTPURLResponse }
-
-    /// The number of times the request has been retried.
-    open internal(set) var retryCount: UInt = 0
-
-    let originalTask: TaskConvertible?
-
-    var startTime: CFAbsoluteTime?
-    var endTime: CFAbsoluteTime?
-
-    var validations: [() -> Void] = []
-
-    private var taskDelegate: TaskDelegate
-    private var taskDelegateLock = NSLock()
-
-    // MARK: Lifecycle
-
-    init(session: URLSession, requestTask: RequestTask, error: Error? = nil) {
-        self.session = session
-
-        switch requestTask {
-        case .data(let originalTask, let task):
-            taskDelegate = DataTaskDelegate(task: task)
-            self.originalTask = originalTask
-        case .download(let originalTask, let task):
-            taskDelegate = DownloadTaskDelegate(task: task)
-            self.originalTask = originalTask
-        case .upload(let originalTask, let task):
-            taskDelegate = UploadTaskDelegate(task: task)
-            self.originalTask = originalTask
-        case .stream(let originalTask, let task):
-            taskDelegate = TaskDelegate(task: task)
-            self.originalTask = originalTask
-        }
-
-        delegate.error = error
-        delegate.queue.addOperation { self.endTime = CFAbsoluteTimeGetCurrent() }
-    }
-
-    // MARK: Authentication
-
-    /// Associates an HTTP Basic credential with the request.
-    ///
-    /// - parameter user:        The user.
-    /// - parameter password:    The password.
-    /// - parameter persistence: The URL credential persistence. `.ForSession` by default.
-    ///
-    /// - returns: The request.
-    @discardableResult
-    open func authenticate(
-        user: String,
-        password: String,
-        persistence: URLCredential.Persistence = .forSession)
-        -> Self
-    {
-        let credential = URLCredential(user: user, password: password, persistence: persistence)
-        return authenticate(usingCredential: credential)
-    }
-
-    /// Associates a specified credential with the request.
-    ///
-    /// - parameter credential: The credential.
-    ///
-    /// - returns: The request.
-    @discardableResult
-    open func authenticate(usingCredential credential: URLCredential) -> Self {
-        delegate.credential = credential
-        return self
-    }
-
-    /// Returns a base64 encoded basic authentication credential as an authorization header tuple.
-    ///
-    /// - parameter user:     The user.
-    /// - parameter password: The password.
-    ///
-    /// - returns: A tuple with Authorization header and credential value if encoding succeeds, `nil` otherwise.
-    open class func authorizationHeader(user: String, password: String) -> (key: String, value: String)? {
-        guard let data = "\(user):\(password)".data(using: .utf8) else { return nil }
-
-        let credential = data.base64EncodedString(options: [])
-
-        return (key: "Authorization", value: "Basic \(credential)")
-    }
-
-    // MARK: State
-
-    /// Resumes the request.
-    open func resume() {
-        guard let task = task else { delegate.queue.isSuspended = false ; return }
-
-        if startTime == nil { startTime = CFAbsoluteTimeGetCurrent() }
-
-        task.resume()
-
-        NotificationCenter.default.post(
-            name: Notification.Name.Task.DidResume,
-            object: self,
-            userInfo: [Notification.Key.Task: task]
-        )
-    }
-
-    /// Suspends the request.
-    open func suspend() {
-        guard let task = task else { return }
-
-        task.suspend()
-
-        NotificationCenter.default.post(
-            name: Notification.Name.Task.DidSuspend,
-            object: self,
-            userInfo: [Notification.Key.Task: task]
-        )
-    }
-
-    /// Cancels the request.
-    open func cancel() {
-        guard let task = task else { return }
-
-        task.cancel()
-
-        NotificationCenter.default.post(
-            name: Notification.Name.Task.DidCancel,
-            object: self,
-            userInfo: [Notification.Key.Task: task]
-        )
-    }
-}
-
-// MARK: - CustomStringConvertible
-
-extension Request: CustomStringConvertible {
-    /// The textual representation used when written to an output stream, which includes the HTTP method and URL, as
-    /// well as the response status code if a response has been received.
-    open var description: String {
-        var components: [String] = []
-
-        if let HTTPMethod = request?.httpMethod {
-            components.append(HTTPMethod)
-        }
-
-        if let urlString = request?.url?.absoluteString {
-            components.append(urlString)
-        }
-
-        if let response = response {
-            components.append("(\(response.statusCode))")
-        }
-
-        return components.joined(separator: " ")
-    }
-}
-
-// MARK: - CustomDebugStringConvertible
-
-extension Request: CustomDebugStringConvertible {
-    /// The textual representation used when written to an output stream, in the form of a cURL command.
-    open var debugDescription: String {
-        return cURLRepresentation()
-    }
-
-    func cURLRepresentation() -> String {
-        var components = ["$ curl -v"]
-
-        guard let request = self.request,
-              let url = request.url,
-              let host = url.host
-        else {
-            return "$ curl command could not be created"
-        }
-
-        if let httpMethod = request.httpMethod, httpMethod != "GET" {
-            components.append("-X \(httpMethod)")
-        }
-
-        if let credentialStorage = self.session.configuration.urlCredentialStorage {
-            let protectionSpace = URLProtectionSpace(
-                host: host,
-                port: url.port ?? 0,
-                protocol: url.scheme,
-                realm: host,
-                authenticationMethod: NSURLAuthenticationMethodHTTPBasic
-            )
-
-            if let credentials = credentialStorage.credentials(for: protectionSpace)?.values {
-                for credential in credentials {
-                    guard let user = credential.user, let password = credential.password else { continue }
-                    components.append("-u \(user):\(password)")
-                }
-            } else {
-                if let credential = delegate.credential, let user = credential.user, let password = credential.password {
-                    components.append("-u \(user):\(password)")
-                }
-            }
-        }
-
-        if session.configuration.httpShouldSetCookies {
-            if
-                let cookieStorage = session.configuration.httpCookieStorage,
-                let cookies = cookieStorage.cookies(for: url), !cookies.isEmpty
-            {
-                let string = cookies.reduce("") { $0 + "\($1.name)=\($1.value);" }
-
-            #if swift(>=3.2)
-                components.append("-b \"\(string[..<string.index(before: string.endIndex)])\"")
-            #else
-                components.append("-b \"\(string.substring(to: string.characters.index(before: string.endIndex)))\"")
-            #endif
-            }
-        }
-
-        var headers: [AnyHashable: Any] = [:]
-
-        session.configuration.httpAdditionalHeaders?.filter {  $0.0 != AnyHashable("Cookie") }
-                                                    .forEach { headers[$0.0] = $0.1 }
-
-        request.allHTTPHeaderFields?.filter { $0.0 != "Cookie" }
-                                    .forEach { headers[$0.0] = $0.1 }
-
-        components += headers.map {
-            let escapedValue = String(describing: $0.value).replacingOccurrences(of: "\"", with: "\\\"")
-
-            return "-H \"\($0.key): \(escapedValue)\""
-        }
-
-        if let httpBodyData = request.httpBody, let httpBody = String(data: httpBodyData, encoding: .utf8) {
-            var escapedBody = httpBody.replacingOccurrences(of: "\\\"", with: "\\\\\"")
-            escapedBody = escapedBody.replacingOccurrences(of: "\"", with: "\\\"")
-
-            components.append("-d \"\(escapedBody)\"")
-        }
-
-        components.append("\"\(url.absoluteString)\"")
-
-        return components.joined(separator: " \\\n\t")
-    }
-}
-
-// MARK: -
-
-/// Specific type of `Request` that manages an underlying `URLSessionDataTask`.
-open class DataRequest: Request {
-
-    // MARK: Helper Types
-
-    struct Requestable: TaskConvertible {
-        let urlRequest: URLRequest
-
-        func task(session: URLSession, adapter: RequestAdapter?, queue: DispatchQueue) throws -> URLSessionTask {
-            do {
-                let urlRequest = try self.urlRequest.adapt(using: adapter)
-                return queue.sync { session.dataTask(with: urlRequest) }
-            } catch {
-                throw AdaptError(error: error)
-            }
-        }
-    }
-
-    // MARK: Properties
-
-    /// The request sent or to be sent to the server.
-    open override var request: URLRequest? {
-        if let request = super.request { return request }
-        if let requestable = originalTask as? Requestable { return requestable.urlRequest }
-
-        return nil
-    }
-
-    /// The progress of fetching the response data from the server for the request.
-    open var progress: Progress { return dataDelegate.progress }
-
-    var dataDelegate: DataTaskDelegate { return delegate as! DataTaskDelegate }
-
-    // MARK: Stream
-
-    /// Sets a closure to be called periodically during the lifecycle of the request as data is read from the server.
-    ///
-    /// This closure returns the bytes most recently received from the server, not including data from previous calls.
-    /// If this closure is set, data will only be available within this closure, and will not be saved elsewhere. It is
-    /// also important to note that the server data in any `Response` object will be `nil`.
-    ///
-    /// - parameter closure: The code to be executed periodically during the lifecycle of the request.
-    ///
-    /// - returns: The request.
-    @discardableResult
-    open func stream(closure: ((Data) -> Void)? = nil) -> Self {
-        dataDelegate.dataStream = closure
-        return self
-    }
-
-    // MARK: Progress
-
-    /// Sets a closure to be called periodically during the lifecycle of the `Request` as data is read from the server.
-    ///
-    /// - parameter queue:   The dispatch queue to execute the closure on.
-    /// - parameter closure: The code to be executed periodically as data is read from the server.
-    ///
-    /// - returns: The request.
-    @discardableResult
-    open func downloadProgress(queue: DispatchQueue = DispatchQueue.main, closure: @escaping ProgressHandler) -> Self {
-        dataDelegate.progressHandler = (closure, queue)
-        return self
-    }
-}
-
-// MARK: -
-
-/// Specific type of `Request` that manages an underlying `URLSessionDownloadTask`.
-open class DownloadRequest: Request {
-
-    // MARK: Helper Types
-
-    /// A collection of options to be executed prior to moving a downloaded file from the temporary URL to the
-    /// destination URL.
-    public struct DownloadOptions: OptionSet {
-        /// Returns the raw bitmask value of the option and satisfies the `RawRepresentable` protocol.
-        public let rawValue: UInt
-
-        /// A `DownloadOptions` flag that creates intermediate directories for the destination URL if specified.
-        public static let createIntermediateDirectories = DownloadOptions(rawValue: 1 << 0)
-
-        /// A `DownloadOptions` flag that removes a previous file from the destination URL if specified.
-        public static let removePreviousFile = DownloadOptions(rawValue: 1 << 1)
-
-        /// Creates a `DownloadFileDestinationOptions` instance with the specified raw value.
-        ///
-        /// - parameter rawValue: The raw bitmask value for the option.
-        ///
-        /// - returns: A new log level instance.
-        public init(rawValue: UInt) {
-            self.rawValue = rawValue
-        }
-    }
-
-    /// A closure executed once a download request has successfully completed in order to determine where to move the
-    /// temporary file written to during the download process. The closure takes two arguments: the temporary file URL
-    /// and the URL response, and returns a two arguments: the file URL where the temporary file should be moved and
-    /// the options defining how the file should be moved.
-    public typealias DownloadFileDestination = (
-        _ temporaryURL: URL,
-        _ response: HTTPURLResponse)
-        -> (destinationURL: URL, options: DownloadOptions)
-
-    enum Downloadable: TaskConvertible {
-        case request(URLRequest)
-        case resumeData(Data)
-
-        func task(session: URLSession, adapter: RequestAdapter?, queue: DispatchQueue) throws -> URLSessionTask {
-            do {
-                let task: URLSessionTask
-
-                switch self {
-                case let .request(urlRequest):
-                    let urlRequest = try urlRequest.adapt(using: adapter)
-                    task = queue.sync { session.downloadTask(with: urlRequest) }
-                case let .resumeData(resumeData):
-                    task = queue.sync { session.downloadTask(withResumeData: resumeData) }
-                }
-
-                return task
-            } catch {
-                throw AdaptError(error: error)
-            }
-        }
-    }
-
-    // MARK: Properties
-
-    /// The request sent or to be sent to the server.
-    open override var request: URLRequest? {
-        if let request = super.request { return request }
-
-        if let downloadable = originalTask as? Downloadable, case let .request(urlRequest) = downloadable {
-            return urlRequest
-        }
-
-        return nil
-    }
-
-    /// The resume data of the underlying download task if available after a failure.
-    open var resumeData: Data? { return downloadDelegate.resumeData }
-
-    /// The progress of downloading the response data from the server for the request.
-    open var progress: Progress { return downloadDelegate.progress }
-
-    var downloadDelegate: DownloadTaskDelegate { return delegate as! DownloadTaskDelegate }
-
-    // MARK: State
-
-    /// Cancels the request.
-    override open func cancel() {
-        cancel(createResumeData: true)
-    }
-
-    /// Cancels the request.
-    ///
-    /// - parameter createResumeData: Determines whether resume data is created via the underlying download task or not.
-    open func cancel(createResumeData: Bool) {
-        if createResumeData {
-            downloadDelegate.downloadTask.cancel { self.downloadDelegate.resumeData = $0 }
-        } else {
-            downloadDelegate.downloadTask.cancel()
-        }
-
-        NotificationCenter.default.post(
-            name: Notification.Name.Task.DidCancel,
-            object: self,
-            userInfo: [Notification.Key.Task: task as Any]
-        )
-    }
-
-    // MARK: Progress
-
-    /// Sets a closure to be called periodically during the lifecycle of the `Request` as data is read from the server.
-    ///
-    /// - parameter queue:   The dispatch queue to execute the closure on.
-    /// - parameter closure: The code to be executed periodically as data is read from the server.
-    ///
-    /// - returns: The request.
-    @discardableResult
-    open func downloadProgress(queue: DispatchQueue = DispatchQueue.main, closure: @escaping ProgressHandler) -> Self {
-        downloadDelegate.progressHandler = (closure, queue)
-        return self
-    }
-
-    // MARK: Destination
-
-    /// Creates a download file destination closure which uses the default file manager to move the temporary file to a
-    /// file URL in the first available directory with the specified search path directory and search path domain mask.
-    ///
-    /// - parameter directory: The search path directory. `.DocumentDirectory` by default.
-    /// - parameter domain:    The search path domain mask. `.UserDomainMask` by default.
-    ///
-    /// - returns: A download file destination closure.
-    open class func suggestedDownloadDestination(
-        for directory: FileManager.SearchPathDirectory = .documentDirectory,
-        in domain: FileManager.SearchPathDomainMask = .userDomainMask)
-        -> DownloadFileDestination
-    {
-        return { temporaryURL, response in
-            let directoryURLs = FileManager.default.urls(for: directory, in: domain)
-
-            if !directoryURLs.isEmpty {
-                return (directoryURLs[0].appendingPathComponent(response.suggestedFilename!), [])
-            }
-
-            return (temporaryURL, [])
-        }
-    }
-}
-
-// MARK: -
-
-/// Specific type of `Request` that manages an underlying `URLSessionUploadTask`.
-open class UploadRequest: DataRequest {
-
-    // MARK: Helper Types
-
-    enum Uploadable: TaskConvertible {
-        case data(Data, URLRequest)
-        case file(URL, URLRequest)
-        case stream(InputStream, URLRequest)
-
-        func task(session: URLSession, adapter: RequestAdapter?, queue: DispatchQueue) throws -> URLSessionTask {
-            do {
-                let task: URLSessionTask
-
-                switch self {
-                case let .data(data, urlRequest):
-                    let urlRequest = try urlRequest.adapt(using: adapter)
-                    task = queue.sync { session.uploadTask(with: urlRequest, from: data) }
-                case let .file(url, urlRequest):
-                    let urlRequest = try urlRequest.adapt(using: adapter)
-                    task = queue.sync { session.uploadTask(with: urlRequest, fromFile: url) }
-                case let .stream(_, urlRequest):
-                    let urlRequest = try urlRequest.adapt(using: adapter)
-                    task = queue.sync { session.uploadTask(withStreamedRequest: urlRequest) }
-                }
-
-                return task
-            } catch {
-                throw AdaptError(error: error)
-            }
-        }
-    }
-
-    // MARK: Properties
-
-    /// The request sent or to be sent to the server.
-    open override var request: URLRequest? {
-        if let request = super.request { return request }
-
-        guard let uploadable = originalTask as? Uploadable else { return nil }
-
-        switch uploadable {
-        case .data(_, let urlRequest), .file(_, let urlRequest), .stream(_, let urlRequest):
-            return urlRequest
-        }
-    }
-
-    /// The progress of uploading the payload to the server for the upload request.
-    open var uploadProgress: Progress { return uploadDelegate.uploadProgress }
-
-    var uploadDelegate: UploadTaskDelegate { return delegate as! UploadTaskDelegate }
-
-    // MARK: Upload Progress
-
-    /// Sets a closure to be called periodically during the lifecycle of the `UploadRequest` as data is sent to
-    /// the server.
-    ///
-    /// After the data is sent to the server, the `progress(queue:closure:)` APIs can be used to monitor the progress
-    /// of data being read from the server.
-    ///
-    /// - parameter queue:   The dispatch queue to execute the closure on.
-    /// - parameter closure: The code to be executed periodically as data is sent to the server.
-    ///
-    /// - returns: The request.
-    @discardableResult
-    open func uploadProgress(queue: DispatchQueue = DispatchQueue.main, closure: @escaping ProgressHandler) -> Self {
-        uploadDelegate.uploadProgressHandler = (closure, queue)
-        return self
-    }
-}
-
-// MARK: -
-
-#if !os(watchOS)
-
-/// Specific type of `Request` that manages an underlying `URLSessionStreamTask`.
-@available(iOS 9.0, macOS 10.11, tvOS 9.0, *)
-open class StreamRequest: Request {
-    enum Streamable: TaskConvertible {
-        case stream(hostName: String, port: Int)
-        case netService(NetService)
-
-        func task(session: URLSession, adapter: RequestAdapter?, queue: DispatchQueue) throws -> URLSessionTask {
-            let task: URLSessionTask
-
-            switch self {
-            case let .stream(hostName, port):
-                task = queue.sync { session.streamTask(withHostName: hostName, port: port) }
-            case let .netService(netService):
-                task = queue.sync { session.streamTask(with: netService) }
-            }
-
-            return task
-        }
-    }
-}
-
-#endif

+ 0 - 574
Example/Pods/Alamofire/Source/Response.swift

@@ -1,574 +0,0 @@
-//
-//  Response.swift
-//
-//  Copyright (c) 2014 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
-
-/// Used to store all data associated with an non-serialized response of a data or upload request.
-public struct DefaultDataResponse {
-    /// The URL request sent to the server.
-    public let request: URLRequest?
-
-    /// The server's response to the URL request.
-    public let response: HTTPURLResponse?
-
-    /// The data returned by the server.
-    public let data: Data?
-
-    /// The error encountered while executing or validating the request.
-    public let error: Error?
-
-    /// The timeline of the complete lifecycle of the request.
-    public let timeline: Timeline
-
-    var _metrics: AnyObject?
-
-    /// Creates a `DefaultDataResponse` instance from the specified parameters.
-    ///
-    /// - Parameters:
-    ///   - request:  The URL request sent to the server.
-    ///   - response: The server's response to the URL request.
-    ///   - data:     The data returned by the server.
-    ///   - error:    The error encountered while executing or validating the request.
-    ///   - timeline: The timeline of the complete lifecycle of the request. `Timeline()` by default.
-    ///   - metrics:  The task metrics containing the request / response statistics. `nil` by default.
-    public init(
-        request: URLRequest?,
-        response: HTTPURLResponse?,
-        data: Data?,
-        error: Error?,
-        timeline: Timeline = Timeline(),
-        metrics: AnyObject? = nil)
-    {
-        self.request = request
-        self.response = response
-        self.data = data
-        self.error = error
-        self.timeline = timeline
-    }
-}
-
-// MARK: -
-
-/// Used to store all data associated with a serialized response of a data or upload request.
-public struct DataResponse<Value> {
-    /// The URL request sent to the server.
-    public let request: URLRequest?
-
-    /// The server's response to the URL request.
-    public let response: HTTPURLResponse?
-
-    /// The data returned by the server.
-    public let data: Data?
-
-    /// The result of response serialization.
-    public let result: Result<Value>
-
-    /// The timeline of the complete lifecycle of the request.
-    public let timeline: Timeline
-
-    /// Returns the associated value of the result if it is a success, `nil` otherwise.
-    public var value: Value? { return result.value }
-
-    /// Returns the associated error value if the result if it is a failure, `nil` otherwise.
-    public var error: Error? { return result.error }
-
-    var _metrics: AnyObject?
-
-    /// Creates a `DataResponse` instance with the specified parameters derived from response serialization.
-    ///
-    /// - parameter request:  The URL request sent to the server.
-    /// - parameter response: The server's response to the URL request.
-    /// - parameter data:     The data returned by the server.
-    /// - parameter result:   The result of response serialization.
-    /// - parameter timeline: The timeline of the complete lifecycle of the `Request`. Defaults to `Timeline()`.
-    ///
-    /// - returns: The new `DataResponse` instance.
-    public init(
-        request: URLRequest?,
-        response: HTTPURLResponse?,
-        data: Data?,
-        result: Result<Value>,
-        timeline: Timeline = Timeline())
-    {
-        self.request = request
-        self.response = response
-        self.data = data
-        self.result = result
-        self.timeline = timeline
-    }
-}
-
-// MARK: -
-
-extension DataResponse: CustomStringConvertible, CustomDebugStringConvertible {
-    /// The textual representation used when written to an output stream, which includes whether the result was a
-    /// success or failure.
-    public var description: String {
-        return result.debugDescription
-    }
-
-    /// The debug textual representation used when written to an output stream, which includes the URL request, the URL
-    /// response, the server data, the response serialization result and the timeline.
-    public var debugDescription: String {
-        let requestDescription = request.map { "\($0.httpMethod ?? "GET") \($0)"} ?? "nil"
-        let requestBody = request?.httpBody.map { String(decoding: $0, as: UTF8.self) } ?? "None"
-        let responseDescription = response.map { "\($0)" } ?? "nil"
-        let responseBody = data.map { String(decoding: $0, as: UTF8.self) } ?? "None"
-
-        return """
-        [Request]: \(requestDescription)
-        [Request Body]: \n\(requestBody)
-        [Response]: \(responseDescription)
-        [Response Body]: \n\(responseBody)
-        [Result]: \(result)
-        [Timeline]: \(timeline.debugDescription)
-        """
-    }
-}
-
-// MARK: -
-
-extension DataResponse {
-    /// Evaluates the specified closure when the result of this `DataResponse` is a success, passing the unwrapped
-    /// result value as a parameter.
-    ///
-    /// Use the `map` method with a closure that does not throw. For example:
-    ///
-    ///     let possibleData: DataResponse<Data> = ...
-    ///     let possibleInt = possibleData.map { $0.count }
-    ///
-    /// - parameter transform: A closure that takes the success value of the instance's result.
-    ///
-    /// - returns: A `DataResponse` whose result wraps the value returned by the given closure. If this instance's
-    ///            result is a failure, returns a response wrapping the same failure.
-    public func map<T>(_ transform: (Value) -> T) -> DataResponse<T> {
-        var response = DataResponse<T>(
-            request: request,
-            response: self.response,
-            data: data,
-            result: result.map(transform),
-            timeline: timeline
-        )
-
-        response._metrics = _metrics
-
-        return response
-    }
-
-    /// Evaluates the given closure when the result of this `DataResponse` is a success, passing the unwrapped result
-    /// value as a parameter.
-    ///
-    /// Use the `flatMap` method with a closure that may throw an error. For example:
-    ///
-    ///     let possibleData: DataResponse<Data> = ...
-    ///     let possibleObject = possibleData.flatMap {
-    ///         try JSONSerialization.jsonObject(with: $0)
-    ///     }
-    ///
-    /// - parameter transform: A closure that takes the success value of the instance's result.
-    ///
-    /// - returns: A success or failure `DataResponse` depending on the result of the given closure. If this instance's
-    ///            result is a failure, returns the same failure.
-    public func flatMap<T>(_ transform: (Value) throws -> T) -> DataResponse<T> {
-        var response = DataResponse<T>(
-            request: request,
-            response: self.response,
-            data: data,
-            result: result.flatMap(transform),
-            timeline: timeline
-        )
-
-        response._metrics = _metrics
-
-        return response
-    }
-
-    /// Evaluates the specified closure when the `DataResponse` is a failure, passing the unwrapped error as a parameter.
-    ///
-    /// Use the `mapError` function with a closure that does not throw. For example:
-    ///
-    ///     let possibleData: DataResponse<Data> = ...
-    ///     let withMyError = possibleData.mapError { MyError.error($0) }
-    ///
-    /// - Parameter transform: A closure that takes the error of the instance.
-    /// - Returns: A `DataResponse` instance containing the result of the transform.
-    public func mapError<E: Error>(_ transform: (Error) -> E) -> DataResponse {
-        var response = DataResponse(
-            request: request,
-            response: self.response,
-            data: data,
-            result: result.mapError(transform),
-            timeline: timeline
-        )
-
-        response._metrics = _metrics
-
-        return response
-    }
-
-    /// Evaluates the specified closure when the `DataResponse` is a failure, passing the unwrapped error as a parameter.
-    ///
-    /// Use the `flatMapError` function with a closure that may throw an error. For example:
-    ///
-    ///     let possibleData: DataResponse<Data> = ...
-    ///     let possibleObject = possibleData.flatMapError {
-    ///         try someFailableFunction(taking: $0)
-    ///     }
-    ///
-    /// - Parameter transform: A throwing closure that takes the error of the instance.
-    ///
-    /// - Returns: A `DataResponse` instance containing the result of the transform.
-    public func flatMapError<E: Error>(_ transform: (Error) throws -> E) -> DataResponse {
-        var response = DataResponse(
-            request: request,
-            response: self.response,
-            data: data,
-            result: result.flatMapError(transform),
-            timeline: timeline
-        )
-
-        response._metrics = _metrics
-
-        return response
-    }
-}
-
-// MARK: -
-
-/// Used to store all data associated with an non-serialized response of a download request.
-public struct DefaultDownloadResponse {
-    /// The URL request sent to the server.
-    public let request: URLRequest?
-
-    /// The server's response to the URL request.
-    public let response: HTTPURLResponse?
-
-    /// The temporary destination URL of the data returned from the server.
-    public let temporaryURL: URL?
-
-    /// The final destination URL of the data returned from the server if it was moved.
-    public let destinationURL: URL?
-
-    /// The resume data generated if the request was cancelled.
-    public let resumeData: Data?
-
-    /// The error encountered while executing or validating the request.
-    public let error: Error?
-
-    /// The timeline of the complete lifecycle of the request.
-    public let timeline: Timeline
-
-    var _metrics: AnyObject?
-
-    /// Creates a `DefaultDownloadResponse` instance from the specified parameters.
-    ///
-    /// - Parameters:
-    ///   - request:        The URL request sent to the server.
-    ///   - response:       The server's response to the URL request.
-    ///   - temporaryURL:   The temporary destination URL of the data returned from the server.
-    ///   - destinationURL: The final destination URL of the data returned from the server if it was moved.
-    ///   - resumeData:     The resume data generated if the request was cancelled.
-    ///   - error:          The error encountered while executing or validating the request.
-    ///   - timeline:       The timeline of the complete lifecycle of the request. `Timeline()` by default.
-    ///   - metrics:        The task metrics containing the request / response statistics. `nil` by default.
-    public init(
-        request: URLRequest?,
-        response: HTTPURLResponse?,
-        temporaryURL: URL?,
-        destinationURL: URL?,
-        resumeData: Data?,
-        error: Error?,
-        timeline: Timeline = Timeline(),
-        metrics: AnyObject? = nil)
-    {
-        self.request = request
-        self.response = response
-        self.temporaryURL = temporaryURL
-        self.destinationURL = destinationURL
-        self.resumeData = resumeData
-        self.error = error
-        self.timeline = timeline
-    }
-}
-
-// MARK: -
-
-/// Used to store all data associated with a serialized response of a download request.
-public struct DownloadResponse<Value> {
-    /// The URL request sent to the server.
-    public let request: URLRequest?
-
-    /// The server's response to the URL request.
-    public let response: HTTPURLResponse?
-
-    /// The temporary destination URL of the data returned from the server.
-    public let temporaryURL: URL?
-
-    /// The final destination URL of the data returned from the server if it was moved.
-    public let destinationURL: URL?
-
-    /// The resume data generated if the request was cancelled.
-    public let resumeData: Data?
-
-    /// The result of response serialization.
-    public let result: Result<Value>
-
-    /// The timeline of the complete lifecycle of the request.
-    public let timeline: Timeline
-
-    /// Returns the associated value of the result if it is a success, `nil` otherwise.
-    public var value: Value? { return result.value }
-
-    /// Returns the associated error value if the result if it is a failure, `nil` otherwise.
-    public var error: Error? { return result.error }
-
-    var _metrics: AnyObject?
-
-    /// Creates a `DownloadResponse` instance with the specified parameters derived from response serialization.
-    ///
-    /// - parameter request:        The URL request sent to the server.
-    /// - parameter response:       The server's response to the URL request.
-    /// - parameter temporaryURL:   The temporary destination URL of the data returned from the server.
-    /// - parameter destinationURL: The final destination URL of the data returned from the server if it was moved.
-    /// - parameter resumeData:     The resume data generated if the request was cancelled.
-    /// - parameter result:         The result of response serialization.
-    /// - parameter timeline:       The timeline of the complete lifecycle of the `Request`. Defaults to `Timeline()`.
-    ///
-    /// - returns: The new `DownloadResponse` instance.
-    public init(
-        request: URLRequest?,
-        response: HTTPURLResponse?,
-        temporaryURL: URL?,
-        destinationURL: URL?,
-        resumeData: Data?,
-        result: Result<Value>,
-        timeline: Timeline = Timeline())
-    {
-        self.request = request
-        self.response = response
-        self.temporaryURL = temporaryURL
-        self.destinationURL = destinationURL
-        self.resumeData = resumeData
-        self.result = result
-        self.timeline = timeline
-    }
-}
-
-// MARK: -
-
-extension DownloadResponse: CustomStringConvertible, CustomDebugStringConvertible {
-    /// The textual representation used when written to an output stream, which includes whether the result was a
-    /// success or failure.
-    public var description: String {
-        return result.debugDescription
-    }
-
-    /// The debug textual representation used when written to an output stream, which includes the URL request, the URL
-    /// response, the temporary and destination URLs, the resume data, the response serialization result and the
-    /// timeline.
-    public var debugDescription: String {
-        let requestDescription = request.map { "\($0.httpMethod ?? "GET") \($0)"} ?? "nil"
-        let requestBody = request?.httpBody.map { String(decoding: $0, as: UTF8.self) } ?? "None"
-        let responseDescription = response.map { "\($0)" } ?? "nil"
-
-        return """
-        [Request]: \(requestDescription)
-        [Request Body]: \n\(requestBody)
-        [Response]: \(responseDescription)
-        [TemporaryURL]: \(temporaryURL?.path ?? "nil")
-        [DestinationURL]: \(destinationURL?.path ?? "nil")
-        [ResumeData]: \(resumeData?.count ?? 0) bytes
-        [Result]: \(result)
-        [Timeline]: \(timeline.debugDescription)
-        """
-    }
-}
-
-// MARK: -
-
-extension DownloadResponse {
-    /// Evaluates the given closure when the result of this `DownloadResponse` is a success, passing the unwrapped
-    /// result value as a parameter.
-    ///
-    /// Use the `map` method with a closure that does not throw. For example:
-    ///
-    ///     let possibleData: DownloadResponse<Data> = ...
-    ///     let possibleInt = possibleData.map { $0.count }
-    ///
-    /// - parameter transform: A closure that takes the success value of the instance's result.
-    ///
-    /// - returns: A `DownloadResponse` whose result wraps the value returned by the given closure. If this instance's
-    ///            result is a failure, returns a response wrapping the same failure.
-    public func map<T>(_ transform: (Value) -> T) -> DownloadResponse<T> {
-        var response = DownloadResponse<T>(
-            request: request,
-            response: self.response,
-            temporaryURL: temporaryURL,
-            destinationURL: destinationURL,
-            resumeData: resumeData,
-            result: result.map(transform),
-            timeline: timeline
-        )
-
-        response._metrics = _metrics
-
-        return response
-    }
-
-    /// Evaluates the given closure when the result of this `DownloadResponse` is a success, passing the unwrapped
-    /// result value as a parameter.
-    ///
-    /// Use the `flatMap` method with a closure that may throw an error. For example:
-    ///
-    ///     let possibleData: DownloadResponse<Data> = ...
-    ///     let possibleObject = possibleData.flatMap {
-    ///         try JSONSerialization.jsonObject(with: $0)
-    ///     }
-    ///
-    /// - parameter transform: A closure that takes the success value of the instance's result.
-    ///
-    /// - returns: A success or failure `DownloadResponse` depending on the result of the given closure. If this
-    /// instance's result is a failure, returns the same failure.
-    public func flatMap<T>(_ transform: (Value) throws -> T) -> DownloadResponse<T> {
-        var response = DownloadResponse<T>(
-            request: request,
-            response: self.response,
-            temporaryURL: temporaryURL,
-            destinationURL: destinationURL,
-            resumeData: resumeData,
-            result: result.flatMap(transform),
-            timeline: timeline
-        )
-
-        response._metrics = _metrics
-
-        return response
-    }
-
-    /// Evaluates the specified closure when the `DownloadResponse` is a failure, passing the unwrapped error as a parameter.
-    ///
-    /// Use the `mapError` function with a closure that does not throw. For example:
-    ///
-    ///     let possibleData: DownloadResponse<Data> = ...
-    ///     let withMyError = possibleData.mapError { MyError.error($0) }
-    ///
-    /// - Parameter transform: A closure that takes the error of the instance.
-    /// - Returns: A `DownloadResponse` instance containing the result of the transform.
-    public func mapError<E: Error>(_ transform: (Error) -> E) -> DownloadResponse {
-        var response = DownloadResponse(
-            request: request,
-            response: self.response,
-            temporaryURL: temporaryURL,
-            destinationURL: destinationURL,
-            resumeData: resumeData,
-            result: result.mapError(transform),
-            timeline: timeline
-        )
-
-        response._metrics = _metrics
-
-        return response
-    }
-
-    /// Evaluates the specified closure when the `DownloadResponse` is a failure, passing the unwrapped error as a parameter.
-    ///
-    /// Use the `flatMapError` function with a closure that may throw an error. For example:
-    ///
-    ///     let possibleData: DownloadResponse<Data> = ...
-    ///     let possibleObject = possibleData.flatMapError {
-    ///         try someFailableFunction(taking: $0)
-    ///     }
-    ///
-    /// - Parameter transform: A throwing closure that takes the error of the instance.
-    ///
-    /// - Returns: A `DownloadResponse` instance containing the result of the transform.
-    public func flatMapError<E: Error>(_ transform: (Error) throws -> E) -> DownloadResponse {
-        var response = DownloadResponse(
-            request: request,
-            response: self.response,
-            temporaryURL: temporaryURL,
-            destinationURL: destinationURL,
-            resumeData: resumeData,
-            result: result.flatMapError(transform),
-            timeline: timeline
-        )
-
-        response._metrics = _metrics
-
-        return response
-    }
-}
-
-// MARK: -
-
-protocol Response {
-    /// The task metrics containing the request / response statistics.
-    var _metrics: AnyObject? { get set }
-    mutating func add(_ metrics: AnyObject?)
-}
-
-extension Response {
-    mutating func add(_ metrics: AnyObject?) {
-        #if !os(watchOS)
-            guard #available(iOS 10.0, macOS 10.12, tvOS 10.0, *) else { return }
-            guard let metrics = metrics as? URLSessionTaskMetrics else { return }
-
-            _metrics = metrics
-        #endif
-    }
-}
-
-// MARK: -
-
-@available(iOS 10.0, macOS 10.12, tvOS 10.0, *)
-extension DefaultDataResponse: Response {
-#if !os(watchOS)
-    /// The task metrics containing the request / response statistics.
-    public var metrics: URLSessionTaskMetrics? { return _metrics as? URLSessionTaskMetrics }
-#endif
-}
-
-@available(iOS 10.0, macOS 10.12, tvOS 10.0, *)
-extension DataResponse: Response {
-#if !os(watchOS)
-    /// The task metrics containing the request / response statistics.
-    public var metrics: URLSessionTaskMetrics? { return _metrics as? URLSessionTaskMetrics }
-#endif
-}
-
-@available(iOS 10.0, macOS 10.12, tvOS 10.0, *)
-extension DefaultDownloadResponse: Response {
-#if !os(watchOS)
-    /// The task metrics containing the request / response statistics.
-    public var metrics: URLSessionTaskMetrics? { return _metrics as? URLSessionTaskMetrics }
-#endif
-}
-
-@available(iOS 10.0, macOS 10.12, tvOS 10.0, *)
-extension DownloadResponse: Response {
-#if !os(watchOS)
-    /// The task metrics containing the request / response statistics.
-    public var metrics: URLSessionTaskMetrics? { return _metrics as? URLSessionTaskMetrics }
-#endif
-}

+ 0 - 715
Example/Pods/Alamofire/Source/ResponseSerialization.swift

@@ -1,715 +0,0 @@
-//
-//  ResponseSerialization.swift
-//
-//  Copyright (c) 2014 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
-
-/// The type in which all data response serializers must conform to in order to serialize a response.
-public protocol DataResponseSerializerProtocol {
-    /// The type of serialized object to be created by this `DataResponseSerializerType`.
-    associatedtype SerializedObject
-
-    /// A closure used by response handlers that takes a request, response, data and error and returns a result.
-    var serializeResponse: (URLRequest?, HTTPURLResponse?, Data?, Error?) -> Result<SerializedObject> { get }
-}
-
-// MARK: -
-
-/// A generic `DataResponseSerializerType` used to serialize a request, response, and data into a serialized object.
-public struct DataResponseSerializer<Value>: DataResponseSerializerProtocol {
-    /// The type of serialized object to be created by this `DataResponseSerializer`.
-    public typealias SerializedObject = Value
-
-    /// A closure used by response handlers that takes a request, response, data and error and returns a result.
-    public var serializeResponse: (URLRequest?, HTTPURLResponse?, Data?, Error?) -> Result<Value>
-
-    /// Initializes the `ResponseSerializer` instance with the given serialize response closure.
-    ///
-    /// - parameter serializeResponse: The closure used to serialize the response.
-    ///
-    /// - returns: The new generic response serializer instance.
-    public init(serializeResponse: @escaping (URLRequest?, HTTPURLResponse?, Data?, Error?) -> Result<Value>) {
-        self.serializeResponse = serializeResponse
-    }
-}
-
-// MARK: -
-
-/// The type in which all download response serializers must conform to in order to serialize a response.
-public protocol DownloadResponseSerializerProtocol {
-    /// The type of serialized object to be created by this `DownloadResponseSerializerType`.
-    associatedtype SerializedObject
-
-    /// A closure used by response handlers that takes a request, response, url and error and returns a result.
-    var serializeResponse: (URLRequest?, HTTPURLResponse?, URL?, Error?) -> Result<SerializedObject> { get }
-}
-
-// MARK: -
-
-/// A generic `DownloadResponseSerializerType` used to serialize a request, response, and data into a serialized object.
-public struct DownloadResponseSerializer<Value>: DownloadResponseSerializerProtocol {
-    /// The type of serialized object to be created by this `DownloadResponseSerializer`.
-    public typealias SerializedObject = Value
-
-    /// A closure used by response handlers that takes a request, response, url and error and returns a result.
-    public var serializeResponse: (URLRequest?, HTTPURLResponse?, URL?, Error?) -> Result<Value>
-
-    /// Initializes the `ResponseSerializer` instance with the given serialize response closure.
-    ///
-    /// - parameter serializeResponse: The closure used to serialize the response.
-    ///
-    /// - returns: The new generic response serializer instance.
-    public init(serializeResponse: @escaping (URLRequest?, HTTPURLResponse?, URL?, Error?) -> Result<Value>) {
-        self.serializeResponse = serializeResponse
-    }
-}
-
-// MARK: - Timeline
-
-extension Request {
-    var timeline: Timeline {
-        let requestStartTime = self.startTime ?? CFAbsoluteTimeGetCurrent()
-        let requestCompletedTime = self.endTime ?? CFAbsoluteTimeGetCurrent()
-        let initialResponseTime = self.delegate.initialResponseTime ?? requestCompletedTime
-
-        return Timeline(
-            requestStartTime: requestStartTime,
-            initialResponseTime: initialResponseTime,
-            requestCompletedTime: requestCompletedTime,
-            serializationCompletedTime: CFAbsoluteTimeGetCurrent()
-        )
-    }
-}
-
-// MARK: - Default
-
-extension DataRequest {
-    /// Adds a handler to be called once the request has finished.
-    ///
-    /// - parameter queue:             The queue on which the completion handler is dispatched.
-    /// - parameter completionHandler: The code to be executed once the request has finished.
-    ///
-    /// - returns: The request.
-    @discardableResult
-    public func response(queue: DispatchQueue? = nil, completionHandler: @escaping (DefaultDataResponse) -> Void) -> Self {
-        delegate.queue.addOperation {
-            (queue ?? DispatchQueue.main).async {
-                var dataResponse = DefaultDataResponse(
-                    request: self.request,
-                    response: self.response,
-                    data: self.delegate.data,
-                    error: self.delegate.error,
-                    timeline: self.timeline
-                )
-
-                dataResponse.add(self.delegate.metrics)
-
-                completionHandler(dataResponse)
-            }
-        }
-
-        return self
-    }
-
-    /// Adds a handler to be called once the request has finished.
-    ///
-    /// - parameter queue:              The queue on which the completion handler is dispatched.
-    /// - parameter responseSerializer: The response serializer responsible for serializing the request, response,
-    ///                                 and data.
-    /// - parameter completionHandler:  The code to be executed once the request has finished.
-    ///
-    /// - returns: The request.
-    @discardableResult
-    public func response<T: DataResponseSerializerProtocol>(
-        queue: DispatchQueue? = nil,
-        responseSerializer: T,
-        completionHandler: @escaping (DataResponse<T.SerializedObject>) -> Void)
-        -> Self
-    {
-        delegate.queue.addOperation {
-            let result = responseSerializer.serializeResponse(
-                self.request,
-                self.response,
-                self.delegate.data,
-                self.delegate.error
-            )
-
-            var dataResponse = DataResponse<T.SerializedObject>(
-                request: self.request,
-                response: self.response,
-                data: self.delegate.data,
-                result: result,
-                timeline: self.timeline
-            )
-
-            dataResponse.add(self.delegate.metrics)
-
-            (queue ?? DispatchQueue.main).async { completionHandler(dataResponse) }
-        }
-
-        return self
-    }
-}
-
-extension DownloadRequest {
-    /// Adds a handler to be called once the request has finished.
-    ///
-    /// - parameter queue:             The queue on which the completion handler is dispatched.
-    /// - parameter completionHandler: The code to be executed once the request has finished.
-    ///
-    /// - returns: The request.
-    @discardableResult
-    public func response(
-        queue: DispatchQueue? = nil,
-        completionHandler: @escaping (DefaultDownloadResponse) -> Void)
-        -> Self
-    {
-        delegate.queue.addOperation {
-            (queue ?? DispatchQueue.main).async {
-                var downloadResponse = DefaultDownloadResponse(
-                    request: self.request,
-                    response: self.response,
-                    temporaryURL: self.downloadDelegate.temporaryURL,
-                    destinationURL: self.downloadDelegate.destinationURL,
-                    resumeData: self.downloadDelegate.resumeData,
-                    error: self.downloadDelegate.error,
-                    timeline: self.timeline
-                )
-
-                downloadResponse.add(self.delegate.metrics)
-
-                completionHandler(downloadResponse)
-            }
-        }
-
-        return self
-    }
-
-    /// Adds a handler to be called once the request has finished.
-    ///
-    /// - parameter queue:              The queue on which the completion handler is dispatched.
-    /// - parameter responseSerializer: The response serializer responsible for serializing the request, response,
-    ///                                 and data contained in the destination url.
-    /// - parameter completionHandler:  The code to be executed once the request has finished.
-    ///
-    /// - returns: The request.
-    @discardableResult
-    public func response<T: DownloadResponseSerializerProtocol>(
-        queue: DispatchQueue? = nil,
-        responseSerializer: T,
-        completionHandler: @escaping (DownloadResponse<T.SerializedObject>) -> Void)
-        -> Self
-    {
-        delegate.queue.addOperation {
-            let result = responseSerializer.serializeResponse(
-                self.request,
-                self.response,
-                self.downloadDelegate.fileURL,
-                self.downloadDelegate.error
-            )
-
-            var downloadResponse = DownloadResponse<T.SerializedObject>(
-                request: self.request,
-                response: self.response,
-                temporaryURL: self.downloadDelegate.temporaryURL,
-                destinationURL: self.downloadDelegate.destinationURL,
-                resumeData: self.downloadDelegate.resumeData,
-                result: result,
-                timeline: self.timeline
-            )
-
-            downloadResponse.add(self.delegate.metrics)
-
-            (queue ?? DispatchQueue.main).async { completionHandler(downloadResponse) }
-        }
-
-        return self
-    }
-}
-
-// MARK: - Data
-
-extension Request {
-    /// Returns a result data type that contains the response data as-is.
-    ///
-    /// - parameter response: The response from the server.
-    /// - parameter data:     The data returned from the server.
-    /// - parameter error:    The error already encountered if it exists.
-    ///
-    /// - returns: The result data type.
-    public static func serializeResponseData(response: HTTPURLResponse?, data: Data?, error: Error?) -> Result<Data> {
-        guard error == nil else { return .failure(error!) }
-
-        if let response = response, emptyDataStatusCodes.contains(response.statusCode) { return .success(Data()) }
-
-        guard let validData = data else {
-            return .failure(AFError.responseSerializationFailed(reason: .inputDataNil))
-        }
-
-        return .success(validData)
-    }
-}
-
-extension DataRequest {
-    /// Creates a response serializer that returns the associated data as-is.
-    ///
-    /// - returns: A data response serializer.
-    public static func dataResponseSerializer() -> DataResponseSerializer<Data> {
-        return DataResponseSerializer { _, response, data, error in
-            return Request.serializeResponseData(response: response, data: data, error: error)
-        }
-    }
-
-    /// Adds a handler to be called once the request has finished.
-    ///
-    /// - parameter completionHandler: The code to be executed once the request has finished.
-    ///
-    /// - returns: The request.
-    @discardableResult
-    public func responseData(
-        queue: DispatchQueue? = nil,
-        completionHandler: @escaping (DataResponse<Data>) -> Void)
-        -> Self
-    {
-        return response(
-            queue: queue,
-            responseSerializer: DataRequest.dataResponseSerializer(),
-            completionHandler: completionHandler
-        )
-    }
-}
-
-extension DownloadRequest {
-    /// Creates a response serializer that returns the associated data as-is.
-    ///
-    /// - returns: A data response serializer.
-    public static func dataResponseSerializer() -> DownloadResponseSerializer<Data> {
-        return DownloadResponseSerializer { _, response, fileURL, error in
-            guard error == nil else { return .failure(error!) }
-
-            guard let fileURL = fileURL else {
-                return .failure(AFError.responseSerializationFailed(reason: .inputFileNil))
-            }
-
-            do {
-                let data = try Data(contentsOf: fileURL)
-                return Request.serializeResponseData(response: response, data: data, error: error)
-            } catch {
-                return .failure(AFError.responseSerializationFailed(reason: .inputFileReadFailed(at: fileURL)))
-            }
-        }
-    }
-
-    /// Adds a handler to be called once the request has finished.
-    ///
-    /// - parameter completionHandler: The code to be executed once the request has finished.
-    ///
-    /// - returns: The request.
-    @discardableResult
-    public func responseData(
-        queue: DispatchQueue? = nil,
-        completionHandler: @escaping (DownloadResponse<Data>) -> Void)
-        -> Self
-    {
-        return response(
-            queue: queue,
-            responseSerializer: DownloadRequest.dataResponseSerializer(),
-            completionHandler: completionHandler
-        )
-    }
-}
-
-// MARK: - String
-
-extension Request {
-    /// Returns a result string type initialized from the response data with the specified string encoding.
-    ///
-    /// - parameter encoding: The string encoding. If `nil`, the string encoding will be determined from the server
-    ///                       response, falling back to the default HTTP default character set, ISO-8859-1.
-    /// - parameter response: The response from the server.
-    /// - parameter data:     The data returned from the server.
-    /// - parameter error:    The error already encountered if it exists.
-    ///
-    /// - returns: The result data type.
-    public static func serializeResponseString(
-        encoding: String.Encoding?,
-        response: HTTPURLResponse?,
-        data: Data?,
-        error: Error?)
-        -> Result<String>
-    {
-        guard error == nil else { return .failure(error!) }
-
-        if let response = response, emptyDataStatusCodes.contains(response.statusCode) { return .success("") }
-
-        guard let validData = data else {
-            return .failure(AFError.responseSerializationFailed(reason: .inputDataNil))
-        }
-
-        var convertedEncoding = encoding
-
-        if let encodingName = response?.textEncodingName as CFString?, convertedEncoding == nil {
-            convertedEncoding = String.Encoding(rawValue: CFStringConvertEncodingToNSStringEncoding(
-                CFStringConvertIANACharSetNameToEncoding(encodingName))
-            )
-        }
-
-        let actualEncoding = convertedEncoding ?? .isoLatin1
-
-        if let string = String(data: validData, encoding: actualEncoding) {
-            return .success(string)
-        } else {
-            return .failure(AFError.responseSerializationFailed(reason: .stringSerializationFailed(encoding: actualEncoding)))
-        }
-    }
-}
-
-extension DataRequest {
-    /// Creates a response serializer that returns a result string type initialized from the response data with
-    /// the specified string encoding.
-    ///
-    /// - parameter encoding: The string encoding. If `nil`, the string encoding will be determined from the server
-    ///                       response, falling back to the default HTTP default character set, ISO-8859-1.
-    ///
-    /// - returns: A string response serializer.
-    public static func stringResponseSerializer(encoding: String.Encoding? = nil) -> DataResponseSerializer<String> {
-        return DataResponseSerializer { _, response, data, error in
-            return Request.serializeResponseString(encoding: encoding, response: response, data: data, error: error)
-        }
-    }
-
-    /// Adds a handler to be called once the request has finished.
-    ///
-    /// - parameter encoding:          The string encoding. If `nil`, the string encoding will be determined from the
-    ///                                server response, falling back to the default HTTP default character set,
-    ///                                ISO-8859-1.
-    /// - parameter completionHandler: A closure to be executed once the request has finished.
-    ///
-    /// - returns: The request.
-    @discardableResult
-    public func responseString(
-        queue: DispatchQueue? = nil,
-        encoding: String.Encoding? = nil,
-        completionHandler: @escaping (DataResponse<String>) -> Void)
-        -> Self
-    {
-        return response(
-            queue: queue,
-            responseSerializer: DataRequest.stringResponseSerializer(encoding: encoding),
-            completionHandler: completionHandler
-        )
-    }
-}
-
-extension DownloadRequest {
-    /// Creates a response serializer that returns a result string type initialized from the response data with
-    /// the specified string encoding.
-    ///
-    /// - parameter encoding: The string encoding. If `nil`, the string encoding will be determined from the server
-    ///                       response, falling back to the default HTTP default character set, ISO-8859-1.
-    ///
-    /// - returns: A string response serializer.
-    public static func stringResponseSerializer(encoding: String.Encoding? = nil) -> DownloadResponseSerializer<String> {
-        return DownloadResponseSerializer { _, response, fileURL, error in
-            guard error == nil else { return .failure(error!) }
-
-            guard let fileURL = fileURL else {
-                return .failure(AFError.responseSerializationFailed(reason: .inputFileNil))
-            }
-
-            do {
-                let data = try Data(contentsOf: fileURL)
-                return Request.serializeResponseString(encoding: encoding, response: response, data: data, error: error)
-            } catch {
-                return .failure(AFError.responseSerializationFailed(reason: .inputFileReadFailed(at: fileURL)))
-            }
-        }
-    }
-
-    /// Adds a handler to be called once the request has finished.
-    ///
-    /// - parameter encoding:          The string encoding. If `nil`, the string encoding will be determined from the
-    ///                                server response, falling back to the default HTTP default character set,
-    ///                                ISO-8859-1.
-    /// - parameter completionHandler: A closure to be executed once the request has finished.
-    ///
-    /// - returns: The request.
-    @discardableResult
-    public func responseString(
-        queue: DispatchQueue? = nil,
-        encoding: String.Encoding? = nil,
-        completionHandler: @escaping (DownloadResponse<String>) -> Void)
-        -> Self
-    {
-        return response(
-            queue: queue,
-            responseSerializer: DownloadRequest.stringResponseSerializer(encoding: encoding),
-            completionHandler: completionHandler
-        )
-    }
-}
-
-// MARK: - JSON
-
-extension Request {
-    /// Returns a JSON object contained in a result type constructed from the response data using `JSONSerialization`
-    /// with the specified reading options.
-    ///
-    /// - parameter options:  The JSON serialization reading options. Defaults to `.allowFragments`.
-    /// - parameter response: The response from the server.
-    /// - parameter data:     The data returned from the server.
-    /// - parameter error:    The error already encountered if it exists.
-    ///
-    /// - returns: The result data type.
-    public static func serializeResponseJSON(
-        options: JSONSerialization.ReadingOptions,
-        response: HTTPURLResponse?,
-        data: Data?,
-        error: Error?)
-        -> Result<Any>
-    {
-        guard error == nil else { return .failure(error!) }
-
-        if let response = response, emptyDataStatusCodes.contains(response.statusCode) { return .success(NSNull()) }
-
-        guard let validData = data, validData.count > 0 else {
-            return .failure(AFError.responseSerializationFailed(reason: .inputDataNilOrZeroLength))
-        }
-
-        do {
-            let json = try JSONSerialization.jsonObject(with: validData, options: options)
-            return .success(json)
-        } catch {
-            return .failure(AFError.responseSerializationFailed(reason: .jsonSerializationFailed(error: error)))
-        }
-    }
-}
-
-extension DataRequest {
-    /// Creates a response serializer that returns a JSON object result type constructed from the response data using
-    /// `JSONSerialization` with the specified reading options.
-    ///
-    /// - parameter options: The JSON serialization reading options. Defaults to `.allowFragments`.
-    ///
-    /// - returns: A JSON object response serializer.
-    public static func jsonResponseSerializer(
-        options: JSONSerialization.ReadingOptions = .allowFragments)
-        -> DataResponseSerializer<Any>
-    {
-        return DataResponseSerializer { _, response, data, error in
-            return Request.serializeResponseJSON(options: options, response: response, data: data, error: error)
-        }
-    }
-
-    /// Adds a handler to be called once the request has finished.
-    ///
-    /// - parameter options:           The JSON serialization reading options. Defaults to `.allowFragments`.
-    /// - parameter completionHandler: A closure to be executed once the request has finished.
-    ///
-    /// - returns: The request.
-    @discardableResult
-    public func responseJSON(
-        queue: DispatchQueue? = nil,
-        options: JSONSerialization.ReadingOptions = .allowFragments,
-        completionHandler: @escaping (DataResponse<Any>) -> Void)
-        -> Self
-    {
-        return response(
-            queue: queue,
-            responseSerializer: DataRequest.jsonResponseSerializer(options: options),
-            completionHandler: completionHandler
-        )
-    }
-}
-
-extension DownloadRequest {
-    /// Creates a response serializer that returns a JSON object result type constructed from the response data using
-    /// `JSONSerialization` with the specified reading options.
-    ///
-    /// - parameter options: The JSON serialization reading options. Defaults to `.allowFragments`.
-    ///
-    /// - returns: A JSON object response serializer.
-    public static func jsonResponseSerializer(
-        options: JSONSerialization.ReadingOptions = .allowFragments)
-        -> DownloadResponseSerializer<Any>
-    {
-        return DownloadResponseSerializer { _, response, fileURL, error in
-            guard error == nil else { return .failure(error!) }
-
-            guard let fileURL = fileURL else {
-                return .failure(AFError.responseSerializationFailed(reason: .inputFileNil))
-            }
-
-            do {
-                let data = try Data(contentsOf: fileURL)
-                return Request.serializeResponseJSON(options: options, response: response, data: data, error: error)
-            } catch {
-                return .failure(AFError.responseSerializationFailed(reason: .inputFileReadFailed(at: fileURL)))
-            }
-        }
-    }
-
-    /// Adds a handler to be called once the request has finished.
-    ///
-    /// - parameter options:           The JSON serialization reading options. Defaults to `.allowFragments`.
-    /// - parameter completionHandler: A closure to be executed once the request has finished.
-    ///
-    /// - returns: The request.
-    @discardableResult
-    public func responseJSON(
-        queue: DispatchQueue? = nil,
-        options: JSONSerialization.ReadingOptions = .allowFragments,
-        completionHandler: @escaping (DownloadResponse<Any>) -> Void)
-        -> Self
-    {
-        return response(
-            queue: queue,
-            responseSerializer: DownloadRequest.jsonResponseSerializer(options: options),
-            completionHandler: completionHandler
-        )
-    }
-}
-
-// MARK: - Property List
-
-extension Request {
-    /// Returns a plist object contained in a result type constructed from the response data using
-    /// `PropertyListSerialization` with the specified reading options.
-    ///
-    /// - parameter options:  The property list reading options. Defaults to `[]`.
-    /// - parameter response: The response from the server.
-    /// - parameter data:     The data returned from the server.
-    /// - parameter error:    The error already encountered if it exists.
-    ///
-    /// - returns: The result data type.
-    public static func serializeResponsePropertyList(
-        options: PropertyListSerialization.ReadOptions,
-        response: HTTPURLResponse?,
-        data: Data?,
-        error: Error?)
-        -> Result<Any>
-    {
-        guard error == nil else { return .failure(error!) }
-
-        if let response = response, emptyDataStatusCodes.contains(response.statusCode) { return .success(NSNull()) }
-
-        guard let validData = data, validData.count > 0 else {
-            return .failure(AFError.responseSerializationFailed(reason: .inputDataNilOrZeroLength))
-        }
-
-        do {
-            let plist = try PropertyListSerialization.propertyList(from: validData, options: options, format: nil)
-            return .success(plist)
-        } catch {
-            return .failure(AFError.responseSerializationFailed(reason: .propertyListSerializationFailed(error: error)))
-        }
-    }
-}
-
-extension DataRequest {
-    /// Creates a response serializer that returns an object constructed from the response data using
-    /// `PropertyListSerialization` with the specified reading options.
-    ///
-    /// - parameter options: The property list reading options. Defaults to `[]`.
-    ///
-    /// - returns: A property list object response serializer.
-    public static func propertyListResponseSerializer(
-        options: PropertyListSerialization.ReadOptions = [])
-        -> DataResponseSerializer<Any>
-    {
-        return DataResponseSerializer { _, response, data, error in
-            return Request.serializeResponsePropertyList(options: options, response: response, data: data, error: error)
-        }
-    }
-
-    /// Adds a handler to be called once the request has finished.
-    ///
-    /// - parameter options:           The property list reading options. Defaults to `[]`.
-    /// - parameter completionHandler: A closure to be executed once the request has finished.
-    ///
-    /// - returns: The request.
-    @discardableResult
-    public func responsePropertyList(
-        queue: DispatchQueue? = nil,
-        options: PropertyListSerialization.ReadOptions = [],
-        completionHandler: @escaping (DataResponse<Any>) -> Void)
-        -> Self
-    {
-        return response(
-            queue: queue,
-            responseSerializer: DataRequest.propertyListResponseSerializer(options: options),
-            completionHandler: completionHandler
-        )
-    }
-}
-
-extension DownloadRequest {
-    /// Creates a response serializer that returns an object constructed from the response data using
-    /// `PropertyListSerialization` with the specified reading options.
-    ///
-    /// - parameter options: The property list reading options. Defaults to `[]`.
-    ///
-    /// - returns: A property list object response serializer.
-    public static func propertyListResponseSerializer(
-        options: PropertyListSerialization.ReadOptions = [])
-        -> DownloadResponseSerializer<Any>
-    {
-        return DownloadResponseSerializer { _, response, fileURL, error in
-            guard error == nil else { return .failure(error!) }
-
-            guard let fileURL = fileURL else {
-                return .failure(AFError.responseSerializationFailed(reason: .inputFileNil))
-            }
-
-            do {
-                let data = try Data(contentsOf: fileURL)
-                return Request.serializeResponsePropertyList(options: options, response: response, data: data, error: error)
-            } catch {
-                return .failure(AFError.responseSerializationFailed(reason: .inputFileReadFailed(at: fileURL)))
-            }
-        }
-    }
-
-    /// Adds a handler to be called once the request has finished.
-    ///
-    /// - parameter options:           The property list reading options. Defaults to `[]`.
-    /// - parameter completionHandler: A closure to be executed once the request has finished.
-    ///
-    /// - returns: The request.
-    @discardableResult
-    public func responsePropertyList(
-        queue: DispatchQueue? = nil,
-        options: PropertyListSerialization.ReadOptions = [],
-        completionHandler: @escaping (DownloadResponse<Any>) -> Void)
-        -> Self
-    {
-        return response(
-            queue: queue,
-            responseSerializer: DownloadRequest.propertyListResponseSerializer(options: options),
-            completionHandler: completionHandler
-        )
-    }
-}
-
-/// A set of HTTP response status code that do not contain response data.
-private let emptyDataStatusCodes: Set<Int> = [204, 205]

+ 0 - 300
Example/Pods/Alamofire/Source/Result.swift

@@ -1,300 +0,0 @@
-//
-//  Result.swift
-//
-//  Copyright (c) 2014 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
-
-/// Used to represent whether a request was successful or encountered an error.
-///
-/// - success: The request and all post processing operations were successful resulting in the serialization of the
-///            provided associated value.
-///
-/// - failure: The request encountered an error resulting in a failure. The associated values are the original data
-///            provided by the server as well as the error that caused the failure.
-public enum Result<Value> {
-    case success(Value)
-    case failure(Error)
-
-    /// Returns `true` if the result is a success, `false` otherwise.
-    public var isSuccess: Bool {
-        switch self {
-        case .success:
-            return true
-        case .failure:
-            return false
-        }
-    }
-
-    /// Returns `true` if the result is a failure, `false` otherwise.
-    public var isFailure: Bool {
-        return !isSuccess
-    }
-
-    /// Returns the associated value if the result is a success, `nil` otherwise.
-    public var value: Value? {
-        switch self {
-        case .success(let value):
-            return value
-        case .failure:
-            return nil
-        }
-    }
-
-    /// Returns the associated error value if the result is a failure, `nil` otherwise.
-    public var error: Error? {
-        switch self {
-        case .success:
-            return nil
-        case .failure(let error):
-            return error
-        }
-    }
-}
-
-// MARK: - CustomStringConvertible
-
-extension Result: CustomStringConvertible {
-    /// The textual representation used when written to an output stream, which includes whether the result was a
-    /// success or failure.
-    public var description: String {
-        switch self {
-        case .success:
-            return "SUCCESS"
-        case .failure:
-            return "FAILURE"
-        }
-    }
-}
-
-// MARK: - CustomDebugStringConvertible
-
-extension Result: CustomDebugStringConvertible {
-    /// The debug textual representation used when written to an output stream, which includes whether the result was a
-    /// success or failure in addition to the value or error.
-    public var debugDescription: String {
-        switch self {
-        case .success(let value):
-            return "SUCCESS: \(value)"
-        case .failure(let error):
-            return "FAILURE: \(error)"
-        }
-    }
-}
-
-// MARK: - Functional APIs
-
-extension Result {
-    /// Creates a `Result` instance from the result of a closure.
-    ///
-    /// A failure result is created when the closure throws, and a success result is created when the closure
-    /// succeeds without throwing an error.
-    ///
-    ///     func someString() throws -> String { ... }
-    ///
-    ///     let result = Result(value: {
-    ///         return try someString()
-    ///     })
-    ///
-    ///     // The type of result is Result<String>
-    ///
-    /// The trailing closure syntax is also supported:
-    ///
-    ///     let result = Result { try someString() }
-    ///
-    /// - parameter value: The closure to execute and create the result for.
-    public init(value: () throws -> Value) {
-        do {
-            self = try .success(value())
-        } catch {
-            self = .failure(error)
-        }
-    }
-
-    /// Returns the success value, or throws the failure error.
-    ///
-    ///     let possibleString: Result<String> = .success("success")
-    ///     try print(possibleString.unwrap())
-    ///     // Prints "success"
-    ///
-    ///     let noString: Result<String> = .failure(error)
-    ///     try print(noString.unwrap())
-    ///     // Throws error
-    public func unwrap() throws -> Value {
-        switch self {
-        case .success(let value):
-            return value
-        case .failure(let error):
-            throw error
-        }
-    }
-
-    /// Evaluates the specified closure when the `Result` is a success, passing the unwrapped value as a parameter.
-    ///
-    /// Use the `map` method with a closure that does not throw. For example:
-    ///
-    ///     let possibleData: Result<Data> = .success(Data())
-    ///     let possibleInt = possibleData.map { $0.count }
-    ///     try print(possibleInt.unwrap())
-    ///     // Prints "0"
-    ///
-    ///     let noData: Result<Data> = .failure(error)
-    ///     let noInt = noData.map { $0.count }
-    ///     try print(noInt.unwrap())
-    ///     // Throws error
-    ///
-    /// - parameter transform: A closure that takes the success value of the `Result` instance.
-    ///
-    /// - returns: A `Result` containing the result of the given closure. If this instance is a failure, returns the
-    ///            same failure.
-    public func map<T>(_ transform: (Value) -> T) -> Result<T> {
-        switch self {
-        case .success(let value):
-            return .success(transform(value))
-        case .failure(let error):
-            return .failure(error)
-        }
-    }
-
-    /// Evaluates the specified closure when the `Result` is a success, passing the unwrapped value as a parameter.
-    ///
-    /// Use the `flatMap` method with a closure that may throw an error. For example:
-    ///
-    ///     let possibleData: Result<Data> = .success(Data(...))
-    ///     let possibleObject = possibleData.flatMap {
-    ///         try JSONSerialization.jsonObject(with: $0)
-    ///     }
-    ///
-    /// - parameter transform: A closure that takes the success value of the instance.
-    ///
-    /// - returns: A `Result` containing the result of the given closure. If this instance is a failure, returns the
-    ///            same failure.
-    public func flatMap<T>(_ transform: (Value) throws -> T) -> Result<T> {
-        switch self {
-        case .success(let value):
-            do {
-                return try .success(transform(value))
-            } catch {
-                return .failure(error)
-            }
-        case .failure(let error):
-            return .failure(error)
-        }
-    }
-
-    /// Evaluates the specified closure when the `Result` is a failure, passing the unwrapped error as a parameter.
-    ///
-    /// Use the `mapError` function with a closure that does not throw. For example:
-    ///
-    ///     let possibleData: Result<Data> = .failure(someError)
-    ///     let withMyError: Result<Data> = possibleData.mapError { MyError.error($0) }
-    ///
-    /// - Parameter transform: A closure that takes the error of the instance.
-    /// - Returns: A `Result` instance containing the result of the transform. If this instance is a success, returns
-    ///            the same instance.
-    public func mapError<T: Error>(_ transform: (Error) -> T) -> Result {
-        switch self {
-        case .failure(let error):
-            return .failure(transform(error))
-        case .success:
-            return self
-        }
-    }
-
-    /// Evaluates the specified closure when the `Result` is a failure, passing the unwrapped error as a parameter.
-    ///
-    /// Use the `flatMapError` function with a closure that may throw an error. For example:
-    ///
-    ///     let possibleData: Result<Data> = .success(Data(...))
-    ///     let possibleObject = possibleData.flatMapError {
-    ///         try someFailableFunction(taking: $0)
-    ///     }
-    ///
-    /// - Parameter transform: A throwing closure that takes the error of the instance.
-    ///
-    /// - Returns: A `Result` instance containing the result of the transform. If this instance is a success, returns
-    ///            the same instance.
-    public func flatMapError<T: Error>(_ transform: (Error) throws -> T) -> Result {
-        switch self {
-        case .failure(let error):
-            do {
-                return try .failure(transform(error))
-            } catch {
-                return .failure(error)
-            }
-        case .success:
-            return self
-        }
-    }
-
-    /// Evaluates the specified closure when the `Result` is a success, passing the unwrapped value as a parameter.
-    ///
-    /// Use the `withValue` function to evaluate the passed closure without modifying the `Result` instance.
-    ///
-    /// - Parameter closure: A closure that takes the success value of this instance.
-    /// - Returns: This `Result` instance, unmodified.
-    @discardableResult
-    public func withValue(_ closure: (Value) throws -> Void) rethrows -> Result {
-        if case let .success(value) = self { try closure(value) }
-
-        return self
-    }
-
-    /// Evaluates the specified closure when the `Result` is a failure, passing the unwrapped error as a parameter.
-    ///
-    /// Use the `withError` function to evaluate the passed closure without modifying the `Result` instance.
-    ///
-    /// - Parameter closure: A closure that takes the success value of this instance.
-    /// - Returns: This `Result` instance, unmodified.
-    @discardableResult
-    public func withError(_ closure: (Error) throws -> Void) rethrows -> Result {
-        if case let .failure(error) = self { try closure(error) }
-
-        return self
-    }
-
-    /// Evaluates the specified closure when the `Result` is a success.
-    ///
-    /// Use the `ifSuccess` function to evaluate the passed closure without modifying the `Result` instance.
-    ///
-    /// - Parameter closure: A `Void` closure.
-    /// - Returns: This `Result` instance, unmodified.
-    @discardableResult
-    public func ifSuccess(_ closure: () throws -> Void) rethrows -> Result {
-        if isSuccess { try closure() }
-
-        return self
-    }
-
-    /// Evaluates the specified closure when the `Result` is a failure.
-    ///
-    /// Use the `ifFailure` function to evaluate the passed closure without modifying the `Result` instance.
-    ///
-    /// - Parameter closure: A `Void` closure.
-    /// - Returns: This `Result` instance, unmodified.
-    @discardableResult
-    public func ifFailure(_ closure: () throws -> Void) rethrows -> Result {
-        if isFailure { try closure() }
-
-        return self
-    }
-}

+ 0 - 310
Example/Pods/Alamofire/Source/ServerTrustPolicy.swift

@@ -1,310 +0,0 @@
-//
-//  ServerTrustPolicy.swift
-//
-//  Copyright (c) 2014 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
-
-/// Responsible for managing the mapping of `ServerTrustPolicy` objects to a given host.
-open class ServerTrustPolicyManager {
-    /// The dictionary of policies mapped to a particular host.
-    public let policies: [String: ServerTrustPolicy]
-
-    /// Initializes the `ServerTrustPolicyManager` instance with the given policies.
-    ///
-    /// Since different servers and web services can have different leaf certificates, intermediate and even root
-    /// certficates, it is important to have the flexibility to specify evaluation policies on a per host basis. This
-    /// allows for scenarios such as using default evaluation for host1, certificate pinning for host2, public key
-    /// pinning for host3 and disabling evaluation for host4.
-    ///
-    /// - parameter policies: A dictionary of all policies mapped to a particular host.
-    ///
-    /// - returns: The new `ServerTrustPolicyManager` instance.
-    public init(policies: [String: ServerTrustPolicy]) {
-        self.policies = policies
-    }
-
-    /// Returns the `ServerTrustPolicy` for the given host if applicable.
-    ///
-    /// By default, this method will return the policy that perfectly matches the given host. Subclasses could override
-    /// this method and implement more complex mapping implementations such as wildcards.
-    ///
-    /// - parameter host: The host to use when searching for a matching policy.
-    ///
-    /// - returns: The server trust policy for the given host if found.
-    open func serverTrustPolicy(forHost host: String) -> ServerTrustPolicy? {
-        return policies[host]
-    }
-}
-
-// MARK: -
-
-extension URLSession {
-    private struct AssociatedKeys {
-        static var managerKey = "URLSession.ServerTrustPolicyManager"
-    }
-
-    var serverTrustPolicyManager: ServerTrustPolicyManager? {
-        get {
-            return objc_getAssociatedObject(self, &AssociatedKeys.managerKey) as? ServerTrustPolicyManager
-        }
-        set (manager) {
-            objc_setAssociatedObject(self, &AssociatedKeys.managerKey, manager, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)
-        }
-    }
-}
-
-// MARK: - ServerTrustPolicy
-
-/// The `ServerTrustPolicy` evaluates the server trust generally provided by an `NSURLAuthenticationChallenge` when
-/// connecting to a server over a secure HTTPS connection. The policy configuration then evaluates the server trust
-/// with a given set of criteria to determine whether the server trust is valid and the connection should be made.
-///
-/// Using pinned certificates or public keys for evaluation helps prevent man-in-the-middle (MITM) 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 pinning enabled.
-///
-/// - performDefaultEvaluation: Uses the default server trust evaluation while allowing you to control whether to
-///                             validate the host provided by the challenge. Applications are encouraged to always
-///                             validate the host in production environments to guarantee the validity of the server's
-///                             certificate chain.
-///
-/// - performRevokedEvaluation: Uses the default and revoked server trust evaluations allowing you to control whether to
-///                             validate the host provided by the challenge as well as specify the revocation flags for
-///                             testing for revoked certificates. Apple platforms did not start testing for revoked
-///                             certificates automatically until iOS 10.1, macOS 10.12 and tvOS 10.1 which is
-///                             demonstrated in our TLS tests. Applications are encouraged to always validate the host
-///                             in production environments to guarantee the validity of the server's certificate chain.
-///
-/// - pinCertificates:          Uses the pinned certificates to validate the server trust. The server trust is
-///                             considered valid if one of the pinned certificates match one of the server certificates.
-///                             By validating both the certificate chain and host, certificate pinning provides a very
-///                             secure form of server trust validation mitigating most, if not all, MITM attacks.
-///                             Applications are encouraged to always validate the host and require a valid certificate
-///                             chain in production environments.
-///
-/// - pinPublicKeys:            Uses the pinned public keys to validate the server trust. The server trust is considered
-///                             valid if one of the pinned public keys match one of the server certificate public keys.
-///                             By validating both the certificate chain and host, public key pinning provides a very
-///                             secure form of server trust validation mitigating most, if not all, MITM attacks.
-///                             Applications are encouraged to always validate the host and require a valid certificate
-///                             chain in production environments.
-///
-/// - disableEvaluation:        Disables all evaluation which in turn will always consider any server trust as valid.
-///
-/// - customEvaluation:         Uses the associated closure to evaluate the validity of the server trust.
-public enum ServerTrustPolicy {
-    case performDefaultEvaluation(validateHost: Bool)
-    case performRevokedEvaluation(validateHost: Bool, revocationFlags: CFOptionFlags)
-    case pinCertificates(certificates: [SecCertificate], validateCertificateChain: Bool, validateHost: Bool)
-    case pinPublicKeys(publicKeys: [SecKey], validateCertificateChain: Bool, validateHost: Bool)
-    case disableEvaluation
-    case customEvaluation((_ serverTrust: SecTrust, _ host: String) -> Bool)
-
-    // MARK: - Bundle Location
-
-    /// Returns all certificates within the given bundle with a `.cer` file extension.
-    ///
-    /// - parameter bundle: The bundle to search for all `.cer` files.
-    ///
-    /// - returns: All certificates within the given bundle.
-    public static func certificates(in bundle: Bundle = Bundle.main) -> [SecCertificate] {
-        var certificates: [SecCertificate] = []
-
-        let paths = Set([".cer", ".CER", ".crt", ".CRT", ".der", ".DER"].map { fileExtension in
-            bundle.paths(forResourcesOfType: fileExtension, inDirectory: nil)
-        }.joined())
-
-        for path in paths {
-            if
-                let certificateData = try? Data(contentsOf: URL(fileURLWithPath: path)) as CFData,
-                let certificate = SecCertificateCreateWithData(nil, certificateData)
-            {
-                certificates.append(certificate)
-            }
-        }
-
-        return certificates
-    }
-
-    /// Returns all public keys within the given bundle with a `.cer` file extension.
-    ///
-    /// - parameter bundle: The bundle to search for all `*.cer` files.
-    ///
-    /// - returns: All public keys within the given bundle.
-    public static func publicKeys(in bundle: Bundle = Bundle.main) -> [SecKey] {
-        var publicKeys: [SecKey] = []
-
-        for certificate in certificates(in: bundle) {
-            if let publicKey = publicKey(for: certificate) {
-                publicKeys.append(publicKey)
-            }
-        }
-
-        return publicKeys
-    }
-
-    // MARK: - Evaluation
-
-    /// Evaluates whether the server trust is valid for the given host.
-    ///
-    /// - parameter serverTrust: The server trust to evaluate.
-    /// - parameter host:        The host of the challenge protection space.
-    ///
-    /// - returns: Whether the server trust is valid.
-    public func evaluate(_ serverTrust: SecTrust, forHost host: String) -> Bool {
-        var serverTrustIsValid = false
-
-        switch self {
-        case let .performDefaultEvaluation(validateHost):
-            let policy = SecPolicyCreateSSL(true, validateHost ? host as CFString : nil)
-            SecTrustSetPolicies(serverTrust, policy)
-
-            serverTrustIsValid = trustIsValid(serverTrust)
-        case let .performRevokedEvaluation(validateHost, revocationFlags):
-            let defaultPolicy = SecPolicyCreateSSL(true, validateHost ? host as CFString : nil)
-            let revokedPolicy = SecPolicyCreateRevocation(revocationFlags)
-            SecTrustSetPolicies(serverTrust, [defaultPolicy, revokedPolicy] as CFTypeRef)
-
-            serverTrustIsValid = trustIsValid(serverTrust)
-        case let .pinCertificates(pinnedCertificates, validateCertificateChain, validateHost):
-            if validateCertificateChain {
-                let policy = SecPolicyCreateSSL(true, validateHost ? host as CFString : nil)
-                SecTrustSetPolicies(serverTrust, policy)
-
-                SecTrustSetAnchorCertificates(serverTrust, pinnedCertificates as CFArray)
-                SecTrustSetAnchorCertificatesOnly(serverTrust, true)
-
-                serverTrustIsValid = trustIsValid(serverTrust)
-            } else {
-                let serverCertificatesDataArray = certificateData(for: serverTrust)
-                let pinnedCertificatesDataArray = certificateData(for: pinnedCertificates)
-
-                outerLoop: for serverCertificateData in serverCertificatesDataArray {
-                    for pinnedCertificateData in pinnedCertificatesDataArray {
-                        if serverCertificateData == pinnedCertificateData {
-                            serverTrustIsValid = true
-                            break outerLoop
-                        }
-                    }
-                }
-            }
-        case let .pinPublicKeys(pinnedPublicKeys, validateCertificateChain, validateHost):
-            var certificateChainEvaluationPassed = true
-
-            if validateCertificateChain {
-                let policy = SecPolicyCreateSSL(true, validateHost ? host as CFString : nil)
-                SecTrustSetPolicies(serverTrust, policy)
-
-                certificateChainEvaluationPassed = trustIsValid(serverTrust)
-            }
-
-            if certificateChainEvaluationPassed {
-                outerLoop: for serverPublicKey in ServerTrustPolicy.publicKeys(for: serverTrust) as [AnyObject] {
-                    for pinnedPublicKey in pinnedPublicKeys as [AnyObject] {
-                        if serverPublicKey.isEqual(pinnedPublicKey) {
-                            serverTrustIsValid = true
-                            break outerLoop
-                        }
-                    }
-                }
-            }
-        case .disableEvaluation:
-            serverTrustIsValid = true
-        case let .customEvaluation(closure):
-            serverTrustIsValid = closure(serverTrust, host)
-        }
-
-        return serverTrustIsValid
-    }
-
-    // MARK: - Private - Trust Validation
-
-    private func trustIsValid(_ trust: SecTrust) -> Bool {
-        var isValid = false
-
-        if #available(iOS 12, macOS 10.14, tvOS 12, watchOS 5, *) {
-            isValid = SecTrustEvaluateWithError(trust, nil)
-        } else {
-            var result = SecTrustResultType.invalid
-            let status = SecTrustEvaluate(trust, &result)
-
-            if status == errSecSuccess {
-                let unspecified = SecTrustResultType.unspecified
-                let proceed = SecTrustResultType.proceed
-
-                isValid = result == unspecified || result == proceed
-            }
-        }
-
-        return isValid
-    }
-
-    // MARK: - Private - Certificate Data
-
-    private func certificateData(for trust: SecTrust) -> [Data] {
-        var certificates: [SecCertificate] = []
-
-        for index in 0..<SecTrustGetCertificateCount(trust) {
-            if let certificate = SecTrustGetCertificateAtIndex(trust, index) {
-                certificates.append(certificate)
-            }
-        }
-
-        return certificateData(for: certificates)
-    }
-
-    private func certificateData(for certificates: [SecCertificate]) -> [Data] {
-        return certificates.map { SecCertificateCopyData($0) as Data }
-    }
-
-    // MARK: - Private - Public Key Extraction
-
-    private static func publicKeys(for trust: SecTrust) -> [SecKey] {
-        var publicKeys: [SecKey] = []
-
-        for index in 0..<SecTrustGetCertificateCount(trust) {
-            if
-                let certificate = SecTrustGetCertificateAtIndex(trust, index),
-                let publicKey = publicKey(for: certificate)
-            {
-                publicKeys.append(publicKey)
-            }
-        }
-
-        return publicKeys
-    }
-
-    private static func publicKey(for certificate: SecCertificate) -> SecKey? {
-        var publicKey: SecKey?
-
-        let policy = SecPolicyCreateBasicX509()
-        var trust: SecTrust?
-        let trustCreationStatus = SecTrustCreateWithCertificates(certificate, policy, &trust)
-
-        if let trust = trust, trustCreationStatus == errSecSuccess {
-            publicKey = SecTrustCopyPublicKey(trust)
-        }
-
-        return publicKey
-    }
-}

+ 0 - 725
Example/Pods/Alamofire/Source/SessionDelegate.swift

@@ -1,725 +0,0 @@
-//
-//  SessionDelegate.swift
-//
-//  Copyright (c) 2014 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
-
-/// Responsible for handling all delegate callbacks for the underlying session.
-open class SessionDelegate: NSObject {
-
-    // MARK: URLSessionDelegate Overrides
-
-    /// Overrides default behavior for URLSessionDelegate method `urlSession(_:didBecomeInvalidWithError:)`.
-    open var sessionDidBecomeInvalidWithError: ((URLSession, Error?) -> Void)?
-
-    /// Overrides default behavior for URLSessionDelegate method `urlSession(_:didReceive:completionHandler:)`.
-    open var sessionDidReceiveChallenge: ((URLSession, URLAuthenticationChallenge) -> (URLSession.AuthChallengeDisposition, URLCredential?))?
-
-    /// Overrides all behavior for URLSessionDelegate method `urlSession(_:didReceive:completionHandler:)` and requires the caller to call the `completionHandler`.
-    open var sessionDidReceiveChallengeWithCompletion: ((URLSession, URLAuthenticationChallenge, @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) -> Void)?
-
-    /// Overrides default behavior for URLSessionDelegate method `urlSessionDidFinishEvents(forBackgroundURLSession:)`.
-    open var sessionDidFinishEventsForBackgroundURLSession: ((URLSession) -> Void)?
-
-    // MARK: URLSessionTaskDelegate Overrides
-
-    /// Overrides default behavior for URLSessionTaskDelegate method `urlSession(_:task:willPerformHTTPRedirection:newRequest:completionHandler:)`.
-    open var taskWillPerformHTTPRedirection: ((URLSession, URLSessionTask, HTTPURLResponse, URLRequest) -> URLRequest?)?
-
-    /// Overrides all behavior for URLSessionTaskDelegate method `urlSession(_:task:willPerformHTTPRedirection:newRequest:completionHandler:)` and
-    /// requires the caller to call the `completionHandler`.
-    open var taskWillPerformHTTPRedirectionWithCompletion: ((URLSession, URLSessionTask, HTTPURLResponse, URLRequest, @escaping (URLRequest?) -> Void) -> Void)?
-
-    /// Overrides default behavior for URLSessionTaskDelegate method `urlSession(_:task:didReceive:completionHandler:)`.
-    open var taskDidReceiveChallenge: ((URLSession, URLSessionTask, URLAuthenticationChallenge) -> (URLSession.AuthChallengeDisposition, URLCredential?))?
-
-    /// Overrides all behavior for URLSessionTaskDelegate method `urlSession(_:task:didReceive:completionHandler:)` and
-    /// requires the caller to call the `completionHandler`.
-    open var taskDidReceiveChallengeWithCompletion: ((URLSession, URLSessionTask, URLAuthenticationChallenge, @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) -> Void)?
-
-    /// Overrides default behavior for URLSessionTaskDelegate method `urlSession(_:task:needNewBodyStream:)`.
-    open var taskNeedNewBodyStream: ((URLSession, URLSessionTask) -> InputStream?)?
-
-    /// Overrides all behavior for URLSessionTaskDelegate method `urlSession(_:task:needNewBodyStream:)` and
-    /// requires the caller to call the `completionHandler`.
-    open var taskNeedNewBodyStreamWithCompletion: ((URLSession, URLSessionTask, @escaping (InputStream?) -> Void) -> Void)?
-
-    /// Overrides default behavior for URLSessionTaskDelegate method `urlSession(_:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:)`.
-    open var taskDidSendBodyData: ((URLSession, URLSessionTask, Int64, Int64, Int64) -> Void)?
-
-    /// Overrides default behavior for URLSessionTaskDelegate method `urlSession(_:task:didCompleteWithError:)`.
-    open var taskDidComplete: ((URLSession, URLSessionTask, Error?) -> Void)?
-
-    // MARK: URLSessionDataDelegate Overrides
-
-    /// Overrides default behavior for URLSessionDataDelegate method `urlSession(_:dataTask:didReceive:completionHandler:)`.
-    open var dataTaskDidReceiveResponse: ((URLSession, URLSessionDataTask, URLResponse) -> URLSession.ResponseDisposition)?
-
-    /// Overrides all behavior for URLSessionDataDelegate method `urlSession(_:dataTask:didReceive:completionHandler:)` and
-    /// requires caller to call the `completionHandler`.
-    open var dataTaskDidReceiveResponseWithCompletion: ((URLSession, URLSessionDataTask, URLResponse, @escaping (URLSession.ResponseDisposition) -> Void) -> Void)?
-
-    /// Overrides default behavior for URLSessionDataDelegate method `urlSession(_:dataTask:didBecome:)`.
-    open var dataTaskDidBecomeDownloadTask: ((URLSession, URLSessionDataTask, URLSessionDownloadTask) -> Void)?
-
-    /// Overrides default behavior for URLSessionDataDelegate method `urlSession(_:dataTask:didReceive:)`.
-    open var dataTaskDidReceiveData: ((URLSession, URLSessionDataTask, Data) -> Void)?
-
-    /// Overrides default behavior for URLSessionDataDelegate method `urlSession(_:dataTask:willCacheResponse:completionHandler:)`.
-    open var dataTaskWillCacheResponse: ((URLSession, URLSessionDataTask, CachedURLResponse) -> CachedURLResponse?)?
-
-    /// Overrides all behavior for URLSessionDataDelegate method `urlSession(_:dataTask:willCacheResponse:completionHandler:)` and
-    /// requires caller to call the `completionHandler`.
-    open var dataTaskWillCacheResponseWithCompletion: ((URLSession, URLSessionDataTask, CachedURLResponse, @escaping (CachedURLResponse?) -> Void) -> Void)?
-
-    // MARK: URLSessionDownloadDelegate Overrides
-
-    /// Overrides default behavior for URLSessionDownloadDelegate method `urlSession(_:downloadTask:didFinishDownloadingTo:)`.
-    open var downloadTaskDidFinishDownloadingToURL: ((URLSession, URLSessionDownloadTask, URL) -> Void)?
-
-    /// Overrides default behavior for URLSessionDownloadDelegate method `urlSession(_:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:)`.
-    open var downloadTaskDidWriteData: ((URLSession, URLSessionDownloadTask, Int64, Int64, Int64) -> Void)?
-
-    /// Overrides default behavior for URLSessionDownloadDelegate method `urlSession(_:downloadTask:didResumeAtOffset:expectedTotalBytes:)`.
-    open var downloadTaskDidResumeAtOffset: ((URLSession, URLSessionDownloadTask, Int64, Int64) -> Void)?
-
-    // MARK: URLSessionStreamDelegate Overrides
-
-#if !os(watchOS)
-
-    /// Overrides default behavior for URLSessionStreamDelegate method `urlSession(_:readClosedFor:)`.
-    @available(iOS 9.0, macOS 10.11, tvOS 9.0, *)
-    open var streamTaskReadClosed: ((URLSession, URLSessionStreamTask) -> Void)? {
-        get {
-            return _streamTaskReadClosed as? (URLSession, URLSessionStreamTask) -> Void
-        }
-        set {
-            _streamTaskReadClosed = newValue
-        }
-    }
-
-    /// Overrides default behavior for URLSessionStreamDelegate method `urlSession(_:writeClosedFor:)`.
-    @available(iOS 9.0, macOS 10.11, tvOS 9.0, *)
-    open var streamTaskWriteClosed: ((URLSession, URLSessionStreamTask) -> Void)? {
-        get {
-            return _streamTaskWriteClosed as? (URLSession, URLSessionStreamTask) -> Void
-        }
-        set {
-            _streamTaskWriteClosed = newValue
-        }
-    }
-
-    /// Overrides default behavior for URLSessionStreamDelegate method `urlSession(_:betterRouteDiscoveredFor:)`.
-    @available(iOS 9.0, macOS 10.11, tvOS 9.0, *)
-    open var streamTaskBetterRouteDiscovered: ((URLSession, URLSessionStreamTask) -> Void)? {
-        get {
-            return _streamTaskBetterRouteDiscovered as? (URLSession, URLSessionStreamTask) -> Void
-        }
-        set {
-            _streamTaskBetterRouteDiscovered = newValue
-        }
-    }
-
-    /// Overrides default behavior for URLSessionStreamDelegate method `urlSession(_:streamTask:didBecome:outputStream:)`.
-    @available(iOS 9.0, macOS 10.11, tvOS 9.0, *)
-    open var streamTaskDidBecomeInputAndOutputStreams: ((URLSession, URLSessionStreamTask, InputStream, OutputStream) -> Void)? {
-        get {
-            return _streamTaskDidBecomeInputStream as? (URLSession, URLSessionStreamTask, InputStream, OutputStream) -> Void
-        }
-        set {
-            _streamTaskDidBecomeInputStream = newValue
-        }
-    }
-
-    var _streamTaskReadClosed: Any?
-    var _streamTaskWriteClosed: Any?
-    var _streamTaskBetterRouteDiscovered: Any?
-    var _streamTaskDidBecomeInputStream: Any?
-
-#endif
-
-    // MARK: Properties
-
-    var retrier: RequestRetrier?
-    weak var sessionManager: SessionManager?
-
-    var requests: [Int: Request] = [:]
-    private let lock = NSLock()
-
-    /// Access the task delegate for the specified task in a thread-safe manner.
-    open subscript(task: URLSessionTask) -> Request? {
-        get {
-            lock.lock() ; defer { lock.unlock() }
-            return requests[task.taskIdentifier]
-        }
-        set {
-            lock.lock() ; defer { lock.unlock() }
-            requests[task.taskIdentifier] = newValue
-        }
-    }
-
-    // MARK: Lifecycle
-
-    /// Initializes the `SessionDelegate` instance.
-    ///
-    /// - returns: The new `SessionDelegate` instance.
-    public override init() {
-        super.init()
-    }
-
-    // MARK: NSObject Overrides
-
-    /// Returns a `Bool` indicating whether the `SessionDelegate` implements or inherits a method that can respond
-    /// to a specified message.
-    ///
-    /// - parameter selector: A selector that identifies a message.
-    ///
-    /// - returns: `true` if the receiver implements or inherits a method that can respond to selector, otherwise `false`.
-    open override func responds(to selector: Selector) -> Bool {
-        #if !os(macOS)
-            if selector == #selector(URLSessionDelegate.urlSessionDidFinishEvents(forBackgroundURLSession:)) {
-                return sessionDidFinishEventsForBackgroundURLSession != nil
-            }
-        #endif
-
-        #if !os(watchOS)
-            if #available(iOS 9.0, macOS 10.11, tvOS 9.0, *) {
-                switch selector {
-                case #selector(URLSessionStreamDelegate.urlSession(_:readClosedFor:)):
-                    return streamTaskReadClosed != nil
-                case #selector(URLSessionStreamDelegate.urlSession(_:writeClosedFor:)):
-                    return streamTaskWriteClosed != nil
-                case #selector(URLSessionStreamDelegate.urlSession(_:betterRouteDiscoveredFor:)):
-                    return streamTaskBetterRouteDiscovered != nil
-                case #selector(URLSessionStreamDelegate.urlSession(_:streamTask:didBecome:outputStream:)):
-                    return streamTaskDidBecomeInputAndOutputStreams != nil
-                default:
-                    break
-                }
-            }
-        #endif
-
-        switch selector {
-        case #selector(URLSessionDelegate.urlSession(_:didBecomeInvalidWithError:)):
-            return sessionDidBecomeInvalidWithError != nil
-        case #selector(URLSessionDelegate.urlSession(_:didReceive:completionHandler:)):
-            return (sessionDidReceiveChallenge != nil  || sessionDidReceiveChallengeWithCompletion != nil)
-        case #selector(URLSessionTaskDelegate.urlSession(_:task:willPerformHTTPRedirection:newRequest:completionHandler:)):
-            return (taskWillPerformHTTPRedirection != nil || taskWillPerformHTTPRedirectionWithCompletion != nil)
-        case #selector(URLSessionDataDelegate.urlSession(_:dataTask:didReceive:completionHandler:)):
-            return (dataTaskDidReceiveResponse != nil || dataTaskDidReceiveResponseWithCompletion != nil)
-        default:
-            return type(of: self).instancesRespond(to: selector)
-        }
-    }
-}
-
-// MARK: - URLSessionDelegate
-
-extension SessionDelegate: URLSessionDelegate {
-    /// Tells the delegate that the session has been invalidated.
-    ///
-    /// - parameter session: The session object that was invalidated.
-    /// - parameter error:   The error that caused invalidation, or nil if the invalidation was explicit.
-    open func urlSession(_ session: URLSession, didBecomeInvalidWithError error: Error?) {
-        sessionDidBecomeInvalidWithError?(session, error)
-    }
-
-    /// Requests credentials from the delegate in response to a session-level authentication request from the
-    /// remote server.
-    ///
-    /// - parameter session:           The session containing the task that requested authentication.
-    /// - parameter challenge:         An object that contains the request for authentication.
-    /// - parameter completionHandler: A handler that your delegate method must call providing the disposition
-    ///                                and credential.
-    open func urlSession(
-        _ session: URLSession,
-        didReceive challenge: URLAuthenticationChallenge,
-        completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void)
-    {
-        guard sessionDidReceiveChallengeWithCompletion == nil else {
-            sessionDidReceiveChallengeWithCompletion?(session, challenge, completionHandler)
-            return
-        }
-
-        var disposition: URLSession.AuthChallengeDisposition = .performDefaultHandling
-        var credential: URLCredential?
-
-        if let sessionDidReceiveChallenge = sessionDidReceiveChallenge {
-            (disposition, credential) = sessionDidReceiveChallenge(session, challenge)
-        } else if challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodServerTrust {
-            let host = challenge.protectionSpace.host
-
-            if
-                let serverTrustPolicy = session.serverTrustPolicyManager?.serverTrustPolicy(forHost: host),
-                let serverTrust = challenge.protectionSpace.serverTrust
-            {
-                if serverTrustPolicy.evaluate(serverTrust, forHost: host) {
-                    disposition = .useCredential
-                    credential = URLCredential(trust: serverTrust)
-                } else {
-                    disposition = .cancelAuthenticationChallenge
-                }
-            }
-        }
-
-        completionHandler(disposition, credential)
-    }
-
-#if !os(macOS)
-
-    /// Tells the delegate that all messages enqueued for a session have been delivered.
-    ///
-    /// - parameter session: The session that no longer has any outstanding requests.
-    open func urlSessionDidFinishEvents(forBackgroundURLSession session: URLSession) {
-        sessionDidFinishEventsForBackgroundURLSession?(session)
-    }
-
-#endif
-}
-
-// MARK: - URLSessionTaskDelegate
-
-extension SessionDelegate: URLSessionTaskDelegate {
-    /// Tells the delegate that the remote server requested an HTTP redirect.
-    ///
-    /// - parameter session:           The session containing the task whose request resulted in a redirect.
-    /// - parameter task:              The task whose request resulted in a redirect.
-    /// - parameter response:          An object containing the server’s response to the original request.
-    /// - parameter request:           A URL request object filled out with the new location.
-    /// - parameter completionHandler: A closure that your handler should call with either the value of the request
-    ///                                parameter, a modified URL request object, or NULL to refuse the redirect and
-    ///                                return the body of the redirect response.
-    open func urlSession(
-        _ session: URLSession,
-        task: URLSessionTask,
-        willPerformHTTPRedirection response: HTTPURLResponse,
-        newRequest request: URLRequest,
-        completionHandler: @escaping (URLRequest?) -> Void)
-    {
-        guard taskWillPerformHTTPRedirectionWithCompletion == nil else {
-            taskWillPerformHTTPRedirectionWithCompletion?(session, task, response, request, completionHandler)
-            return
-        }
-
-        var redirectRequest: URLRequest? = request
-
-        if let taskWillPerformHTTPRedirection = taskWillPerformHTTPRedirection {
-            redirectRequest = taskWillPerformHTTPRedirection(session, task, response, request)
-        }
-
-        completionHandler(redirectRequest)
-    }
-
-    /// Requests credentials from the delegate in response to an authentication request from the remote server.
-    ///
-    /// - parameter session:           The session containing the task whose request requires authentication.
-    /// - parameter task:              The task whose request requires authentication.
-    /// - parameter challenge:         An object that contains the request for authentication.
-    /// - parameter completionHandler: A handler that your delegate method must call providing the disposition
-    ///                                and credential.
-    open func urlSession(
-        _ session: URLSession,
-        task: URLSessionTask,
-        didReceive challenge: URLAuthenticationChallenge,
-        completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void)
-    {
-        guard taskDidReceiveChallengeWithCompletion == nil else {
-            taskDidReceiveChallengeWithCompletion?(session, task, challenge, completionHandler)
-            return
-        }
-
-        if let taskDidReceiveChallenge = taskDidReceiveChallenge {
-            let result = taskDidReceiveChallenge(session, task, challenge)
-            completionHandler(result.0, result.1)
-        } else if let delegate = self[task]?.delegate {
-            delegate.urlSession(
-                session,
-                task: task,
-                didReceive: challenge,
-                completionHandler: completionHandler
-            )
-        } else {
-            urlSession(session, didReceive: challenge, completionHandler: completionHandler)
-        }
-    }
-
-    /// Tells the delegate when a task requires a new request body stream to send to the remote server.
-    ///
-    /// - parameter session:           The session containing the task that needs a new body stream.
-    /// - parameter task:              The task that needs a new body stream.
-    /// - parameter completionHandler: A completion handler that your delegate method should call with the new body stream.
-    open func urlSession(
-        _ session: URLSession,
-        task: URLSessionTask,
-        needNewBodyStream completionHandler: @escaping (InputStream?) -> Void)
-    {
-        guard taskNeedNewBodyStreamWithCompletion == nil else {
-            taskNeedNewBodyStreamWithCompletion?(session, task, completionHandler)
-            return
-        }
-
-        if let taskNeedNewBodyStream = taskNeedNewBodyStream {
-            completionHandler(taskNeedNewBodyStream(session, task))
-        } else if let delegate = self[task]?.delegate {
-            delegate.urlSession(session, task: task, needNewBodyStream: completionHandler)
-        }
-    }
-
-    /// Periodically informs the delegate of the progress of sending body content to the server.
-    ///
-    /// - parameter session:                  The session containing the data task.
-    /// - parameter task:                     The data task.
-    /// - parameter bytesSent:                The number of bytes sent since the last time this delegate method was called.
-    /// - parameter totalBytesSent:           The total number of bytes sent so far.
-    /// - parameter totalBytesExpectedToSend: The expected length of the body data.
-    open func urlSession(
-        _ session: URLSession,
-        task: URLSessionTask,
-        didSendBodyData bytesSent: Int64,
-        totalBytesSent: Int64,
-        totalBytesExpectedToSend: Int64)
-    {
-        if let taskDidSendBodyData = taskDidSendBodyData {
-            taskDidSendBodyData(session, task, bytesSent, totalBytesSent, totalBytesExpectedToSend)
-        } else if let delegate = self[task]?.delegate as? UploadTaskDelegate {
-            delegate.URLSession(
-                session,
-                task: task,
-                didSendBodyData: bytesSent,
-                totalBytesSent: totalBytesSent,
-                totalBytesExpectedToSend: totalBytesExpectedToSend
-            )
-        }
-    }
-
-#if !os(watchOS)
-
-    /// Tells the delegate that the session finished collecting metrics for the task.
-    ///
-    /// - parameter session: The session collecting the metrics.
-    /// - parameter task:    The task whose metrics have been collected.
-    /// - parameter metrics: The collected metrics.
-    @available(iOS 10.0, macOS 10.12, tvOS 10.0, *)
-    @objc(URLSession:task:didFinishCollectingMetrics:)
-    open func urlSession(_ session: URLSession, task: URLSessionTask, didFinishCollecting metrics: URLSessionTaskMetrics) {
-        self[task]?.delegate.metrics = metrics
-    }
-
-#endif
-
-    /// Tells the delegate that the task finished transferring data.
-    ///
-    /// - parameter session: The session containing the task whose request finished transferring data.
-    /// - parameter task:    The task whose request finished transferring data.
-    /// - parameter error:   If an error occurred, an error object indicating how the transfer failed, otherwise nil.
-    open func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?) {
-        /// Executed after it is determined that the request is not going to be retried
-        let completeTask: (URLSession, URLSessionTask, Error?) -> Void = { [weak self] session, task, error in
-            guard let strongSelf = self else { return }
-
-            strongSelf.taskDidComplete?(session, task, error)
-
-            strongSelf[task]?.delegate.urlSession(session, task: task, didCompleteWithError: error)
-
-            var userInfo: [String: Any] = [Notification.Key.Task: task]
-
-            if let data = (strongSelf[task]?.delegate as? DataTaskDelegate)?.data {
-                userInfo[Notification.Key.ResponseData] = data
-            }
-
-            NotificationCenter.default.post(
-                name: Notification.Name.Task.DidComplete,
-                object: strongSelf,
-                userInfo: userInfo
-            )
-
-            strongSelf[task] = nil
-        }
-
-        guard let request = self[task], let sessionManager = sessionManager else {
-            completeTask(session, task, error)
-            return
-        }
-
-        // Run all validations on the request before checking if an error occurred
-        request.validations.forEach { $0() }
-
-        // Determine whether an error has occurred
-        var error: Error? = error
-
-        if request.delegate.error != nil {
-            error = request.delegate.error
-        }
-
-        /// If an error occurred and the retrier is set, asynchronously ask the retrier if the request
-        /// should be retried. Otherwise, complete the task by notifying the task delegate.
-        if let retrier = retrier, let error = error {
-            retrier.should(sessionManager, retry: request, with: error) { [weak self] shouldRetry, timeDelay in
-                guard shouldRetry else { completeTask(session, task, error) ; return }
-
-                DispatchQueue.utility.after(timeDelay) { [weak self] in
-                    guard let strongSelf = self else { return }
-
-                    let retrySucceeded = strongSelf.sessionManager?.retry(request) ?? false
-
-                    if retrySucceeded, let task = request.task {
-                        strongSelf[task] = request
-                        return
-                    } else {
-                        completeTask(session, task, error)
-                    }
-                }
-            }
-        } else {
-            completeTask(session, task, error)
-        }
-    }
-}
-
-// MARK: - URLSessionDataDelegate
-
-extension SessionDelegate: URLSessionDataDelegate {
-    /// Tells the delegate that the data task received the initial reply (headers) from the server.
-    ///
-    /// - parameter session:           The session containing the data task that received an initial reply.
-    /// - parameter dataTask:          The data task that received an initial reply.
-    /// - parameter response:          A URL response object populated with headers.
-    /// - parameter completionHandler: A completion handler that your code calls to continue the transfer, passing a
-    ///                                constant to indicate whether the transfer should continue as a data task or
-    ///                                should become a download task.
-    open func urlSession(
-        _ session: URLSession,
-        dataTask: URLSessionDataTask,
-        didReceive response: URLResponse,
-        completionHandler: @escaping (URLSession.ResponseDisposition) -> Void)
-    {
-        guard dataTaskDidReceiveResponseWithCompletion == nil else {
-            dataTaskDidReceiveResponseWithCompletion?(session, dataTask, response, completionHandler)
-            return
-        }
-
-        var disposition: URLSession.ResponseDisposition = .allow
-
-        if let dataTaskDidReceiveResponse = dataTaskDidReceiveResponse {
-            disposition = dataTaskDidReceiveResponse(session, dataTask, response)
-        }
-
-        completionHandler(disposition)
-    }
-
-    /// Tells the delegate that the data task was changed to a download task.
-    ///
-    /// - parameter session:      The session containing the task that was replaced by a download task.
-    /// - parameter dataTask:     The data task that was replaced by a download task.
-    /// - parameter downloadTask: The new download task that replaced the data task.
-    open func urlSession(
-        _ session: URLSession,
-        dataTask: URLSessionDataTask,
-        didBecome downloadTask: URLSessionDownloadTask)
-    {
-        if let dataTaskDidBecomeDownloadTask = dataTaskDidBecomeDownloadTask {
-            dataTaskDidBecomeDownloadTask(session, dataTask, downloadTask)
-        } else {
-            self[downloadTask]?.delegate = DownloadTaskDelegate(task: downloadTask)
-        }
-    }
-
-    /// Tells the delegate that the data task has received some of the expected data.
-    ///
-    /// - parameter session:  The session containing the data task that provided data.
-    /// - parameter dataTask: The data task that provided data.
-    /// - parameter data:     A data object containing the transferred data.
-    open func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive data: Data) {
-        if let dataTaskDidReceiveData = dataTaskDidReceiveData {
-            dataTaskDidReceiveData(session, dataTask, data)
-        } else if let delegate = self[dataTask]?.delegate as? DataTaskDelegate {
-            delegate.urlSession(session, dataTask: dataTask, didReceive: data)
-        }
-    }
-
-    /// Asks the delegate whether the data (or upload) task should store the response in the cache.
-    ///
-    /// - parameter session:           The session containing the data (or upload) task.
-    /// - parameter dataTask:          The data (or upload) task.
-    /// - parameter proposedResponse:  The default caching behavior. This behavior is determined based on the current
-    ///                                caching policy and the values of certain received headers, such as the Pragma
-    ///                                and Cache-Control headers.
-    /// - parameter completionHandler: A block that your handler must call, providing either the original proposed
-    ///                                response, a modified version of that response, or NULL to prevent caching the
-    ///                                response. If your delegate implements this method, it must call this completion
-    ///                                handler; otherwise, your app leaks memory.
-    open func urlSession(
-        _ session: URLSession,
-        dataTask: URLSessionDataTask,
-        willCacheResponse proposedResponse: CachedURLResponse,
-        completionHandler: @escaping (CachedURLResponse?) -> Void)
-    {
-        guard dataTaskWillCacheResponseWithCompletion == nil else {
-            dataTaskWillCacheResponseWithCompletion?(session, dataTask, proposedResponse, completionHandler)
-            return
-        }
-
-        if let dataTaskWillCacheResponse = dataTaskWillCacheResponse {
-            completionHandler(dataTaskWillCacheResponse(session, dataTask, proposedResponse))
-        } else if let delegate = self[dataTask]?.delegate as? DataTaskDelegate {
-            delegate.urlSession(
-                session,
-                dataTask: dataTask,
-                willCacheResponse: proposedResponse,
-                completionHandler: completionHandler
-            )
-        } else {
-            completionHandler(proposedResponse)
-        }
-    }
-}
-
-// MARK: - URLSessionDownloadDelegate
-
-extension SessionDelegate: URLSessionDownloadDelegate {
-    /// Tells the delegate that a download task has finished downloading.
-    ///
-    /// - parameter session:      The session containing the download task that finished.
-    /// - parameter downloadTask: The download task that finished.
-    /// - parameter location:     A file URL for the temporary file. Because the file is temporary, you must either
-    ///                           open the file for reading or move it to a permanent location in your app’s sandbox
-    ///                           container directory before returning from this delegate method.
-    open func urlSession(
-        _ session: URLSession,
-        downloadTask: URLSessionDownloadTask,
-        didFinishDownloadingTo location: URL)
-    {
-        if let downloadTaskDidFinishDownloadingToURL = downloadTaskDidFinishDownloadingToURL {
-            downloadTaskDidFinishDownloadingToURL(session, downloadTask, location)
-        } else if let delegate = self[downloadTask]?.delegate as? DownloadTaskDelegate {
-            delegate.urlSession(session, downloadTask: downloadTask, didFinishDownloadingTo: location)
-        }
-    }
-
-    /// Periodically informs the delegate about the download’s progress.
-    ///
-    /// - parameter session:                   The session containing the download task.
-    /// - parameter downloadTask:              The download task.
-    /// - parameter bytesWritten:              The number of bytes transferred since the last time this delegate
-    ///                                        method was called.
-    /// - parameter totalBytesWritten:         The total number of bytes transferred so far.
-    /// - parameter totalBytesExpectedToWrite: The expected length of the file, as provided by the Content-Length
-    ///                                        header. If this header was not provided, the value is
-    ///                                        `NSURLSessionTransferSizeUnknown`.
-    open func urlSession(
-        _ session: URLSession,
-        downloadTask: URLSessionDownloadTask,
-        didWriteData bytesWritten: Int64,
-        totalBytesWritten: Int64,
-        totalBytesExpectedToWrite: Int64)
-    {
-        if let downloadTaskDidWriteData = downloadTaskDidWriteData {
-            downloadTaskDidWriteData(session, downloadTask, bytesWritten, totalBytesWritten, totalBytesExpectedToWrite)
-        } else if let delegate = self[downloadTask]?.delegate as? DownloadTaskDelegate {
-            delegate.urlSession(
-                session,
-                downloadTask: downloadTask,
-                didWriteData: bytesWritten,
-                totalBytesWritten: totalBytesWritten,
-                totalBytesExpectedToWrite: totalBytesExpectedToWrite
-            )
-        }
-    }
-
-    /// Tells the delegate that the download task has resumed downloading.
-    ///
-    /// - parameter session:            The session containing the download task that finished.
-    /// - parameter downloadTask:       The download task that resumed. See explanation in the discussion.
-    /// - parameter fileOffset:         If the file's cache policy or last modified date prevents reuse of the
-    ///                                 existing content, then this value is zero. Otherwise, this value is an
-    ///                                 integer representing the number of bytes on disk that do not need to be
-    ///                                 retrieved again.
-    /// - parameter expectedTotalBytes: The expected length of the file, as provided by the Content-Length header.
-    ///                                 If this header was not provided, the value is NSURLSessionTransferSizeUnknown.
-    open func urlSession(
-        _ session: URLSession,
-        downloadTask: URLSessionDownloadTask,
-        didResumeAtOffset fileOffset: Int64,
-        expectedTotalBytes: Int64)
-    {
-        if let downloadTaskDidResumeAtOffset = downloadTaskDidResumeAtOffset {
-            downloadTaskDidResumeAtOffset(session, downloadTask, fileOffset, expectedTotalBytes)
-        } else if let delegate = self[downloadTask]?.delegate as? DownloadTaskDelegate {
-            delegate.urlSession(
-                session,
-                downloadTask: downloadTask,
-                didResumeAtOffset: fileOffset,
-                expectedTotalBytes: expectedTotalBytes
-            )
-        }
-    }
-}
-
-// MARK: - URLSessionStreamDelegate
-
-#if !os(watchOS)
-
-@available(iOS 9.0, macOS 10.11, tvOS 9.0, *)
-extension SessionDelegate: URLSessionStreamDelegate {
-    /// Tells the delegate that the read side of the connection has been closed.
-    ///
-    /// - parameter session:    The session.
-    /// - parameter streamTask: The stream task.
-    open func urlSession(_ session: URLSession, readClosedFor streamTask: URLSessionStreamTask) {
-        streamTaskReadClosed?(session, streamTask)
-    }
-
-    /// Tells the delegate that the write side of the connection has been closed.
-    ///
-    /// - parameter session:    The session.
-    /// - parameter streamTask: The stream task.
-    open func urlSession(_ session: URLSession, writeClosedFor streamTask: URLSessionStreamTask) {
-        streamTaskWriteClosed?(session, streamTask)
-    }
-
-    /// Tells the delegate that the system has determined that a better route to the host is available.
-    ///
-    /// - parameter session:    The session.
-    /// - parameter streamTask: The stream task.
-    open func urlSession(_ session: URLSession, betterRouteDiscoveredFor streamTask: URLSessionStreamTask) {
-        streamTaskBetterRouteDiscovered?(session, streamTask)
-    }
-
-    /// Tells the delegate that the stream task has been completed and provides the unopened stream objects.
-    ///
-    /// - parameter session:      The session.
-    /// - parameter streamTask:   The stream task.
-    /// - parameter inputStream:  The new input stream.
-    /// - parameter outputStream: The new output stream.
-    open func urlSession(
-        _ session: URLSession,
-        streamTask: URLSessionStreamTask,
-        didBecome inputStream: InputStream,
-        outputStream: OutputStream)
-    {
-        streamTaskDidBecomeInputAndOutputStreams?(session, streamTask, inputStream, outputStream)
-    }
-}
-
-#endif

+ 0 - 899
Example/Pods/Alamofire/Source/SessionManager.swift

@@ -1,899 +0,0 @@
-//
-//  SessionManager.swift
-//
-//  Copyright (c) 2014 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
-
-/// Responsible for creating and managing `Request` objects, as well as their underlying `NSURLSession`.
-open class SessionManager {
-
-    // MARK: - Helper Types
-
-    /// Defines whether the `MultipartFormData` encoding was successful and contains result of the encoding as
-    /// associated values.
-    ///
-    /// - Success: Represents a successful `MultipartFormData` encoding and contains the new `UploadRequest` along with
-    ///            streaming information.
-    /// - Failure: Used to represent a failure in the `MultipartFormData` encoding and also contains the encoding
-    ///            error.
-    public enum MultipartFormDataEncodingResult {
-        case success(request: UploadRequest, streamingFromDisk: Bool, streamFileURL: URL?)
-        case failure(Error)
-    }
-
-    // MARK: - Properties
-
-    /// A default instance of `SessionManager`, used by top-level Alamofire request methods, and suitable for use
-    /// directly for any ad hoc requests.
-    public static let `default`: SessionManager = {
-        let configuration = URLSessionConfiguration.default
-        configuration.httpAdditionalHeaders = SessionManager.defaultHTTPHeaders
-
-        return SessionManager(configuration: configuration)
-    }()
-
-    /// Creates default values for the "Accept-Encoding", "Accept-Language" and "User-Agent" headers.
-    public static let defaultHTTPHeaders: HTTPHeaders = {
-        // Accept-Encoding HTTP Header; see https://tools.ietf.org/html/rfc7230#section-4.2.3
-        let acceptEncoding: String = "gzip;q=1.0, compress;q=0.5"
-
-        // Accept-Language HTTP Header; see https://tools.ietf.org/html/rfc7231#section-5.3.5
-        let acceptLanguage = Locale.preferredLanguages.prefix(6).enumerated().map { index, languageCode in
-            let quality = 1.0 - (Double(index) * 0.1)
-            return "\(languageCode);q=\(quality)"
-        }.joined(separator: ", ")
-
-        // User-Agent Header; see https://tools.ietf.org/html/rfc7231#section-5.5.3
-        // Example: `iOS Example/1.0 (org.alamofire.iOS-Example; build:1; iOS 10.0.0) Alamofire/4.0.0`
-        let userAgent: String = {
-            if let info = Bundle.main.infoDictionary {
-                let executable = info[kCFBundleExecutableKey as String] as? String ?? "Unknown"
-                let bundle = info[kCFBundleIdentifierKey as String] as? String ?? "Unknown"
-                let appVersion = info["CFBundleShortVersionString"] as? String ?? "Unknown"
-                let appBuild = info[kCFBundleVersionKey as String] as? String ?? "Unknown"
-
-                let osNameVersion: String = {
-                    let version = ProcessInfo.processInfo.operatingSystemVersion
-                    let versionString = "\(version.majorVersion).\(version.minorVersion).\(version.patchVersion)"
-
-                    let osName: String = {
-                        #if os(iOS)
-                            return "iOS"
-                        #elseif os(watchOS)
-                            return "watchOS"
-                        #elseif os(tvOS)
-                            return "tvOS"
-                        #elseif os(macOS)
-                            return "OS X"
-                        #elseif os(Linux)
-                            return "Linux"
-                        #else
-                            return "Unknown"
-                        #endif
-                    }()
-
-                    return "\(osName) \(versionString)"
-                }()
-
-                let alamofireVersion: String = {
-                    guard
-                        let afInfo = Bundle(for: SessionManager.self).infoDictionary,
-                        let build = afInfo["CFBundleShortVersionString"]
-                    else { return "Unknown" }
-
-                    return "Alamofire/\(build)"
-                }()
-
-                return "\(executable)/\(appVersion) (\(bundle); build:\(appBuild); \(osNameVersion)) \(alamofireVersion)"
-            }
-
-            return "Alamofire"
-        }()
-
-        return [
-            "Accept-Encoding": acceptEncoding,
-            "Accept-Language": acceptLanguage,
-            "User-Agent": userAgent
-        ]
-    }()
-
-    /// Default memory threshold used when encoding `MultipartFormData` in bytes.
-    public static let multipartFormDataEncodingMemoryThreshold: UInt64 = 10_000_000
-
-    /// The underlying session.
-    public let session: URLSession
-
-    /// The session delegate handling all the task and session delegate callbacks.
-    public let delegate: SessionDelegate
-
-    /// Whether to start requests immediately after being constructed. `true` by default.
-    open var startRequestsImmediately: Bool = true
-
-    /// The request adapter called each time a new request is created.
-    open var adapter: RequestAdapter?
-
-    /// The request retrier called each time a request encounters an error to determine whether to retry the request.
-    open var retrier: RequestRetrier? {
-        get { return delegate.retrier }
-        set { delegate.retrier = newValue }
-    }
-
-    /// The background completion handler closure provided by the UIApplicationDelegate
-    /// `application:handleEventsForBackgroundURLSession:completionHandler:` method. By setting the background
-    /// completion handler, the SessionDelegate `sessionDidFinishEventsForBackgroundURLSession` closure implementation
-    /// will automatically call the handler.
-    ///
-    /// If you need to handle your own events before the handler is called, then you need to override the
-    /// SessionDelegate `sessionDidFinishEventsForBackgroundURLSession` and manually call the handler when finished.
-    ///
-    /// `nil` by default.
-    open var backgroundCompletionHandler: (() -> Void)?
-
-    let queue = DispatchQueue(label: "org.alamofire.session-manager." + UUID().uuidString)
-
-    // MARK: - Lifecycle
-
-    /// Creates an instance with the specified `configuration`, `delegate` and `serverTrustPolicyManager`.
-    ///
-    /// - parameter configuration:            The configuration used to construct the managed session.
-    ///                                       `URLSessionConfiguration.default` by default.
-    /// - parameter delegate:                 The delegate used when initializing the session. `SessionDelegate()` by
-    ///                                       default.
-    /// - parameter serverTrustPolicyManager: The server trust policy manager to use for evaluating all server trust
-    ///                                       challenges. `nil` by default.
-    ///
-    /// - returns: The new `SessionManager` instance.
-    public init(
-        configuration: URLSessionConfiguration = URLSessionConfiguration.default,
-        delegate: SessionDelegate = SessionDelegate(),
-        serverTrustPolicyManager: ServerTrustPolicyManager? = nil)
-    {
-        self.delegate = delegate
-        self.session = URLSession(configuration: configuration, delegate: delegate, delegateQueue: nil)
-
-        commonInit(serverTrustPolicyManager: serverTrustPolicyManager)
-    }
-
-    /// Creates an instance with the specified `session`, `delegate` and `serverTrustPolicyManager`.
-    ///
-    /// - parameter session:                  The URL session.
-    /// - parameter delegate:                 The delegate of the URL session. Must equal the URL session's delegate.
-    /// - parameter serverTrustPolicyManager: The server trust policy manager to use for evaluating all server trust
-    ///                                       challenges. `nil` by default.
-    ///
-    /// - returns: The new `SessionManager` instance if the URL session's delegate matches; `nil` otherwise.
-    public init?(
-        session: URLSession,
-        delegate: SessionDelegate,
-        serverTrustPolicyManager: ServerTrustPolicyManager? = nil)
-    {
-        guard delegate === session.delegate else { return nil }
-
-        self.delegate = delegate
-        self.session = session
-
-        commonInit(serverTrustPolicyManager: serverTrustPolicyManager)
-    }
-
-    private func commonInit(serverTrustPolicyManager: ServerTrustPolicyManager?) {
-        session.serverTrustPolicyManager = serverTrustPolicyManager
-
-        delegate.sessionManager = self
-
-        delegate.sessionDidFinishEventsForBackgroundURLSession = { [weak self] session in
-            guard let strongSelf = self else { return }
-            DispatchQueue.main.async { strongSelf.backgroundCompletionHandler?() }
-        }
-    }
-
-    deinit {
-        session.invalidateAndCancel()
-    }
-
-    // MARK: - Data Request
-
-    /// Creates a `DataRequest` to retrieve the contents of the specified `url`, `method`, `parameters`, `encoding`
-    /// and `headers`.
-    ///
-    /// - parameter url:        The URL.
-    /// - parameter method:     The HTTP method. `.get` by default.
-    /// - parameter parameters: The parameters. `nil` by default.
-    /// - parameter encoding:   The parameter encoding. `URLEncoding.default` by default.
-    /// - parameter headers:    The HTTP headers. `nil` by default.
-    ///
-    /// - returns: The created `DataRequest`.
-    @discardableResult
-    open func request(
-        _ url: URLConvertible,
-        method: HTTPMethod = .get,
-        parameters: Parameters? = nil,
-        encoding: ParameterEncoding = URLEncoding.default,
-        headers: HTTPHeaders? = nil)
-        -> DataRequest
-    {
-        var originalRequest: URLRequest?
-
-        do {
-            originalRequest = try URLRequest(url: url, method: method, headers: headers)
-            let encodedURLRequest = try encoding.encode(originalRequest!, with: parameters)
-            return request(encodedURLRequest)
-        } catch {
-            return request(originalRequest, failedWith: error)
-        }
-    }
-
-    /// Creates a `DataRequest` to retrieve the contents of a URL based on the specified `urlRequest`.
-    ///
-    /// If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned.
-    ///
-    /// - parameter urlRequest: The URL request.
-    ///
-    /// - returns: The created `DataRequest`.
-    @discardableResult
-    open func request(_ urlRequest: URLRequestConvertible) -> DataRequest {
-        var originalRequest: URLRequest?
-
-        do {
-            originalRequest = try urlRequest.asURLRequest()
-            let originalTask = DataRequest.Requestable(urlRequest: originalRequest!)
-
-            let task = try originalTask.task(session: session, adapter: adapter, queue: queue)
-            let request = DataRequest(session: session, requestTask: .data(originalTask, task))
-
-            delegate[task] = request
-
-            if startRequestsImmediately { request.resume() }
-
-            return request
-        } catch {
-            return request(originalRequest, failedWith: error)
-        }
-    }
-
-    // MARK: Private - Request Implementation
-
-    private func request(_ urlRequest: URLRequest?, failedWith error: Error) -> DataRequest {
-        var requestTask: Request.RequestTask = .data(nil, nil)
-
-        if let urlRequest = urlRequest {
-            let originalTask = DataRequest.Requestable(urlRequest: urlRequest)
-            requestTask = .data(originalTask, nil)
-        }
-
-        let underlyingError = error.underlyingAdaptError ?? error
-        let request = DataRequest(session: session, requestTask: requestTask, error: underlyingError)
-
-        if let retrier = retrier, error is AdaptError {
-            allowRetrier(retrier, toRetry: request, with: underlyingError)
-        } else {
-            if startRequestsImmediately { request.resume() }
-        }
-
-        return request
-    }
-
-    // MARK: - Download Request
-
-    // MARK: URL Request
-
-    /// Creates a `DownloadRequest` to retrieve the contents the specified `url`, `method`, `parameters`, `encoding`,
-    /// `headers` and save them to the `destination`.
-    ///
-    /// If `destination` is not specified, the contents will remain in the temporary location determined by the
-    /// underlying URL session.
-    ///
-    /// If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned.
-    ///
-    /// - parameter url:         The URL.
-    /// - parameter method:      The HTTP method. `.get` by default.
-    /// - parameter parameters:  The parameters. `nil` by default.
-    /// - parameter encoding:    The parameter encoding. `URLEncoding.default` by default.
-    /// - parameter headers:     The HTTP headers. `nil` by default.
-    /// - parameter destination: The closure used to determine the destination of the downloaded file. `nil` by default.
-    ///
-    /// - returns: The created `DownloadRequest`.
-    @discardableResult
-    open func download(
-        _ url: URLConvertible,
-        method: HTTPMethod = .get,
-        parameters: Parameters? = nil,
-        encoding: ParameterEncoding = URLEncoding.default,
-        headers: HTTPHeaders? = nil,
-        to destination: DownloadRequest.DownloadFileDestination? = nil)
-        -> DownloadRequest
-    {
-        do {
-            let urlRequest = try URLRequest(url: url, method: method, headers: headers)
-            let encodedURLRequest = try encoding.encode(urlRequest, with: parameters)
-            return download(encodedURLRequest, to: destination)
-        } catch {
-            return download(nil, to: destination, failedWith: error)
-        }
-    }
-
-    /// Creates a `DownloadRequest` to retrieve the contents of a URL based on the specified `urlRequest` and save
-    /// them to the `destination`.
-    ///
-    /// If `destination` is not specified, the contents will remain in the temporary location determined by the
-    /// underlying URL session.
-    ///
-    /// If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned.
-    ///
-    /// - parameter urlRequest:  The URL request
-    /// - parameter destination: The closure used to determine the destination of the downloaded file. `nil` by default.
-    ///
-    /// - returns: The created `DownloadRequest`.
-    @discardableResult
-    open func download(
-        _ urlRequest: URLRequestConvertible,
-        to destination: DownloadRequest.DownloadFileDestination? = nil)
-        -> DownloadRequest
-    {
-        do {
-            let urlRequest = try urlRequest.asURLRequest()
-            return download(.request(urlRequest), to: destination)
-        } catch {
-            return download(nil, to: destination, failedWith: error)
-        }
-    }
-
-    // MARK: Resume Data
-
-    /// Creates a `DownloadRequest` from the `resumeData` produced from a previous request cancellation to retrieve
-    /// the contents of the original request and save them to the `destination`.
-    ///
-    /// If `destination` is not specified, the contents will remain in the temporary location determined by the
-    /// underlying URL session.
-    ///
-    /// If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned.
-    ///
-    /// On the latest release of all the Apple platforms (iOS 10, macOS 10.12, tvOS 10, watchOS 3), `resumeData` is broken
-    /// on background URL session configurations. There's an underlying bug in the `resumeData` generation logic where the
-    /// data is written incorrectly and will always fail to resume the download. For more information about the bug and
-    /// possible workarounds, please refer to the following Stack Overflow post:
-    ///
-    ///    - http://stackoverflow.com/a/39347461/1342462
-    ///
-    /// - parameter resumeData:  The resume data. This is an opaque data blob produced by `URLSessionDownloadTask`
-    ///                          when a task is cancelled. See `URLSession -downloadTask(withResumeData:)` for
-    ///                          additional information.
-    /// - parameter destination: The closure used to determine the destination of the downloaded file. `nil` by default.
-    ///
-    /// - returns: The created `DownloadRequest`.
-    @discardableResult
-    open func download(
-        resumingWith resumeData: Data,
-        to destination: DownloadRequest.DownloadFileDestination? = nil)
-        -> DownloadRequest
-    {
-        return download(.resumeData(resumeData), to: destination)
-    }
-
-    // MARK: Private - Download Implementation
-
-    private func download(
-        _ downloadable: DownloadRequest.Downloadable,
-        to destination: DownloadRequest.DownloadFileDestination?)
-        -> DownloadRequest
-    {
-        do {
-            let task = try downloadable.task(session: session, adapter: adapter, queue: queue)
-            let download = DownloadRequest(session: session, requestTask: .download(downloadable, task))
-
-            download.downloadDelegate.destination = destination
-
-            delegate[task] = download
-
-            if startRequestsImmediately { download.resume() }
-
-            return download
-        } catch {
-            return download(downloadable, to: destination, failedWith: error)
-        }
-    }
-
-    private func download(
-        _ downloadable: DownloadRequest.Downloadable?,
-        to destination: DownloadRequest.DownloadFileDestination?,
-        failedWith error: Error)
-        -> DownloadRequest
-    {
-        var downloadTask: Request.RequestTask = .download(nil, nil)
-
-        if let downloadable = downloadable {
-            downloadTask = .download(downloadable, nil)
-        }
-
-        let underlyingError = error.underlyingAdaptError ?? error
-
-        let download = DownloadRequest(session: session, requestTask: downloadTask, error: underlyingError)
-        download.downloadDelegate.destination = destination
-
-        if let retrier = retrier, error is AdaptError {
-            allowRetrier(retrier, toRetry: download, with: underlyingError)
-        } else {
-            if startRequestsImmediately { download.resume() }
-        }
-
-        return download
-    }
-
-    // MARK: - Upload Request
-
-    // MARK: File
-
-    /// Creates an `UploadRequest` from the specified `url`, `method` and `headers` for uploading the `file`.
-    ///
-    /// If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned.
-    ///
-    /// - parameter file:    The file to upload.
-    /// - parameter url:     The URL.
-    /// - parameter method:  The HTTP method. `.post` by default.
-    /// - parameter headers: The HTTP headers. `nil` by default.
-    ///
-    /// - returns: The created `UploadRequest`.
-    @discardableResult
-    open func upload(
-        _ fileURL: URL,
-        to url: URLConvertible,
-        method: HTTPMethod = .post,
-        headers: HTTPHeaders? = nil)
-        -> UploadRequest
-    {
-        do {
-            let urlRequest = try URLRequest(url: url, method: method, headers: headers)
-            return upload(fileURL, with: urlRequest)
-        } catch {
-            return upload(nil, failedWith: error)
-        }
-    }
-
-    /// Creates a `UploadRequest` from the specified `urlRequest` for uploading the `file`.
-    ///
-    /// If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned.
-    ///
-    /// - parameter file:       The file to upload.
-    /// - parameter urlRequest: The URL request.
-    ///
-    /// - returns: The created `UploadRequest`.
-    @discardableResult
-    open func upload(_ fileURL: URL, with urlRequest: URLRequestConvertible) -> UploadRequest {
-        do {
-            let urlRequest = try urlRequest.asURLRequest()
-            return upload(.file(fileURL, urlRequest))
-        } catch {
-            return upload(nil, failedWith: error)
-        }
-    }
-
-    // MARK: Data
-
-    /// Creates an `UploadRequest` from the specified `url`, `method` and `headers` for uploading the `data`.
-    ///
-    /// If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned.
-    ///
-    /// - parameter data:    The data to upload.
-    /// - parameter url:     The URL.
-    /// - parameter method:  The HTTP method. `.post` by default.
-    /// - parameter headers: The HTTP headers. `nil` by default.
-    ///
-    /// - returns: The created `UploadRequest`.
-    @discardableResult
-    open func upload(
-        _ data: Data,
-        to url: URLConvertible,
-        method: HTTPMethod = .post,
-        headers: HTTPHeaders? = nil)
-        -> UploadRequest
-    {
-        do {
-            let urlRequest = try URLRequest(url: url, method: method, headers: headers)
-            return upload(data, with: urlRequest)
-        } catch {
-            return upload(nil, failedWith: error)
-        }
-    }
-
-    /// Creates an `UploadRequest` from the specified `urlRequest` for uploading the `data`.
-    ///
-    /// If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned.
-    ///
-    /// - parameter data:       The data to upload.
-    /// - parameter urlRequest: The URL request.
-    ///
-    /// - returns: The created `UploadRequest`.
-    @discardableResult
-    open func upload(_ data: Data, with urlRequest: URLRequestConvertible) -> UploadRequest {
-        do {
-            let urlRequest = try urlRequest.asURLRequest()
-            return upload(.data(data, urlRequest))
-        } catch {
-            return upload(nil, failedWith: error)
-        }
-    }
-
-    // MARK: InputStream
-
-    /// Creates an `UploadRequest` from the specified `url`, `method` and `headers` for uploading the `stream`.
-    ///
-    /// If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned.
-    ///
-    /// - parameter stream:  The stream to upload.
-    /// - parameter url:     The URL.
-    /// - parameter method:  The HTTP method. `.post` by default.
-    /// - parameter headers: The HTTP headers. `nil` by default.
-    ///
-    /// - returns: The created `UploadRequest`.
-    @discardableResult
-    open func upload(
-        _ stream: InputStream,
-        to url: URLConvertible,
-        method: HTTPMethod = .post,
-        headers: HTTPHeaders? = nil)
-        -> UploadRequest
-    {
-        do {
-            let urlRequest = try URLRequest(url: url, method: method, headers: headers)
-            return upload(stream, with: urlRequest)
-        } catch {
-            return upload(nil, failedWith: error)
-        }
-    }
-
-    /// Creates an `UploadRequest` from the specified `urlRequest` for uploading the `stream`.
-    ///
-    /// If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned.
-    ///
-    /// - parameter stream:     The stream to upload.
-    /// - parameter urlRequest: The URL request.
-    ///
-    /// - returns: The created `UploadRequest`.
-    @discardableResult
-    open func upload(_ stream: InputStream, with urlRequest: URLRequestConvertible) -> UploadRequest {
-        do {
-            let urlRequest = try urlRequest.asURLRequest()
-            return upload(.stream(stream, urlRequest))
-        } catch {
-            return upload(nil, failedWith: error)
-        }
-    }
-
-    // MARK: MultipartFormData
-
-    /// Encodes `multipartFormData` using `encodingMemoryThreshold` and calls `encodingCompletion` with new
-    /// `UploadRequest` using the `url`, `method` and `headers`.
-    ///
-    /// It is important to understand the memory implications of uploading `MultipartFormData`. If the cummulative
-    /// payload is small, encoding the data in-memory and directly uploading to a server is the by far the most
-    /// efficient approach. However, if the payload is too large, encoding the data in-memory could cause your app to
-    /// be terminated. Larger payloads must first be written to disk using input and output streams to keep the memory
-    /// footprint low, then the data can be uploaded as a stream from the resulting file. Streaming from disk MUST be
-    /// used for larger payloads such as video content.
-    ///
-    /// The `encodingMemoryThreshold` parameter allows Alamofire to automatically determine whether to encode in-memory
-    /// or stream from disk. If the content length of the `MultipartFormData` is below the `encodingMemoryThreshold`,
-    /// encoding takes place in-memory. If the content length exceeds the threshold, the data is streamed to disk
-    /// during the encoding process. Then the result is uploaded as data or as a stream depending on which encoding
-    /// technique was used.
-    ///
-    /// If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned.
-    ///
-    /// - parameter multipartFormData:       The closure used to append body parts to the `MultipartFormData`.
-    /// - parameter encodingMemoryThreshold: The encoding memory threshold in bytes.
-    ///                                      `multipartFormDataEncodingMemoryThreshold` by default.
-    /// - parameter url:                     The URL.
-    /// - parameter method:                  The HTTP method. `.post` by default.
-    /// - parameter headers:                 The HTTP headers. `nil` by default.
-    /// - parameter encodingCompletion:      The closure called when the `MultipartFormData` encoding is complete.
-    open func upload(
-        multipartFormData: @escaping (MultipartFormData) -> Void,
-        usingThreshold encodingMemoryThreshold: UInt64 = SessionManager.multipartFormDataEncodingMemoryThreshold,
-        to url: URLConvertible,
-        method: HTTPMethod = .post,
-        headers: HTTPHeaders? = nil,
-        queue: DispatchQueue? = nil,
-        encodingCompletion: ((MultipartFormDataEncodingResult) -> Void)?)
-    {
-        do {
-            let urlRequest = try URLRequest(url: url, method: method, headers: headers)
-
-            return upload(
-                multipartFormData: multipartFormData,
-                usingThreshold: encodingMemoryThreshold,
-                with: urlRequest,
-                queue: queue,
-                encodingCompletion: encodingCompletion
-            )
-        } catch {
-            (queue ?? DispatchQueue.main).async { encodingCompletion?(.failure(error)) }
-        }
-    }
-
-    /// Encodes `multipartFormData` using `encodingMemoryThreshold` and calls `encodingCompletion` with new
-    /// `UploadRequest` using the `urlRequest`.
-    ///
-    /// It is important to understand the memory implications of uploading `MultipartFormData`. If the cummulative
-    /// payload is small, encoding the data in-memory and directly uploading to a server is the by far the most
-    /// efficient approach. However, if the payload is too large, encoding the data in-memory could cause your app to
-    /// be terminated. Larger payloads must first be written to disk using input and output streams to keep the memory
-    /// footprint low, then the data can be uploaded as a stream from the resulting file. Streaming from disk MUST be
-    /// used for larger payloads such as video content.
-    ///
-    /// The `encodingMemoryThreshold` parameter allows Alamofire to automatically determine whether to encode in-memory
-    /// or stream from disk. If the content length of the `MultipartFormData` is below the `encodingMemoryThreshold`,
-    /// encoding takes place in-memory. If the content length exceeds the threshold, the data is streamed to disk
-    /// during the encoding process. Then the result is uploaded as data or as a stream depending on which encoding
-    /// technique was used.
-    ///
-    /// If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned.
-    ///
-    /// - parameter multipartFormData:       The closure used to append body parts to the `MultipartFormData`.
-    /// - parameter encodingMemoryThreshold: The encoding memory threshold in bytes.
-    ///                                      `multipartFormDataEncodingMemoryThreshold` by default.
-    /// - parameter urlRequest:              The URL request.
-    /// - parameter encodingCompletion:      The closure called when the `MultipartFormData` encoding is complete.
-    open func upload(
-        multipartFormData: @escaping (MultipartFormData) -> Void,
-        usingThreshold encodingMemoryThreshold: UInt64 = SessionManager.multipartFormDataEncodingMemoryThreshold,
-        with urlRequest: URLRequestConvertible,
-        queue: DispatchQueue? = nil,
-        encodingCompletion: ((MultipartFormDataEncodingResult) -> Void)?)
-    {
-        DispatchQueue.global(qos: .utility).async {
-            let formData = MultipartFormData()
-            multipartFormData(formData)
-
-            var tempFileURL: URL?
-
-            do {
-                var urlRequestWithContentType = try urlRequest.asURLRequest()
-                urlRequestWithContentType.setValue(formData.contentType, forHTTPHeaderField: "Content-Type")
-
-                let isBackgroundSession = self.session.configuration.identifier != nil
-
-                if formData.contentLength < encodingMemoryThreshold && !isBackgroundSession {
-                    let data = try formData.encode()
-
-                    let encodingResult = MultipartFormDataEncodingResult.success(
-                        request: self.upload(data, with: urlRequestWithContentType),
-                        streamingFromDisk: false,
-                        streamFileURL: nil
-                    )
-
-                    (queue ?? DispatchQueue.main).async { encodingCompletion?(encodingResult) }
-                } else {
-                    let fileManager = FileManager.default
-                    let tempDirectoryURL = URL(fileURLWithPath: NSTemporaryDirectory())
-                    let directoryURL = tempDirectoryURL.appendingPathComponent("org.alamofire.manager/multipart.form.data")
-                    let fileName = UUID().uuidString
-                    let fileURL = directoryURL.appendingPathComponent(fileName)
-
-                    tempFileURL = fileURL
-
-                    var directoryError: Error?
-
-                    // Create directory inside serial queue to ensure two threads don't do this in parallel
-                    self.queue.sync {
-                        do {
-                            try fileManager.createDirectory(at: directoryURL, withIntermediateDirectories: true, attributes: nil)
-                        } catch {
-                            directoryError = error
-                        }
-                    }
-
-                    if let directoryError = directoryError { throw directoryError }
-
-                    try formData.writeEncodedData(to: fileURL)
-
-                    let upload = self.upload(fileURL, with: urlRequestWithContentType)
-
-                    // Cleanup the temp file once the upload is complete
-                    upload.delegate.queue.addOperation {
-                        do {
-                            try FileManager.default.removeItem(at: fileURL)
-                        } catch {
-                            // No-op
-                        }
-                    }
-
-                    (queue ?? DispatchQueue.main).async {
-                        let encodingResult = MultipartFormDataEncodingResult.success(
-                            request: upload,
-                            streamingFromDisk: true,
-                            streamFileURL: fileURL
-                        )
-
-                        encodingCompletion?(encodingResult)
-                    }
-                }
-            } catch {
-                // Cleanup the temp file in the event that the multipart form data encoding failed
-                if let tempFileURL = tempFileURL {
-                    do {
-                        try FileManager.default.removeItem(at: tempFileURL)
-                    } catch {
-                        // No-op
-                    }
-                }
-
-                (queue ?? DispatchQueue.main).async { encodingCompletion?(.failure(error)) }
-            }
-        }
-    }
-
-    // MARK: Private - Upload Implementation
-
-    private func upload(_ uploadable: UploadRequest.Uploadable) -> UploadRequest {
-        do {
-            let task = try uploadable.task(session: session, adapter: adapter, queue: queue)
-            let upload = UploadRequest(session: session, requestTask: .upload(uploadable, task))
-
-            if case let .stream(inputStream, _) = uploadable {
-                upload.delegate.taskNeedNewBodyStream = { _, _ in inputStream }
-            }
-
-            delegate[task] = upload
-
-            if startRequestsImmediately { upload.resume() }
-
-            return upload
-        } catch {
-            return upload(uploadable, failedWith: error)
-        }
-    }
-
-    private func upload(_ uploadable: UploadRequest.Uploadable?, failedWith error: Error) -> UploadRequest {
-        var uploadTask: Request.RequestTask = .upload(nil, nil)
-
-        if let uploadable = uploadable {
-            uploadTask = .upload(uploadable, nil)
-        }
-
-        let underlyingError = error.underlyingAdaptError ?? error
-        let upload = UploadRequest(session: session, requestTask: uploadTask, error: underlyingError)
-
-        if let retrier = retrier, error is AdaptError {
-            allowRetrier(retrier, toRetry: upload, with: underlyingError)
-        } else {
-            if startRequestsImmediately { upload.resume() }
-        }
-
-        return upload
-    }
-
-#if !os(watchOS)
-
-    // MARK: - Stream Request
-
-    // MARK: Hostname and Port
-
-    /// Creates a `StreamRequest` for bidirectional streaming using the `hostname` and `port`.
-    ///
-    /// If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned.
-    ///
-    /// - parameter hostName: The hostname of the server to connect to.
-    /// - parameter port:     The port of the server to connect to.
-    ///
-    /// - returns: The created `StreamRequest`.
-    @discardableResult
-    @available(iOS 9.0, macOS 10.11, tvOS 9.0, *)
-    open func stream(withHostName hostName: String, port: Int) -> StreamRequest {
-        return stream(.stream(hostName: hostName, port: port))
-    }
-
-    // MARK: NetService
-
-    /// Creates a `StreamRequest` for bidirectional streaming using the `netService`.
-    ///
-    /// If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned.
-    ///
-    /// - parameter netService: The net service used to identify the endpoint.
-    ///
-    /// - returns: The created `StreamRequest`.
-    @discardableResult
-    @available(iOS 9.0, macOS 10.11, tvOS 9.0, *)
-    open func stream(with netService: NetService) -> StreamRequest {
-        return stream(.netService(netService))
-    }
-
-    // MARK: Private - Stream Implementation
-
-    @available(iOS 9.0, macOS 10.11, tvOS 9.0, *)
-    private func stream(_ streamable: StreamRequest.Streamable) -> StreamRequest {
-        do {
-            let task = try streamable.task(session: session, adapter: adapter, queue: queue)
-            let request = StreamRequest(session: session, requestTask: .stream(streamable, task))
-
-            delegate[task] = request
-
-            if startRequestsImmediately { request.resume() }
-
-            return request
-        } catch {
-            return stream(failedWith: error)
-        }
-    }
-
-    @available(iOS 9.0, macOS 10.11, tvOS 9.0, *)
-    private func stream(failedWith error: Error) -> StreamRequest {
-        let stream = StreamRequest(session: session, requestTask: .stream(nil, nil), error: error)
-        if startRequestsImmediately { stream.resume() }
-        return stream
-    }
-
-#endif
-
-    // MARK: - Internal - Retry Request
-
-    func retry(_ request: Request) -> Bool {
-        guard let originalTask = request.originalTask else { return false }
-
-        do {
-            let task = try originalTask.task(session: session, adapter: adapter, queue: queue)
-
-            if let originalTask = request.task {
-                delegate[originalTask] = nil // removes the old request to avoid endless growth
-            }
-
-            request.delegate.task = task // resets all task delegate data
-
-            request.retryCount += 1
-            request.startTime = CFAbsoluteTimeGetCurrent()
-            request.endTime = nil
-
-            task.resume()
-
-            return true
-        } catch {
-            request.delegate.error = error.underlyingAdaptError ?? error
-            return false
-        }
-    }
-
-    private func allowRetrier(_ retrier: RequestRetrier, toRetry request: Request, with error: Error) {
-        DispatchQueue.utility.async { [weak self] in
-            guard let strongSelf = self else { return }
-
-            retrier.should(strongSelf, retry: request, with: error) { shouldRetry, timeDelay in
-                guard let strongSelf = self else { return }
-
-                guard shouldRetry else {
-                    if strongSelf.startRequestsImmediately { request.resume() }
-                    return
-                }
-
-                DispatchQueue.utility.after(timeDelay) {
-                    guard let strongSelf = self else { return }
-
-                    let retrySucceeded = strongSelf.retry(request)
-
-                    if retrySucceeded, let task = request.task {
-                        strongSelf.delegate[task] = request
-                    } else {
-                        if strongSelf.startRequestsImmediately { request.resume() }
-                    }
-                }
-            }
-        }
-    }
-}

+ 0 - 466
Example/Pods/Alamofire/Source/TaskDelegate.swift

@@ -1,466 +0,0 @@
-//
-//  TaskDelegate.swift
-//
-//  Copyright (c) 2014 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
-
-/// The task delegate is responsible for handling all delegate callbacks for the underlying task as well as
-/// executing all operations attached to the serial operation queue upon task completion.
-open class TaskDelegate: NSObject {
-
-    // MARK: Properties
-
-    /// The serial operation queue used to execute all operations after the task completes.
-    public let queue: OperationQueue
-
-    /// The data returned by the server.
-    public var data: Data? { return nil }
-
-    /// The error generated throughout the lifecyle of the task.
-    public var error: Error?
-
-    var task: URLSessionTask? {
-        set {
-            taskLock.lock(); defer { taskLock.unlock() }
-            _task = newValue
-        }
-        get {
-            taskLock.lock(); defer { taskLock.unlock() }
-            return _task
-        }
-    }
-
-    var initialResponseTime: CFAbsoluteTime?
-    var credential: URLCredential?
-    var metrics: AnyObject? // URLSessionTaskMetrics
-
-    private var _task: URLSessionTask? {
-        didSet { reset() }
-    }
-
-    private let taskLock = NSLock()
-
-    // MARK: Lifecycle
-
-    init(task: URLSessionTask?) {
-        _task = task
-
-        self.queue = {
-            let operationQueue = OperationQueue()
-
-            operationQueue.maxConcurrentOperationCount = 1
-            operationQueue.isSuspended = true
-            operationQueue.qualityOfService = .utility
-
-            return operationQueue
-        }()
-    }
-
-    func reset() {
-        error = nil
-        initialResponseTime = nil
-    }
-
-    // MARK: URLSessionTaskDelegate
-
-    var taskWillPerformHTTPRedirection: ((URLSession, URLSessionTask, HTTPURLResponse, URLRequest) -> URLRequest?)?
-    var taskDidReceiveChallenge: ((URLSession, URLSessionTask, URLAuthenticationChallenge) -> (URLSession.AuthChallengeDisposition, URLCredential?))?
-    var taskNeedNewBodyStream: ((URLSession, URLSessionTask) -> InputStream?)?
-    var taskDidCompleteWithError: ((URLSession, URLSessionTask, Error?) -> Void)?
-
-    @objc(URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:)
-    func urlSession(
-        _ session: URLSession,
-        task: URLSessionTask,
-        willPerformHTTPRedirection response: HTTPURLResponse,
-        newRequest request: URLRequest,
-        completionHandler: @escaping (URLRequest?) -> Void)
-    {
-        var redirectRequest: URLRequest? = request
-
-        if let taskWillPerformHTTPRedirection = taskWillPerformHTTPRedirection {
-            redirectRequest = taskWillPerformHTTPRedirection(session, task, response, request)
-        }
-
-        completionHandler(redirectRequest)
-    }
-
-    @objc(URLSession:task:didReceiveChallenge:completionHandler:)
-    func urlSession(
-        _ session: URLSession,
-        task: URLSessionTask,
-        didReceive challenge: URLAuthenticationChallenge,
-        completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void)
-    {
-        var disposition: URLSession.AuthChallengeDisposition = .performDefaultHandling
-        var credential: URLCredential?
-
-        if let taskDidReceiveChallenge = taskDidReceiveChallenge {
-            (disposition, credential) = taskDidReceiveChallenge(session, task, challenge)
-        } else if challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodServerTrust {
-            let host = challenge.protectionSpace.host
-
-            if
-                let serverTrustPolicy = session.serverTrustPolicyManager?.serverTrustPolicy(forHost: host),
-                let serverTrust = challenge.protectionSpace.serverTrust
-            {
-                if serverTrustPolicy.evaluate(serverTrust, forHost: host) {
-                    disposition = .useCredential
-                    credential = URLCredential(trust: serverTrust)
-                } else {
-                    disposition = .cancelAuthenticationChallenge
-                }
-            }
-        } else {
-            if challenge.previousFailureCount > 0 {
-                disposition = .rejectProtectionSpace
-            } else {
-                credential = self.credential ?? session.configuration.urlCredentialStorage?.defaultCredential(for: challenge.protectionSpace)
-
-                if credential != nil {
-                    disposition = .useCredential
-                }
-            }
-        }
-
-        completionHandler(disposition, credential)
-    }
-
-    @objc(URLSession:task:needNewBodyStream:)
-    func urlSession(
-        _ session: URLSession,
-        task: URLSessionTask,
-        needNewBodyStream completionHandler: @escaping (InputStream?) -> Void)
-    {
-        var bodyStream: InputStream?
-
-        if let taskNeedNewBodyStream = taskNeedNewBodyStream {
-            bodyStream = taskNeedNewBodyStream(session, task)
-        }
-
-        completionHandler(bodyStream)
-    }
-
-    @objc(URLSession:task:didCompleteWithError:)
-    func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?) {
-        if let taskDidCompleteWithError = taskDidCompleteWithError {
-            taskDidCompleteWithError(session, task, error)
-        } else {
-            if let error = error {
-                if self.error == nil { self.error = error }
-
-                if
-                    let downloadDelegate = self as? DownloadTaskDelegate,
-                    let resumeData = (error as NSError).userInfo[NSURLSessionDownloadTaskResumeData] as? Data
-                {
-                    downloadDelegate.resumeData = resumeData
-                }
-            }
-
-            queue.isSuspended = false
-        }
-    }
-}
-
-// MARK: -
-
-class DataTaskDelegate: TaskDelegate, URLSessionDataDelegate {
-
-    // MARK: Properties
-
-    var dataTask: URLSessionDataTask { return task as! URLSessionDataTask }
-
-    override var data: Data? {
-        if dataStream != nil {
-            return nil
-        } else {
-            return mutableData
-        }
-    }
-
-    var progress: Progress
-    var progressHandler: (closure: Request.ProgressHandler, queue: DispatchQueue)?
-
-    var dataStream: ((_ data: Data) -> Void)?
-
-    private var totalBytesReceived: Int64 = 0
-    private var mutableData: Data
-
-    private var expectedContentLength: Int64?
-
-    // MARK: Lifecycle
-
-    override init(task: URLSessionTask?) {
-        mutableData = Data()
-        progress = Progress(totalUnitCount: 0)
-
-        super.init(task: task)
-    }
-
-    override func reset() {
-        super.reset()
-
-        progress = Progress(totalUnitCount: 0)
-        totalBytesReceived = 0
-        mutableData = Data()
-        expectedContentLength = nil
-    }
-
-    // MARK: URLSessionDataDelegate
-
-    var dataTaskDidReceiveResponse: ((URLSession, URLSessionDataTask, URLResponse) -> URLSession.ResponseDisposition)?
-    var dataTaskDidBecomeDownloadTask: ((URLSession, URLSessionDataTask, URLSessionDownloadTask) -> Void)?
-    var dataTaskDidReceiveData: ((URLSession, URLSessionDataTask, Data) -> Void)?
-    var dataTaskWillCacheResponse: ((URLSession, URLSessionDataTask, CachedURLResponse) -> CachedURLResponse?)?
-
-    func urlSession(
-        _ session: URLSession,
-        dataTask: URLSessionDataTask,
-        didReceive response: URLResponse,
-        completionHandler: @escaping (URLSession.ResponseDisposition) -> Void)
-    {
-        var disposition: URLSession.ResponseDisposition = .allow
-
-        expectedContentLength = response.expectedContentLength
-
-        if let dataTaskDidReceiveResponse = dataTaskDidReceiveResponse {
-            disposition = dataTaskDidReceiveResponse(session, dataTask, response)
-        }
-
-        completionHandler(disposition)
-    }
-
-    func urlSession(
-        _ session: URLSession,
-        dataTask: URLSessionDataTask,
-        didBecome downloadTask: URLSessionDownloadTask)
-    {
-        dataTaskDidBecomeDownloadTask?(session, dataTask, downloadTask)
-    }
-
-    func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive data: Data) {
-        if initialResponseTime == nil { initialResponseTime = CFAbsoluteTimeGetCurrent() }
-
-        if let dataTaskDidReceiveData = dataTaskDidReceiveData {
-            dataTaskDidReceiveData(session, dataTask, data)
-        } else {
-            if let dataStream = dataStream {
-                dataStream(data)
-            } else {
-                mutableData.append(data)
-            }
-
-            let bytesReceived = Int64(data.count)
-            totalBytesReceived += bytesReceived
-            let totalBytesExpected = dataTask.response?.expectedContentLength ?? NSURLSessionTransferSizeUnknown
-
-            progress.totalUnitCount = totalBytesExpected
-            progress.completedUnitCount = totalBytesReceived
-
-            if let progressHandler = progressHandler {
-                progressHandler.queue.async { progressHandler.closure(self.progress) }
-            }
-        }
-    }
-
-    func urlSession(
-        _ session: URLSession,
-        dataTask: URLSessionDataTask,
-        willCacheResponse proposedResponse: CachedURLResponse,
-        completionHandler: @escaping (CachedURLResponse?) -> Void)
-    {
-        var cachedResponse: CachedURLResponse? = proposedResponse
-
-        if let dataTaskWillCacheResponse = dataTaskWillCacheResponse {
-            cachedResponse = dataTaskWillCacheResponse(session, dataTask, proposedResponse)
-        }
-
-        completionHandler(cachedResponse)
-    }
-}
-
-// MARK: -
-
-class DownloadTaskDelegate: TaskDelegate, URLSessionDownloadDelegate {
-
-    // MARK: Properties
-
-    var downloadTask: URLSessionDownloadTask { return task as! URLSessionDownloadTask }
-
-    var progress: Progress
-    var progressHandler: (closure: Request.ProgressHandler, queue: DispatchQueue)?
-
-    var resumeData: Data?
-    override var data: Data? { return resumeData }
-
-    var destination: DownloadRequest.DownloadFileDestination?
-
-    var temporaryURL: URL?
-    var destinationURL: URL?
-
-    var fileURL: URL? { return destination != nil ? destinationURL : temporaryURL }
-
-    // MARK: Lifecycle
-
-    override init(task: URLSessionTask?) {
-        progress = Progress(totalUnitCount: 0)
-        super.init(task: task)
-    }
-
-    override func reset() {
-        super.reset()
-
-        progress = Progress(totalUnitCount: 0)
-        resumeData = nil
-    }
-
-    // MARK: URLSessionDownloadDelegate
-
-    var downloadTaskDidFinishDownloadingToURL: ((URLSession, URLSessionDownloadTask, URL) -> URL)?
-    var downloadTaskDidWriteData: ((URLSession, URLSessionDownloadTask, Int64, Int64, Int64) -> Void)?
-    var downloadTaskDidResumeAtOffset: ((URLSession, URLSessionDownloadTask, Int64, Int64) -> Void)?
-
-    func urlSession(
-        _ session: URLSession,
-        downloadTask: URLSessionDownloadTask,
-        didFinishDownloadingTo location: URL)
-    {
-        temporaryURL = location
-
-        guard
-            let destination = destination,
-            let response = downloadTask.response as? HTTPURLResponse
-        else { return }
-
-        let result = destination(location, response)
-        let destinationURL = result.destinationURL
-        let options = result.options
-
-        self.destinationURL = destinationURL
-
-        do {
-            if options.contains(.removePreviousFile), FileManager.default.fileExists(atPath: destinationURL.path) {
-                try FileManager.default.removeItem(at: destinationURL)
-            }
-
-            if options.contains(.createIntermediateDirectories) {
-                let directory = destinationURL.deletingLastPathComponent()
-                try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true)
-            }
-
-            try FileManager.default.moveItem(at: location, to: destinationURL)
-        } catch {
-            self.error = error
-        }
-    }
-
-    func urlSession(
-        _ session: URLSession,
-        downloadTask: URLSessionDownloadTask,
-        didWriteData bytesWritten: Int64,
-        totalBytesWritten: Int64,
-        totalBytesExpectedToWrite: Int64)
-    {
-        if initialResponseTime == nil { initialResponseTime = CFAbsoluteTimeGetCurrent() }
-
-        if let downloadTaskDidWriteData = downloadTaskDidWriteData {
-            downloadTaskDidWriteData(
-                session,
-                downloadTask,
-                bytesWritten,
-                totalBytesWritten,
-                totalBytesExpectedToWrite
-            )
-        } else {
-            progress.totalUnitCount = totalBytesExpectedToWrite
-            progress.completedUnitCount = totalBytesWritten
-
-            if let progressHandler = progressHandler {
-                progressHandler.queue.async { progressHandler.closure(self.progress) }
-            }
-        }
-    }
-
-    func urlSession(
-        _ session: URLSession,
-        downloadTask: URLSessionDownloadTask,
-        didResumeAtOffset fileOffset: Int64,
-        expectedTotalBytes: Int64)
-    {
-        if let downloadTaskDidResumeAtOffset = downloadTaskDidResumeAtOffset {
-            downloadTaskDidResumeAtOffset(session, downloadTask, fileOffset, expectedTotalBytes)
-        } else {
-            progress.totalUnitCount = expectedTotalBytes
-            progress.completedUnitCount = fileOffset
-        }
-    }
-}
-
-// MARK: -
-
-class UploadTaskDelegate: DataTaskDelegate {
-
-    // MARK: Properties
-
-    var uploadTask: URLSessionUploadTask { return task as! URLSessionUploadTask }
-
-    var uploadProgress: Progress
-    var uploadProgressHandler: (closure: Request.ProgressHandler, queue: DispatchQueue)?
-
-    // MARK: Lifecycle
-
-    override init(task: URLSessionTask?) {
-        uploadProgress = Progress(totalUnitCount: 0)
-        super.init(task: task)
-    }
-
-    override func reset() {
-        super.reset()
-        uploadProgress = Progress(totalUnitCount: 0)
-    }
-
-    // MARK: URLSessionTaskDelegate
-
-    var taskDidSendBodyData: ((URLSession, URLSessionTask, Int64, Int64, Int64) -> Void)?
-
-    func URLSession(
-        _ session: URLSession,
-        task: URLSessionTask,
-        didSendBodyData bytesSent: Int64,
-        totalBytesSent: Int64,
-        totalBytesExpectedToSend: Int64)
-    {
-        if initialResponseTime == nil { initialResponseTime = CFAbsoluteTimeGetCurrent() }
-
-        if let taskDidSendBodyData = taskDidSendBodyData {
-            taskDidSendBodyData(session, task, bytesSent, totalBytesSent, totalBytesExpectedToSend)
-        } else {
-            uploadProgress.totalUnitCount = totalBytesExpectedToSend
-            uploadProgress.completedUnitCount = totalBytesSent
-
-            if let uploadProgressHandler = uploadProgressHandler {
-                uploadProgressHandler.queue.async { uploadProgressHandler.closure(self.uploadProgress) }
-            }
-        }
-    }
-}

+ 0 - 136
Example/Pods/Alamofire/Source/Timeline.swift

@@ -1,136 +0,0 @@
-//
-//  Timeline.swift
-//
-//  Copyright (c) 2014 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
-
-/// Responsible for computing the timing metrics for the complete lifecycle of a `Request`.
-public struct Timeline {
-    /// The time the request was initialized.
-    public let requestStartTime: CFAbsoluteTime
-
-    /// The time the first bytes were received from or sent to the server.
-    public let initialResponseTime: CFAbsoluteTime
-
-    /// The time when the request was completed.
-    public let requestCompletedTime: CFAbsoluteTime
-
-    /// The time when the response serialization was completed.
-    public let serializationCompletedTime: CFAbsoluteTime
-
-    /// The time interval in seconds from the time the request started to the initial response from the server.
-    public let latency: TimeInterval
-
-    /// The time interval in seconds from the time the request started to the time the request completed.
-    public let requestDuration: TimeInterval
-
-    /// The time interval in seconds from the time the request completed to the time response serialization completed.
-    public let serializationDuration: TimeInterval
-
-    /// The time interval in seconds from the time the request started to the time response serialization completed.
-    public let totalDuration: TimeInterval
-
-    /// Creates a new `Timeline` instance with the specified request times.
-    ///
-    /// - parameter requestStartTime:           The time the request was initialized. Defaults to `0.0`.
-    /// - parameter initialResponseTime:        The time the first bytes were received from or sent to the server.
-    ///                                         Defaults to `0.0`.
-    /// - parameter requestCompletedTime:       The time when the request was completed. Defaults to `0.0`.
-    /// - parameter serializationCompletedTime: The time when the response serialization was completed. Defaults
-    ///                                         to `0.0`.
-    ///
-    /// - returns: The new `Timeline` instance.
-    public init(
-        requestStartTime: CFAbsoluteTime = 0.0,
-        initialResponseTime: CFAbsoluteTime = 0.0,
-        requestCompletedTime: CFAbsoluteTime = 0.0,
-        serializationCompletedTime: CFAbsoluteTime = 0.0)
-    {
-        self.requestStartTime = requestStartTime
-        self.initialResponseTime = initialResponseTime
-        self.requestCompletedTime = requestCompletedTime
-        self.serializationCompletedTime = serializationCompletedTime
-
-        self.latency = initialResponseTime - requestStartTime
-        self.requestDuration = requestCompletedTime - requestStartTime
-        self.serializationDuration = serializationCompletedTime - requestCompletedTime
-        self.totalDuration = serializationCompletedTime - requestStartTime
-    }
-}
-
-// MARK: - CustomStringConvertible
-
-extension Timeline: CustomStringConvertible {
-    /// The textual representation used when written to an output stream, which includes the latency, the request
-    /// duration and the total duration.
-    public var description: String {
-        let latency = String(format: "%.3f", self.latency)
-        let requestDuration = String(format: "%.3f", self.requestDuration)
-        let serializationDuration = String(format: "%.3f", self.serializationDuration)
-        let totalDuration = String(format: "%.3f", self.totalDuration)
-
-        // NOTE: Had to move to string concatenation due to memory leak filed as rdar://26761490. Once memory leak is
-        // fixed, we should move back to string interpolation by reverting commit 7d4a43b1.
-        let timings = [
-            "\"Latency\": " + latency + " secs",
-            "\"Request Duration\": " + requestDuration + " secs",
-            "\"Serialization Duration\": " + serializationDuration + " secs",
-            "\"Total Duration\": " + totalDuration + " secs"
-        ]
-
-        return "Timeline: { " + timings.joined(separator: ", ") + " }"
-    }
-}
-
-// MARK: - CustomDebugStringConvertible
-
-extension Timeline: CustomDebugStringConvertible {
-    /// The textual representation used when written to an output stream, which includes the request start time, the
-    /// initial response time, the request completed time, the serialization completed time, the latency, the request
-    /// duration and the total duration.
-    public var debugDescription: String {
-        let requestStartTime = String(format: "%.3f", self.requestStartTime)
-        let initialResponseTime = String(format: "%.3f", self.initialResponseTime)
-        let requestCompletedTime = String(format: "%.3f", self.requestCompletedTime)
-        let serializationCompletedTime = String(format: "%.3f", self.serializationCompletedTime)
-        let latency = String(format: "%.3f", self.latency)
-        let requestDuration = String(format: "%.3f", self.requestDuration)
-        let serializationDuration = String(format: "%.3f", self.serializationDuration)
-        let totalDuration = String(format: "%.3f", self.totalDuration)
-
-        // NOTE: Had to move to string concatenation due to memory leak filed as rdar://26761490. Once memory leak is
-        // fixed, we should move back to string interpolation by reverting commit 7d4a43b1.
-        let timings = [
-            "\"Request Start Time\": " + requestStartTime,
-            "\"Initial Response Time\": " + initialResponseTime,
-            "\"Request Completed Time\": " + requestCompletedTime,
-            "\"Serialization Completed Time\": " + serializationCompletedTime,
-            "\"Latency\": " + latency + " secs",
-            "\"Request Duration\": " + requestDuration + " secs",
-            "\"Serialization Duration\": " + serializationDuration + " secs",
-            "\"Total Duration\": " + totalDuration + " secs"
-        ]
-
-        return "Timeline: { " + timings.joined(separator: ", ") + " }"
-    }
-}

+ 0 - 321
Example/Pods/Alamofire/Source/Validation.swift

@@ -1,321 +0,0 @@
-//
-//  Validation.swift
-//
-//  Copyright (c) 2014 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
-
-extension Request {
-
-    // MARK: Helper Types
-
-    fileprivate typealias ErrorReason = AFError.ResponseValidationFailureReason
-
-    /// Used to represent whether validation was successful or encountered an error resulting in a failure.
-    ///
-    /// - success: The validation was successful.
-    /// - failure: The validation failed encountering the provided error.
-    public enum ValidationResult {
-        case success
-        case failure(Error)
-    }
-
-    fileprivate struct MIMEType {
-        let type: String
-        let subtype: String
-
-        var isWildcard: Bool { return type == "*" && subtype == "*" }
-
-        init?(_ string: String) {
-            let components: [String] = {
-                let stripped = string.trimmingCharacters(in: .whitespacesAndNewlines)
-
-            #if swift(>=3.2)
-                let split = stripped[..<(stripped.range(of: ";")?.lowerBound ?? stripped.endIndex)]
-            #else
-                let split = stripped.substring(to: stripped.range(of: ";")?.lowerBound ?? stripped.endIndex)
-            #endif
-
-                return split.components(separatedBy: "/")
-            }()
-
-            if let type = components.first, let subtype = components.last {
-                self.type = type
-                self.subtype = subtype
-            } else {
-                return nil
-            }
-        }
-
-        func matches(_ mime: MIMEType) -> Bool {
-            switch (type, subtype) {
-            case (mime.type, mime.subtype), (mime.type, "*"), ("*", mime.subtype), ("*", "*"):
-                return true
-            default:
-                return false
-            }
-        }
-    }
-
-    // MARK: Properties
-
-    fileprivate var acceptableStatusCodes: [Int] { return Array(200..<300) }
-
-    fileprivate var acceptableContentTypes: [String] {
-        if let accept = request?.value(forHTTPHeaderField: "Accept") {
-            return accept.components(separatedBy: ",")
-        }
-
-        return ["*/*"]
-    }
-
-    // MARK: Status Code
-
-    fileprivate func validate<S: Sequence>(
-        statusCode acceptableStatusCodes: S,
-        response: HTTPURLResponse)
-        -> ValidationResult
-        where S.Iterator.Element == Int
-    {
-        if acceptableStatusCodes.contains(response.statusCode) {
-            return .success
-        } else {
-            let reason: ErrorReason = .unacceptableStatusCode(code: response.statusCode)
-            return .failure(AFError.responseValidationFailed(reason: reason))
-        }
-    }
-
-    // MARK: Content Type
-
-    fileprivate func validate<S: Sequence>(
-        contentType acceptableContentTypes: S,
-        response: HTTPURLResponse,
-        data: Data?)
-        -> ValidationResult
-        where S.Iterator.Element == String
-    {
-        guard let data = data, data.count > 0 else { return .success }
-
-        guard
-            let responseContentType = response.mimeType,
-            let responseMIMEType = MIMEType(responseContentType)
-        else {
-            for contentType in acceptableContentTypes {
-                if let mimeType = MIMEType(contentType), mimeType.isWildcard {
-                    return .success
-                }
-            }
-
-            let error: AFError = {
-                let reason: ErrorReason = .missingContentType(acceptableContentTypes: Array(acceptableContentTypes))
-                return AFError.responseValidationFailed(reason: reason)
-            }()
-
-            return .failure(error)
-        }
-
-        for contentType in acceptableContentTypes {
-            if let acceptableMIMEType = MIMEType(contentType), acceptableMIMEType.matches(responseMIMEType) {
-                return .success
-            }
-        }
-
-        let error: AFError = {
-            let reason: ErrorReason = .unacceptableContentType(
-                acceptableContentTypes: Array(acceptableContentTypes),
-                responseContentType: responseContentType
-            )
-
-            return AFError.responseValidationFailed(reason: reason)
-        }()
-
-        return .failure(error)
-    }
-}
-
-// MARK: -
-
-extension DataRequest {
-    /// A closure used to validate a request that takes a URL request, a URL response and data, and returns whether the
-    /// request was valid.
-    public typealias Validation = (URLRequest?, HTTPURLResponse, Data?) -> ValidationResult
-
-    /// Validates the request, using the specified closure.
-    ///
-    /// If validation fails, subsequent calls to response handlers will have an associated error.
-    ///
-    /// - parameter validation: A closure to validate the request.
-    ///
-    /// - returns: The request.
-    @discardableResult
-    public func validate(_ validation: @escaping Validation) -> Self {
-        let validationExecution: () -> Void = { [unowned self] in
-            if
-                let response = self.response,
-                self.delegate.error == nil,
-                case let .failure(error) = validation(self.request, response, self.delegate.data)
-            {
-                self.delegate.error = error
-            }
-        }
-
-        validations.append(validationExecution)
-
-        return self
-    }
-
-    /// Validates that the response has a status code in the specified sequence.
-    ///
-    /// If validation fails, subsequent calls to response handlers will have an associated error.
-    ///
-    /// - parameter range: The range of acceptable status codes.
-    ///
-    /// - returns: The request.
-    @discardableResult
-    public func validate<S: Sequence>(statusCode acceptableStatusCodes: S) -> Self where S.Iterator.Element == Int {
-        return validate { [unowned self] _, response, _ in
-            return self.validate(statusCode: acceptableStatusCodes, response: response)
-        }
-    }
-
-    /// Validates that the response has a content type in the specified sequence.
-    ///
-    /// If validation fails, subsequent calls to response handlers will have an associated error.
-    ///
-    /// - parameter contentType: The acceptable content types, which may specify wildcard types and/or subtypes.
-    ///
-    /// - returns: The request.
-    @discardableResult
-    public func validate<S: Sequence>(contentType acceptableContentTypes: S) -> Self where S.Iterator.Element == String {
-        return validate { [unowned self] _, response, data in
-            return self.validate(contentType: acceptableContentTypes, response: response, data: data)
-        }
-    }
-
-    /// Validates that the response has a status code in the default acceptable range of 200...299, and that the content
-    /// type matches any specified in the Accept HTTP header field.
-    ///
-    /// If validation fails, subsequent calls to response handlers will have an associated error.
-    ///
-    /// - returns: The request.
-    @discardableResult
-    public func validate() -> Self {
-        let contentTypes = { [unowned self] in
-            self.acceptableContentTypes
-        }
-        return validate(statusCode: acceptableStatusCodes).validate(contentType: contentTypes())
-    }
-}
-
-// MARK: -
-
-extension DownloadRequest {
-    /// A closure used to validate a request that takes a URL request, a URL response, a temporary URL and a
-    /// destination URL, and returns whether the request was valid.
-    public typealias Validation = (
-        _ request: URLRequest?,
-        _ response: HTTPURLResponse,
-        _ temporaryURL: URL?,
-        _ destinationURL: URL?)
-        -> ValidationResult
-
-    /// Validates the request, using the specified closure.
-    ///
-    /// If validation fails, subsequent calls to response handlers will have an associated error.
-    ///
-    /// - parameter validation: A closure to validate the request.
-    ///
-    /// - returns: The request.
-    @discardableResult
-    public func validate(_ validation: @escaping Validation) -> Self {
-        let validationExecution: () -> Void = { [unowned self] in
-            let request = self.request
-            let temporaryURL = self.downloadDelegate.temporaryURL
-            let destinationURL = self.downloadDelegate.destinationURL
-
-            if
-                let response = self.response,
-                self.delegate.error == nil,
-                case let .failure(error) = validation(request, response, temporaryURL, destinationURL)
-            {
-                self.delegate.error = error
-            }
-        }
-
-        validations.append(validationExecution)
-
-        return self
-    }
-
-    /// Validates that the response has a status code in the specified sequence.
-    ///
-    /// If validation fails, subsequent calls to response handlers will have an associated error.
-    ///
-    /// - parameter range: The range of acceptable status codes.
-    ///
-    /// - returns: The request.
-    @discardableResult
-    public func validate<S: Sequence>(statusCode acceptableStatusCodes: S) -> Self where S.Iterator.Element == Int {
-        return validate { [unowned self] _, response, _, _ in
-            return self.validate(statusCode: acceptableStatusCodes, response: response)
-        }
-    }
-
-    /// Validates that the response has a content type in the specified sequence.
-    ///
-    /// If validation fails, subsequent calls to response handlers will have an associated error.
-    ///
-    /// - parameter contentType: The acceptable content types, which may specify wildcard types and/or subtypes.
-    ///
-    /// - returns: The request.
-    @discardableResult
-    public func validate<S: Sequence>(contentType acceptableContentTypes: S) -> Self where S.Iterator.Element == String {
-        return validate { [unowned self] _, response, _, _ in
-            let fileURL = self.downloadDelegate.fileURL
-
-            guard let validFileURL = fileURL else {
-                return .failure(AFError.responseValidationFailed(reason: .dataFileNil))
-            }
-
-            do {
-                let data = try Data(contentsOf: validFileURL)
-                return self.validate(contentType: acceptableContentTypes, response: response, data: data)
-            } catch {
-                return .failure(AFError.responseValidationFailed(reason: .dataFileReadFailed(at: validFileURL)))
-            }
-        }
-    }
-
-    /// Validates that the response has a status code in the default acceptable range of 200...299, and that the content
-    /// type matches any specified in the Accept HTTP header field.
-    ///
-    /// If validation fails, subsequent calls to response handlers will have an associated error.
-    ///
-    /// - returns: The request.
-    @discardableResult
-    public func validate() -> Self {
-        let contentTypes = { [unowned self] in
-            self.acceptableContentTypes
-        }
-        return validate(statusCode: acceptableStatusCodes).validate(contentType: contentTypes())
-    }
-}

+ 0 - 19
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/NSDate+OSS.h

@@ -1,19 +0,0 @@
-//
-//  NSDate+OSS.h
-//  AliyunOSSSDK
-//
-//  Created by huaixu on 2018/7/31.
-//  Copyright © 2018年 aliyun. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-
-/**
- Categories NSDate
- */
-@interface NSDate (OSS)
-+ (void)oss_setClockSkew:(NSTimeInterval)clockSkew;
-+ (NSDate *)oss_dateFromString:(NSString *)string;
-+ (NSDate *)oss_clockSkewFixedDate;
-- (NSString *)oss_asStringValue;
-@end

+ 0 - 49
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/NSDate+OSS.m

@@ -1,49 +0,0 @@
-//
-//  NSDate+OSS.m
-//  AliyunOSSSDK
-//
-//  Created by huaixu on 2018/7/31.
-//  Copyright © 2018年 aliyun. All rights reserved.
-//
-
-#import "NSDate+OSS.h"
-
-@implementation NSDate (OSS)
-
-NSString * const serverReturnDateFormat = @"EEE, dd MMM yyyy HH:mm:ss z";
-
-static NSTimeInterval _clockSkew = 0.0;
-
-+ (void)oss_setClockSkew:(NSTimeInterval)clockSkew {
-    @synchronized(self) {
-        _clockSkew = clockSkew;
-    }
-}
-
-+ (NSDate *)oss_clockSkewFixedDate {
-    NSTimeInterval skew = 0.0;
-    @synchronized(self) {
-        skew = _clockSkew;
-    }
-    return [[NSDate date] dateByAddingTimeInterval:(-1 * skew)];
-}
-
-+ (NSDate *)oss_dateFromString:(NSString *)string {
-    NSDateFormatter *dateFormatter = [NSDateFormatter new];
-    dateFormatter.timeZone = [NSTimeZone timeZoneWithName:@"GMT"];
-    dateFormatter.locale = [NSLocale localeWithLocaleIdentifier:@"en_US"];
-    dateFormatter.dateFormat = serverReturnDateFormat;
-    
-    return [dateFormatter dateFromString:string];
-}
-
-- (NSString *)oss_asStringValue {
-    NSDateFormatter *dateFormatter = [NSDateFormatter new];
-    dateFormatter.timeZone = [NSTimeZone timeZoneWithName:@"GMT"];
-    dateFormatter.locale = [NSLocale localeWithLocaleIdentifier:@"en_US"];
-    dateFormatter.dateFormat = serverReturnDateFormat;
-    
-    return [dateFormatter stringFromDate:self];
-}
-
-@end

+ 0 - 15
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/NSMutableData+OSS_CRC.h

@@ -1,15 +0,0 @@
-//
-//  NSMutableData+OSS_CRC.h
-//  AliyunOSSSDK
-//
-//  Created by 怀叙 on 2017/11/29.
-//  Copyright © 2017年 阿里云. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-
-@interface NSMutableData (OSS_CRC)
-
-- (uint64_t)oss_crc64;
-
-@end

+ 0 - 19
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/NSMutableData+OSS_CRC.m

@@ -1,19 +0,0 @@
-//
-//  NSMutableData+OSS_CRC.m
-//  AliyunOSSSDK
-//
-//  Created by 怀叙 on 2017/11/29.
-//  Copyright © 2017年 阿里云. All rights reserved.
-//
-
-#import "NSMutableData+OSS_CRC.h"
-#include "aos_crc64.h"
-
-@implementation NSMutableData (OSS_CRC)
-
-- (uint64_t)oss_crc64
-{
-    return aos_crc64(0, self.mutableBytes, self.length);
-}
-
-@end

+ 0 - 15
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/NSMutableDictionary+OSS.h

@@ -1,15 +0,0 @@
-//
-//  NSMutableDictionary+OSS.h
-//  AliyunOSSSDK
-//
-//  Created by huaixu on 2018/8/1.
-//  Copyright © 2018年 aliyun. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-
-@interface NSMutableDictionary (OSS)
-
-- (void)oss_setObject:(id)anObject forKey:(id <NSCopying>)aKey;
-
-@end

+ 0 - 19
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/NSMutableDictionary+OSS.m

@@ -1,19 +0,0 @@
-//
-//  NSMutableDictionary+OSS.m
-//  AliyunOSSSDK
-//
-//  Created by huaixu on 2018/8/1.
-//  Copyright © 2018年 aliyun. All rights reserved.
-//
-
-#import "NSMutableDictionary+OSS.h"
-
-@implementation NSMutableDictionary (OSS)
-
-- (void)oss_setObject:(id)anObject forKey:(id <NSCopying>)aKey {
-    if (anObject && aKey) {
-        [self setObject:anObject forKey:aKey];
-    }
-}
-
-@end

+ 0 - 33
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSAllRequestNeededMessage.h

@@ -1,33 +0,0 @@
-//
-//  OSSAllRequestNeededMessage.h
-//  AliyunOSSSDK
-//
-//  Created by huaixu on 2018/1/22.
-//  Copyright © 2018年 aliyun. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-#import "OSSConstants.h"
-#import "OSSTask.h"
-
-/**
- All necessary information in one OSS request.
- */
-@interface OSSAllRequestNeededMessage : NSObject
-@property (nonatomic, strong) NSString *endpoint;
-@property (nonatomic, strong) NSString *httpMethod;
-@property (nonatomic, strong) NSString *bucketName;
-@property (nonatomic, strong) NSString *objectKey;
-@property (nonatomic, strong) NSString *contentType;
-@property (nonatomic, strong) NSString *contentMd5;
-@property (nonatomic, strong) NSString *range;
-@property (nonatomic, strong) NSString *date;
-@property (nonatomic, strong) NSMutableDictionary *headerParams;
-@property (nonatomic, copy) NSDictionary *params;
-@property (nonatomic, copy) NSString *contentSHA1;
-@property (nonatomic, assign) BOOL isHostInCnameExcludeList;
-
-
-- (OSSTask *)validateRequestParamsInOperationType:(OSSOperationType)operType;
-
-@end

+ 0 - 72
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSAllRequestNeededMessage.m

@@ -1,72 +0,0 @@
-//
-//  OSSAllRequestNeededMessage.m
-//  AliyunOSSSDK
-//
-//  Created by huaixu on 2018/1/22.
-//  Copyright © 2018年 aliyun. All rights reserved.
-//
-
-#import "OSSAllRequestNeededMessage.h"
-
-#import "OSSDefine.h"
-#import "OSSUtil.h"
-
-@implementation OSSAllRequestNeededMessage
-
-- (instancetype)init
-{
-    self = [super init];
-    if (self) {
-        _date = [[NSDate oss_clockSkewFixedDate] oss_asStringValue];
-        _headerParams = [NSMutableDictionary dictionary];
-    }
-    return self;
-}
-
-- (void)setHeaderParams:(NSMutableDictionary *)headerParams {
-    if (!headerParams || [headerParams isEqualToDictionary:_headerParams]) {
-        return;
-    }
-    _headerParams = [headerParams mutableCopy];
-}
-
-- (OSSTask *)validateRequestParamsInOperationType:(OSSOperationType)operType {
-    NSString * errorMessage = nil;
-    
-    if (!self.endpoint) {
-        errorMessage = @"Endpoint should not be nil";
-    }
-    
-    if (!self.bucketName && operType != OSSOperationTypeGetService) {
-        errorMessage = @"Bucket name should not be nil";
-    }
-    
-    if (self.bucketName && ![OSSUtil validateBucketName:self.bucketName]) {
-        errorMessage = @"Bucket name invalid";
-    }
-    
-    if (!self.objectKey &&
-        (operType != OSSOperationTypeGetBucket && operType != OSSOperationTypeCreateBucket
-         && operType != OSSOperationTypeDeleteBucket && operType != OSSOperationTypeGetService
-         && operType != OSSOperationTypeGetBucketACL&& operType != OSSOperationTypeDeleteMultipleObjects
-         && operType != OSSOperationTypeListMultipartUploads
-         && operType != OSSOperationTypeGetBucketInfo)) {
-            errorMessage = @"Object key should not be nil";
-        }
-    
-    
-    
-    if (self.objectKey && ![OSSUtil validateObjectKey:self.objectKey]) {
-        errorMessage = @"Object key invalid";
-    }
-    
-    if (errorMessage) {
-        return [OSSTask taskWithError:[NSError errorWithDomain:OSSClientErrorDomain
-                                                          code:OSSClientErrorCodeInvalidArgument
-                                                      userInfo:@{OSSErrorMessageTOKEN: errorMessage}]];
-    } else {
-        return [OSSTask taskWithResult:nil];
-    }
-}
-
-@end

+ 0 - 445
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSClient.h

@@ -1,445 +0,0 @@
-//
-//  OSSClient.h
-//  oss_ios_sdk
-//
-//  Created by zhouzhuo on 8/16/15.
-//  Copyright (c) 2015 aliyun.com. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-@class OSSGetServiceRequest;
-@class OSSCreateBucketRequest;
-@class OSSDeleteBucketRequest;
-@class OSSHeadObjectRequest;
-@class OSSGetBucketRequest;
-@class OSSGetBucketACLRequest;
-@class OSSGetObjectRequest;
-@class OSSGetObjectACLRequest;
-@class OSSPutObjectRequest;
-@class OSSPutObjectACLRequest;
-@class OSSDeleteObjectRequest;
-@class OSSDeleteMultipleObjectsRequest;
-@class OSSCopyObjectRequest;
-@class OSSInitMultipartUploadRequest;
-@class OSSUploadPartRequest;
-@class OSSCompleteMultipartUploadRequest;
-@class OSSListPartsRequest;
-@class OSSListMultipartUploadsRequest;
-@class OSSAbortMultipartUploadRequest;
-@class OSSAppendObjectRequest;
-@class OSSResumableUploadRequest;
-@class OSSMultipartUploadRequest;
-@class OSSCallBackRequest;
-@class OSSImagePersistRequest;
-@class OSSGetBucketInfoRequest;
-@class OSSPutSymlinkRequest;
-@class OSSGetSymlinkRequest;
-@class OSSRestoreObjectRequest;
-
-@class OSSTask;
-@class OSSExecutor;
-@class OSSNetworking;
-@class OSSClientConfiguration;
-@protocol OSSCredentialProvider;
-
-NS_ASSUME_NONNULL_BEGIN
-
-/**
- OSSClient is the entry class to access OSS in an iOS client. It provides all the methods to communicate with OSS.
- Generally speaking, only one instance of OSSClient is needed in the whole app.
- */
-@interface OSSClient : NSObject
-
-/**
- OSS endpoint. It varies in different regions. Please check out OSS official website for the exact endpoints for your data.
- */
-@property (nonatomic, strong) NSString * endpoint;
-
-/**
- The networking instance for sending and receiving data
- */
-@property (nonatomic, strong) OSSNetworking * networking;
-
-/**
- The credential provider instance
- */
-@property (nonatomic, strong) id<OSSCredentialProvider> credentialProvider;
-
-/**
- Client configuration instance
- */
-@property (nonatomic, strong) OSSClientConfiguration * clientConfiguration;
-
-/**
- oss operation task queue
- */
-@property (nonatomic, strong, readonly) OSSExecutor * ossOperationExecutor;
-
-/**
- Initializes an OSSClient instance with the default client configuration.
- @endpoint it specifies domain of the bucket's region. Starting 2017, the domain must be prefixed with "https://" to follow Apple's ATS policy.
-             For example: "https://oss-cn-hangzhou.aliyuncs.com"
- @credentialProvider The credential provider
- */
-- (instancetype)initWithEndpoint:(NSString *)endpoint
-              credentialProvider:(id<OSSCredentialProvider>) credentialProvider;
-
-/**
- Initializes an OSSClient with the custom client configuration.
- @endpoint it specifies domain of the bucket's region. Starting 2017, the domain must be prefixed with "https://" to follow Apple's ATS policy.
-             For example: "https://oss-cn-hangzhou.aliyuncs.com"
- @credentialProvider The credential provider
- @conf The custom client configuration such as retry time, timeout values, etc.
- */
-- (instancetype)initWithEndpoint:(NSString *)endpoint
-              credentialProvider:(id<OSSCredentialProvider>)credentialProvider
-             clientConfiguration:(OSSClientConfiguration *)conf;
-
-#pragma mark restful-api
-
-/**
- The corresponding RESTFul API: GetService
- Gets all the buckets of the current user
- Notes:
- 1. STS is not supported yet in this call.
- 2. When all buckets are returned, the xml in response body does not have nodes of Prefix, Marker, MaxKeys, IsTruncated and NextMarker.
-    If there're remaining buckets to return, the xml will have these nodes. The nextMarker is the value of marker in the next call.
- */
-- (OSSTask *)getService:(OSSGetServiceRequest *)request;
-
-@end
-
-
-@interface OSSClient (Bucket)
-
-/**
- The corresponding RESTFul API: PutBucket
- Creates a bucket--it does not support anonymous access. By default, the datacenter used is oss-cn-hangzhou.
- Callers could explicitly specify the datacenter for the bucket to optimize the performance and cost or meet the regulation requirement.
- Notes:
- 1. STS is not supported yet.
- */
-- (OSSTask *)createBucket:(OSSCreateBucketRequest *)request;
-
-/**
- The corresponding RESTFul API: DeleteBucket
- Deletes a bucket.
- */
-- (OSSTask *)deleteBucket:(OSSDeleteBucketRequest *)request;
-
-/**
- The corresponding RESTFul API: GetBucket
- Lists all objects in a bucket. It could be specified with filters such as prefix, marker, delimeter and max-keys.
- */
-- (OSSTask *)getBucket:(OSSGetBucketRequest *)request;
-
-/**
- The corresponding RESTFul API: GetBucketInfo
- Gets the {@link Bucket}'s basic information as well as its ACL.
- */
-- (OSSTask *)getBucketInfo:(OSSGetBucketInfoRequest *)request;
-
-/**
- The corresponding RESTFul API: GetBucketACL
- Gets the bucket ACL.
- */
-- (OSSTask *)getBucketACL:(OSSGetBucketACLRequest *)request;
-
-@end
-
-
-@interface OSSClient (Object)
-
-/**
- The corresponding RESTFul API: HeadObject
- Gets the object's metadata information. The object's content is not returned.
- */
-- (OSSTask *)headObject:(OSSHeadObjectRequest *)request;
-
-/**
- The corresponding RESTFul API: GetObject
- Gets the whole object (includes content). It requires caller have read permission on the object.
- */
-- (OSSTask *)getObject:(OSSGetObjectRequest *)request;
-
-/**
- The corresponding RESTFul API: GetObjectACL
- get the acl of an object.
- */
-- (OSSTask *)getObjectACL:(OSSGetObjectACLRequest *)request;
-
-/**
- The corresponding RESTFul API: PutObject
- Uploads a file.
- */
-- (OSSTask *)putObject:(OSSPutObjectRequest *)request;
-
-/**
- Sets the object's ACL. Right now an object has three access permissions: private, public-ready, public-read-write.
- The operation specifies the x-oss-object-acl header in the put request. The caller must be the owner of the object.
- If succeeds, it returns HTTP status 200; otherwise it returns related error code and error messages.
- */
-- (OSSTask *)putObjectACL:(OSSPutObjectACLRequest *)request;
-
-/**
- The corresponding RESTFul API: AppendObject
- Appends data to an existing or non-existing object. The object created by this operation is appendable.
- As a comparison, the object created by Put Object is normal (non-appendable).
- */
-- (OSSTask *)appendObject:(OSSAppendObjectRequest *)request;
-
-/**
- *  @brief      Appends data to an existing or non-existing object on the OSS server.
- *              The object created by this operation is appendable.
- *  @request    request
- *  @crc64ecma  crc64ecma
- *             if object has been stored on OSS server, you need to invoke headObject
- *             api get object's crc64ecma,then use this api to append data to the
- *             object.
- */
-- (OSSTask *)appendObject:(OSSAppendObjectRequest *)request withCrc64ecma:(nullable NSString *)crc64ecma;
-
-/**
- The corresponding RESTFul API: copyObject
- Copies an existing object to another one.The operation sends a PUT request with x-oss-copy-source header to specify the source object.
- OSS server side will detect and copy the object. If it succeeds, the new object's metadata information will be returned.
- The operation applies for files less than 1GB. For big files, use UploadPartCopy RESTFul API.
- */
-- (OSSTask *)copyObject:(OSSCopyObjectRequest *)request;
-
-/**
- * Batch deletes the specified files under a specific bucket. If the files
- * are non-exist, the operation will still return successful.
- *
- * @param request
- *            A OSSDeleteMultipleObjectsRequest instance which specifies the
- *            bucket and file keys to delete.
- * @return A OSSTask with result of OSSDeleteMultipleObjectsResult instance which specifies each
- *         file's result in normal mode or only failed deletions in quite
- *         mode. By default it's quite mode.
- */
-- (OSSTask *)deleteMultipleObjects:(OSSDeleteMultipleObjectsRequest *)request;
-
-/**
- The corresponding RESTFul API: DeleteObject
- Deletes an object
- */
-- (OSSTask *)deleteObject:(OSSDeleteObjectRequest *)request;
-
-/**
- * Creates a symbol link to a target file under the bucket---this is not
- * supported for archive class bucket.
- *
- * @param request
- *            A OSSPutSymlinkRequest instance that specifies the
- *            bucket name, symlink name.
- * @return An instance of OSSTask. On successful execution, `task.result` will
- *         contain an instance of `OSSPutSymlinkResult`,otherwise will contain
- *         an instance of NSError.
- *
- * for more information,please refer to https://help.aliyun.com/document_detail/45126.html
- */
-- (OSSTask *)putSymlink:(OSSPutSymlinkRequest *)request;
-
-/**
- * Gets the symlink information for the given symlink name.
- *
- * @param request
- *            A OSSGetSymlinkRequest instance which specifies the bucket
- *            name and symlink name.
- * @return An instance of OSSTask. On successful execution, `task.result` will
- *         contain an instance of `OSSGetSymlinkResult`,otherwise will contain
- *         an instance of NSError.
- *
- * for more information,please refer to https://help.aliyun.com/document_detail/45146.html
- */
-- (OSSTask *)getSymlink:(OSSGetSymlinkRequest *)request;
-
-/**
- * Restores the object of archive storage. The function is not applicable to
- * Normal or IA storage. The restoreObject() needs to be called prior to
- * calling getObject() on an archive object.
- *
- * @param request
- *          A container for the necessary parameters to execute the RestoreObject
- *          service method.
- *
- * @return An instance of OSSTask. On successful execution, `task.result` will
- *         contain an instance of `OSSRestoreObjectResult`,otherwise will contain
- *         an instance of NSError.
- *
- * for more information,please refer to https://help.aliyun.com/document_detail/52930.html
- */
-- (OSSTask *)restoreObject:(OSSRestoreObjectRequest *)request;
-
-@end
-
-@interface OSSClient (MultipartUpload)
-
-/**
- The corresponding RESTFul API: InitiateMultipartUpload
- Initiates a multipart upload to get a upload Id. It's needed before starting uploading parts data.
- The upload Id is used for subsequential operations such as aborting the upload, querying the uploaded parts, etc.
- */
-- (OSSTask *)multipartUploadInit:(OSSInitMultipartUploadRequest *)request;
-
-/**
- The corresponding RESTFul API: UploadPart
- After the multipart upload is initiated, this API could be called to upload the data to the target file with the upload Id.
- Every uploaded part has a unique id called part number, which ranges from 1 to 10,000.
- For a given upload Id, the part number identifies the specific range of the data in the whole file.
- If the same part number is used for another upload, the existing data will be overwritten by the new upload.
- Except the last part, all other part's minimal size is 100KB.
- But no minimal size requirement on the last part.
- */
-- (OSSTask *)uploadPart:(OSSUploadPartRequest *)request;
-
-/**
- The corresponding RESTFul API: CompleteMultipartUpload
- This API is to complete the multipart upload after all parts data have been uploaded.
- It must be provided with a valid part list (each part has the part number and ETag).
- OSS will validate every part and then complete the multipart upload.
- If any part is invalid (e.g. the part is updated by another part upload), this API will fail.
- */
-- (OSSTask *)completeMultipartUpload:(OSSCompleteMultipartUploadRequest *)request;
-
-/**
- The corresponding RESTFul API: ListParts
- Lists all uploaded parts of the specified upload id.
- */
-- (OSSTask *)listParts:(OSSListPartsRequest *)request;
-
-/**
- The corresponding RESTFul API: ListMultipartUploads
- Lists all multipart uploads with the specified bucket.
- */
-- (OSSTask *)listMultipartUploads:(OSSListMultipartUploadsRequest *)request;
-
-/**
- The corresponding RESTFul API: AbortMultipartUpload
- Aborts the multipart upload by the specified upload Id.
- Once the multipart upload is aborted by this API, all parts data will be deleted and the upload Id is invalid anymore.
- */
-- (OSSTask *)abortMultipartUpload:(OSSAbortMultipartUploadRequest *)request;
-
-- (OSSTask *)abortResumableMultipartUpload:(OSSResumableUploadRequest *)request;
-
-/**
- Multipart upload API
- */
-- (OSSTask *)multipartUpload:(OSSMultipartUploadRequest *)request;
-/**
- TODOTODO
- Resumable upload API
- This API wraps the multipart upload and also enables resuming upload by reading/writing  the checkpoint data.
- For a new file, multipartUploadInit() needs to be called first to get the upload Id. Then use this upload id to call this API to upload the data.
- If the upload fails, checks the error messages:
- If it's a recoverable error, then call this API again with the same upload Id to retry. The uploaded data will not be uploaded again.
- Otherwise then you may need to recreates a new upload Id and call this method again.
- Check out demo for the detail.
- */
-- (OSSTask *)resumableUpload:(OSSResumableUploadRequest *)request;
-
-/**
- * multipart upload sequentially in order,support resume upload
- */
-- (OSSTask *)sequentialMultipartUpload:(OSSResumableUploadRequest *)request;
-
-@end
-
-
-@interface OSSClient (PresignURL)
-
-/**
- Generates a signed URL for the object and anyone has this URL will get the GET permission on the object.
- @bucketName object's bucket name
- @objectKey Object name
- @interval Expiration time in seconds. The URL could be specified with the expiration time to limit the access window on the object.
- */
-- (OSSTask *)presignConstrainURLWithBucketName:(NSString *)bucketName
-                                 withObjectKey:(NSString *)objectKey
-                        withExpirationInterval:(NSTimeInterval)interval;
-
-/**
- Generates a signed URL for the object and anyone has this URL will get the specified permission on the object.
- @bucketName object's bucket name
- @objectKey Object name
- @interval Expiration time in seconds. The URL could be specified with the expiration time to limit the access window on the object.
- @parameter it could specify allowed HTTP methods
- */
-- (OSSTask *)presignConstrainURLWithBucketName:(NSString *)bucketName
-                                 withObjectKey:(NSString *)objectKey
-                        withExpirationInterval:(NSTimeInterval)interval
-                                withParameters:(NSDictionary *)parameters;
-
-/**
- Generates a signed URL for the object and anyone has this URL will get the specified permission on the object. currently only support get and head method.
- @bucketName object's bucket name
- @objectKey Object name
- @httpMethod http method.currently only support get and head.
- @interval Expiration time in seconds. The URL could be specified with the expiration time to limit the access window on the object.
- @parameter it could specify allowed HTTP methods
- */
-- (OSSTask *)presignConstrainURLWithBucketName:(NSString *)bucketName
-                                 withObjectKey:(NSString *)objectKey
-                                    httpMethod:(NSString *)method
-                        withExpirationInterval:(NSTimeInterval)interval
-                                withParameters:(NSDictionary *)parameters;
-
-/**
- If the object's ACL is public read or public read-write, use this API to generate a signed url for sharing.
- @bucketName Object's bucket name
- @objectKey Object name
- */
-- (OSSTask *)presignPublicURLWithBucketName:(NSString *)bucketName
-                              withObjectKey:(NSString *)objectKey;
-
-/** TODOTODO
- If the object's ACL is public read or public read-write, use this API to generate a signed url for sharing.
- @bucketName Object's bucket name
- @objectKey Object name
- @parameter the request parameters.
- */
-- (OSSTask *)presignPublicURLWithBucketName:(NSString *)bucketName
-                              withObjectKey:(NSString *)objectKey
-                             withParameters:(NSDictionary *)parameters;
-
-@end
-
-
-@interface OSSClient (ImageService)
-
-/*
- * image persist action
- * https://help.aliyun.com/document_detail/55811.html
- */
-- (OSSTask *)imageActionPersist:(OSSImagePersistRequest *)request;
-
-@end
-
-
-@interface OSSClient (Utilities)
-
-/**
- Checks if the object exists
- @bucketName Object's bucket name
- @objectKey Object name
- 
- return YES                     Object exists
- return NO && *error = nil      Object does not exist
- return NO && *error != nil     Error occured.
- */
-- (BOOL)doesObjectExistInBucket:(NSString *)bucketName
-                      objectKey:(NSString *)objectKey
-                          error:(const NSError **)error;
-
-@end
-
-
-@interface OSSClient (Callback)
-
-- (OSSTask *)triggerCallBack:(OSSCallBackRequest *)request;
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 2067
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSClient.m

@@ -1,2067 +0,0 @@
-//
-//  OSSClient.m
-//  oss_ios_sdk
-//
-//  Created by zhouzhuo on 8/16/15.
-//  Copyright (c) 2015 aliyun.com. All rights reserved.
-//
-
-#import "OSSClient.h"
-#import "OSSDefine.h"
-#import "OSSModel.h"
-#import "OSSUtil.h"
-#import "OSSLog.h"
-#import "OSSBolts.h"
-#import "OSSNetworking.h"
-#import "OSSXMLDictionary.h"
-#import "OSSReachabilityManager.h"
-#import "OSSIPv6Adapter.h"
-
-#import "OSSNetworkingRequestDelegate.h"
-#import "OSSAllRequestNeededMessage.h"
-#import "OSSURLRequestRetryHandler.h"
-#import "OSSHttpResponseParser.h"
-#import "OSSGetObjectACLRequest.h"
-#import "OSSDeleteMultipleObjectsRequest.h"
-#import "OSSGetBucketInfoRequest.h"
-#import "OSSPutSymlinkRequest.h"
-#import "OSSGetSymlinkRequest.h"
-#import "OSSRestoreObjectRequest.h"
-
-static NSString * const kClientRecordNameWithCommonPrefix = @"oss_partInfos_storage_name";
-static NSString * const kClientRecordNameWithCRC64Suffix = @"-crc64";
-static NSString * const kClientRecordNameWithSequentialSuffix = @"-sequential";
-static NSUInteger const kClientMaximumOfChunks = 5000;   //max part number
-
-static NSString * const kClientErrorMessageForEmptyFile = @"the length of file should not be 0!";
-static NSString * const kClientErrorMessageForCancelledTask = @"This task has been cancelled!";
-
-/**
- * extend OSSRequest to include the ref to networking request object
- */
-@interface OSSRequest ()
-
-@property (nonatomic, strong) OSSNetworkingRequestDelegate * requestDelegate;
-
-@end
-
-@interface OSSClient()
-
-- (void)enableCRC64WithFlag:(OSSRequestCRCFlag)flag requestDelegate:(OSSNetworkingRequestDelegate *)delegate;
-- (OSSTask *)preChecksForRequest:(OSSMultipartUploadRequest *)request;
-- (void)checkRequestCrc64Setting:(OSSRequest *)request;
-- (OSSTask *)checkNecessaryParamsOfRequest:(OSSMultipartUploadRequest *)request;
-- (OSSTask *)checkPartSizeForRequest:(OSSMultipartUploadRequest *)request;
-- (NSUInteger)judgePartSizeForMultipartRequest:(OSSMultipartUploadRequest *)request fileSize:(unsigned long long)fileSize;
-- (unsigned long long)getSizeWithFilePath:(nonnull NSString *)filePath error:(NSError **)error;
-- (NSString *)readUploadIdForRequest:(OSSResumableUploadRequest *)request recordFilePath:(NSString **)recordFilePath sequential:(BOOL)sequential;
-- (NSMutableDictionary *)localPartInfosDictoryWithUploadId:(NSString *)uploadId;
-- (OSSTask *)persistencePartInfos:(NSDictionary *)partInfos withUploadId:(NSString *)uploadId;
-- (OSSTask *)checkFileSizeWithRequest:(OSSMultipartUploadRequest *)request;
-+ (NSError *)cancelError;
-
-@end
-
-@implementation OSSClient
-
-static NSObject *lock;
-
-- (instancetype)initWithEndpoint:(NSString *)endpoint credentialProvider:(id<OSSCredentialProvider>)credentialProvider {
-    return [self initWithEndpoint:endpoint credentialProvider:credentialProvider clientConfiguration:[OSSClientConfiguration new]];
-}
-
-- (instancetype)initWithEndpoint:(NSString *)endpoint
-              credentialProvider:(id<OSSCredentialProvider>)credentialProvider
-             clientConfiguration:(OSSClientConfiguration *)conf {
-    if (self = [super init]) {
-        if (!lock) {
-            lock = [NSObject new];
-        }
-        // Monitor the network. If the network type is changed, recheck the IPv6 status.
-        [OSSReachabilityManager shareInstance];
-
-        NSOperationQueue * queue = [NSOperationQueue new];
-        // using for resumable upload and compat old interface
-        queue.maxConcurrentOperationCount = 3;
-        _ossOperationExecutor = [OSSExecutor executorWithOperationQueue:queue];
-        
-        if (![endpoint oss_isNotEmpty]) {
-            [NSException raise:NSInvalidArgumentException
-                        format:@"endpoint should not be nil or empty!"];
-        }
-        
-        if ([endpoint rangeOfString:@"://"].location == NSNotFound) {
-            endpoint = [@"https://" stringByAppendingString:endpoint];
-        }
-        
-        NSURL *endpointURL = [NSURL URLWithString:endpoint];
-        if ([endpointURL.scheme.lowercaseString isEqualToString:@"https"]) {
-            if ([[OSSIPv6Adapter getInstance] isIPv4Address: endpointURL.host] || [[OSSIPv6Adapter getInstance] isIPv6Address: endpointURL.host]) {
-                [NSException raise:NSInvalidArgumentException
-                            format:@"unsupported format of endpoint, please use right endpoint format!"];
-            }
-        }
-        
-        self.endpoint = [endpoint oss_trim];
-        self.credentialProvider = credentialProvider;
-        self.clientConfiguration = conf;
-
-        OSSNetworkingConfiguration * netConf = [OSSNetworkingConfiguration new];
-        if (conf) {
-            netConf.maxRetryCount = conf.maxRetryCount;
-            netConf.timeoutIntervalForRequest = conf.timeoutIntervalForRequest;
-            netConf.timeoutIntervalForResource = conf.timeoutIntervalForResource;
-            netConf.enableBackgroundTransmitService = conf.enableBackgroundTransmitService;
-            netConf.backgroundSessionIdentifier = conf.backgroundSesseionIdentifier;
-            netConf.proxyHost = conf.proxyHost;
-            netConf.proxyPort = conf.proxyPort;
-            netConf.maxConcurrentRequestCount = conf.maxConcurrentRequestCount;
-        }
-        self.networking = [[OSSNetworking alloc] initWithConfiguration:netConf];
-    }
-    return self;
-}
-
-- (OSSTask *)invokeRequest:(OSSNetworkingRequestDelegate *)request requireAuthentication:(BOOL)requireAuthentication {
-    /* if content-type haven't been set, we set one */
-    if (!request.allNeededMessage.contentType.oss_isNotEmpty
-        && ([request.allNeededMessage.httpMethod isEqualToString:@"POST"] || [request.allNeededMessage.httpMethod isEqualToString:@"PUT"])) {
-
-        request.allNeededMessage.contentType = [OSSUtil detemineMimeTypeForFilePath:request.uploadingFileURL.path               uploadName:request.allNeededMessage.objectKey];
-    }
-
-    // Checks if the endpoint is in the excluded CName list.
-    [self.clientConfiguration.cnameExcludeList enumerateObjectsUsingBlock:^(NSString *exclude, NSUInteger idx, BOOL * _Nonnull stop) {
-        if ([self.endpoint hasSuffix:exclude]) {
-            request.allNeededMessage.isHostInCnameExcludeList = YES;
-            *stop = YES;
-        }
-    }];
-
-    id<OSSRequestInterceptor> uaSetting = [[OSSUASettingInterceptor alloc] initWithClientConfiguration:self.clientConfiguration];
-    [request.interceptors addObject:uaSetting];
-
-    /* check if the authentication is required */
-    if (requireAuthentication) {
-        id<OSSRequestInterceptor> signer = [[OSSSignerInterceptor alloc] initWithCredentialProvider:self.credentialProvider];
-        [request.interceptors addObject:signer];
-    }
-
-    request.isHttpdnsEnable = self.clientConfiguration.isHttpdnsEnable;
-
-    return [_networking sendRequest:request];
-}
-
-#pragma implement restful apis
-
-- (OSSTask *)getService:(OSSGetServiceRequest *)request {
-    OSSNetworkingRequestDelegate * requestDelegate = request.requestDelegate;
-
-    requestDelegate.responseParser = [[OSSHttpResponseParser alloc] initForOperationType:OSSOperationTypeGetService];
-    
-    OSSAllRequestNeededMessage *neededMsg = [[OSSAllRequestNeededMessage alloc] init];
-    neededMsg.endpoint = self.endpoint;
-    neededMsg.httpMethod = OSSHTTPMethodGET;
-    neededMsg.params = [request requestParams];
-    requestDelegate.allNeededMessage = neededMsg;
-    
-    requestDelegate.operType = OSSOperationTypeGetService;
-
-    return [self invokeRequest:requestDelegate requireAuthentication:request.isAuthenticationRequired];
-}
-
-
-
-# pragma mark - Private Methods
-
-- (void)enableCRC64WithFlag:(OSSRequestCRCFlag)flag requestDelegate:(OSSNetworkingRequestDelegate *)delegate
-{
-    switch (flag) {
-        case OSSRequestCRCOpen:
-            delegate.crc64Verifiable = YES;
-            break;
-        case OSSRequestCRCClosed:
-            delegate.crc64Verifiable = NO;
-            break;
-        default:
-            delegate.crc64Verifiable = self.clientConfiguration.crc64Verifiable;
-            break;
-    }
-}
-
-- (OSSTask *)preChecksForRequest:(OSSMultipartUploadRequest *)request
-{
-    OSSTask *preTask = [self checkFileSizeWithRequest:request];
-    if (preTask) {
-        return preTask;
-    }
-    
-    preTask = [self checkNecessaryParamsOfRequest:request];
-    if (preTask) {
-        return preTask;
-    }
-    
-    preTask = [self checkPartSizeForRequest:request];
-    if (preTask) {
-        return preTask;
-    }
-    
-    
-    return preTask;
-}
-
-- (void)checkRequestCrc64Setting:(OSSRequest *)request
-{
-    if (request.crcFlag == OSSRequestCRCUninitialized)
-    {
-        if (self.clientConfiguration.crc64Verifiable)
-        {
-            request.crcFlag = OSSRequestCRCOpen;
-        }else
-        {
-            request.crcFlag = OSSRequestCRCClosed;
-        }
-    }
-}
-
-- (OSSTask *)checkNecessaryParamsOfRequest:(OSSMultipartUploadRequest *)request
-{
-    NSError *error = nil;
-    if (![request.objectKey oss_isNotEmpty]) {
-        error = [NSError errorWithDomain:OSSClientErrorDomain
-                                    code:OSSClientErrorCodeInvalidArgument
-                                userInfo:@{OSSErrorMessageTOKEN: @"checkNecessaryParamsOfRequest requires nonnull objectKey!"}];
-    }else if (![request.bucketName oss_isNotEmpty]) {
-        error = [NSError errorWithDomain:OSSClientErrorDomain
-                                    code:OSSClientErrorCodeInvalidArgument
-                                userInfo:@{OSSErrorMessageTOKEN: @"checkNecessaryParamsOfRequest requires nonnull bucketName!"}];
-    }else if (![request.uploadingFileURL.path oss_isNotEmpty]) {
-        error = [NSError errorWithDomain:OSSClientErrorDomain
-                                    code:OSSClientErrorCodeInvalidArgument
-                                userInfo:@{OSSErrorMessageTOKEN: @"checkNecessaryParamsOfRequest requires nonnull uploadingFileURL!"}];
-    }
-    
-    OSSTask *errorTask = nil;
-    if (error) {
-        errorTask = [OSSTask taskWithError:error];
-    }
-    
-    return errorTask;
-}
-
-- (OSSTask *)checkPartSizeForRequest:(OSSMultipartUploadRequest *)request
-{
-    OSSTask *errorTask = nil;
-    unsigned long long fileSize = [self getSizeWithFilePath:request.uploadingFileURL.path error:nil];
-    
-    if (request.partSize == 0 || (fileSize > 102400 && request.partSize < 102400)) {
-        NSError *error = [NSError errorWithDomain:OSSClientErrorDomain
-                                             code:OSSClientErrorCodeInvalidArgument
-                                         userInfo:@{OSSErrorMessageTOKEN: @"Part size must be greater than equal to 100KB"}];
-        errorTask = [OSSTask taskWithError:error];
-    }
-    return errorTask;
-}
-
-- (NSUInteger)judgePartSizeForMultipartRequest:(OSSMultipartUploadRequest *)request fileSize:(unsigned long long)fileSize
-{
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wshorten-64-to-32"
-    BOOL divisible = (fileSize % request.partSize == 0);
-    NSUInteger partCount = (fileSize / request.partSize) + (divisible? 0 : 1);
-    
-    if(partCount > kClientMaximumOfChunks)
-    {
-        request.partSize = fileSize / kClientMaximumOfChunks;
-        partCount = kClientMaximumOfChunks;
-    }
-    return partCount;
-#pragma clang diagnostic pop
-}
-
-- (unsigned long long)getSizeWithFilePath:(nonnull NSString *)filePath error:(NSError **)error
-{
-    NSFileManager *fm = [NSFileManager defaultManager];
-    NSDictionary *attributes = [fm attributesOfItemAtPath:filePath error:error];
-    return attributes.fileSize;
-}
-
-- (NSString *)readUploadIdForRequest:(OSSResumableUploadRequest *)request recordFilePath:(NSString **)recordFilePath sequential:(BOOL)sequential
-{
-    NSString *uploadId = nil;
-    NSString *record = [NSString stringWithFormat:@"%@%@%@%lu", request.md5String, request.bucketName, request.objectKey, (unsigned long)request.partSize];
-    if (sequential) {
-        record = [record stringByAppendingString:kClientRecordNameWithSequentialSuffix];
-    }
-    if (request.crcFlag == OSSRequestCRCOpen) {
-        record = [record stringByAppendingString:kClientRecordNameWithCRC64Suffix];
-    }
-    
-    NSData *data = [record dataUsingEncoding:NSUTF8StringEncoding];
-    NSString *recordFileName = [OSSUtil dataMD5String:data];
-    *recordFilePath = [request.recordDirectoryPath stringByAppendingPathComponent: recordFileName];
-    NSFileManager *fileManager = [NSFileManager defaultManager];
-    if ([fileManager fileExistsAtPath: *recordFilePath]) {
-        NSFileHandle * read = [NSFileHandle fileHandleForReadingAtPath:*recordFilePath];
-        uploadId = [[NSString alloc] initWithData:[read readDataToEndOfFile] encoding:NSUTF8StringEncoding];
-        [read closeFile];
-    } else {
-        [fileManager createFileAtPath:*recordFilePath contents:nil attributes:nil];
-    }
-    return uploadId;
-}
-
-#pragma mark - sequential multipart upload
-
-- (NSMutableDictionary *)localPartInfosDictoryWithUploadId:(NSString *)uploadId
-{
-    NSMutableDictionary *localPartInfoDict = nil;
-    NSString *partInfosDirectory = [[NSString oss_documentDirectory] stringByAppendingPathComponent:kClientRecordNameWithCommonPrefix];
-    NSString *partInfosPath = [partInfosDirectory stringByAppendingPathComponent:uploadId];
-    BOOL isDirectory;
-    NSFileManager *defaultFM = [NSFileManager defaultManager];
-    if (!([defaultFM fileExistsAtPath:partInfosDirectory isDirectory:&isDirectory] && isDirectory))
-    {
-        if (![defaultFM createDirectoryAtPath:partInfosDirectory
-                                       withIntermediateDirectories:NO
-                                                        attributes:nil error:nil]) {
-            OSSLogError(@"create Directory(%@) failed!",partInfosDirectory);
-        };
-    }
-    
-    if (![defaultFM fileExistsAtPath:partInfosPath])
-    {
-        if (![defaultFM createFileAtPath:partInfosPath
-                               contents:nil
-                             attributes:nil])
-        {
-            OSSLogError(@"create local partInfo file failed!");
-        }
-    }
-    localPartInfoDict = [[NSMutableDictionary alloc] initWithContentsOfURL:[NSURL fileURLWithPath:partInfosPath]];
-    return localPartInfoDict;
-}
-
-- (OSSTask *)persistencePartInfos:(NSDictionary *)partInfos withUploadId:(NSString *)uploadId
-{
-    NSString *filePath = [[[NSString oss_documentDirectory] stringByAppendingPathComponent:kClientRecordNameWithCommonPrefix] stringByAppendingPathComponent:uploadId];
-    if (![partInfos writeToFile:filePath atomically:YES])
-    {
-        NSError *error = [NSError errorWithDomain:OSSClientErrorDomain
-                                             code:OSSClientErrorCodeFileCantWrite
-                                         userInfo:@{OSSErrorMessageTOKEN: @"uploadId for this task can't be stored persistentially!"}];
-        OSSLogDebug(@"[Error]: %@", error);
-        return [OSSTask taskWithError:error];
-    }
-    return nil;
-}
-
-- (OSSTask *)checkPutObjectFileURL:(OSSPutObjectRequest *)request {
-    NSError *error = nil;
-    if (!request.uploadingFileURL || ![request.uploadingFileURL.path oss_isNotEmpty]) {
-        error = [NSError errorWithDomain:OSSClientErrorDomain
-                                    code:OSSClientErrorCodeInvalidArgument
-                                userInfo:@{OSSErrorMessageTOKEN: @"Please check your request's uploadingFileURL!"}];
-    } else {
-        NSFileManager *dfm = [NSFileManager defaultManager];
-        NSDictionary *attributes = [dfm attributesOfItemAtPath:request.uploadingFileURL.path error:&error];
-        unsigned long long fileSize = [attributes[NSFileSize] unsignedLongLongValue];
-        if (!error && fileSize == 0) {
-            error = [NSError errorWithDomain:OSSClientErrorDomain
-                                        code:OSSClientErrorCodeInvalidArgument
-                                    userInfo:@{OSSErrorMessageTOKEN: kClientErrorMessageForEmptyFile}];
-        }
-    }
-    
-    if (error) {
-        return [OSSTask taskWithError:error];
-    } else {
-        return [OSSTask taskWithResult:nil];
-    }
-}
-
-- (OSSTask *)checkFileSizeWithRequest:(OSSMultipartUploadRequest *)request {
-    NSError *error = nil;
-    if (!request.uploadingFileURL || ![request.uploadingFileURL.path oss_isNotEmpty]) {
-        error = [NSError errorWithDomain:OSSClientErrorDomain
-                                    code:OSSClientErrorCodeInvalidArgument
-                                userInfo:@{OSSErrorMessageTOKEN: @"Please check your request's uploadingFileURL!"}];
-    }
-    else
-    {
-        NSFileManager *dfm = [NSFileManager defaultManager];
-        NSDictionary *attributes = [dfm attributesOfItemAtPath:request.uploadingFileURL.path error:&error];
-        unsigned long long fileSize = [attributes[NSFileSize] unsignedLongLongValue];
-        if (!error && fileSize == 0) {
-            error = [NSError errorWithDomain:OSSClientErrorDomain
-                                        code:OSSClientErrorCodeInvalidArgument
-                                    userInfo:@{OSSErrorMessageTOKEN: kClientErrorMessageForEmptyFile}];
-        }
-    }
-    
-    if (error) {
-        return [OSSTask taskWithError:error];
-    } else {
-        return nil;
-    }
-}
-
-+ (NSError *)cancelError{
-    static NSError *error = nil;
-    static dispatch_once_t onceToken;
-    dispatch_once(&onceToken, ^{
-        error = [NSError errorWithDomain:OSSClientErrorDomain
-                                    code:OSSClientErrorCodeTaskCancelled
-                                userInfo:@{OSSErrorMessageTOKEN: kClientErrorMessageForCancelledTask}];
-    });
-    return error;
-}
-
-- (void)dealloc{
-    [self.networking.session invalidateAndCancel];
-}
-
-@end
-
-
-@implementation OSSClient (Bucket)
-
-- (OSSTask *)createBucket:(OSSCreateBucketRequest *)request {
-    OSSNetworkingRequestDelegate *requestDelegate = request.requestDelegate;
-    NSMutableDictionary *headerParams = [NSMutableDictionary dictionary];
-    [headerParams oss_setObject:request.xOssACL forKey:OSSHttpHeaderBucketACL];
-    
-    if (request.location) {
-        requestDelegate.uploadingData = [OSSUtil constructHttpBodyForCreateBucketWithLocation:request.location];
-    }
-    
-    requestDelegate.responseParser = [[OSSHttpResponseParser alloc] initForOperationType:OSSOperationTypeCreateBucket];
-    
-    NSString *bodyString = [NSString stringWithFormat:@"<?xml version='1.0' encoding='UTF-8'?><CreateBucketConfiguration><StorageClass>%@</StorageClass></CreateBucketConfiguration>", request.storageClassAsString];
-    requestDelegate.uploadingData = [bodyString dataUsingEncoding:NSUTF8StringEncoding];
-    NSString *md5String = [OSSUtil base64Md5ForData:requestDelegate.uploadingData];
-    
-    OSSAllRequestNeededMessage *neededMsg = [[OSSAllRequestNeededMessage alloc] init];
-    neededMsg.endpoint = self.endpoint;
-    neededMsg.httpMethod = OSSHTTPMethodPUT;
-    neededMsg.bucketName = request.bucketName;
-    neededMsg.headerParams = headerParams;
-    neededMsg.contentMd5 = md5String;
-    requestDelegate.allNeededMessage = neededMsg;
-    
-    requestDelegate.operType = OSSOperationTypeCreateBucket;
-    
-    return [self invokeRequest:requestDelegate requireAuthentication:request.isAuthenticationRequired];
-}
-
-- (OSSTask *)deleteBucket:(OSSDeleteObjectRequest *)request {
-    OSSNetworkingRequestDelegate * requestDelegate = request.requestDelegate;
-    
-    requestDelegate.responseParser = [[OSSHttpResponseParser alloc] initForOperationType:OSSOperationTypeDeleteBucket];
-    
-    OSSAllRequestNeededMessage *neededMsg = [[OSSAllRequestNeededMessage alloc] init];
-    neededMsg.endpoint = self.endpoint;
-    neededMsg.httpMethod = OSSHTTPMethodDELETE;
-    neededMsg.bucketName = request.bucketName;
-    requestDelegate.allNeededMessage = neededMsg;
-    
-    requestDelegate.operType = OSSOperationTypeDeleteBucket;
-    
-    return [self invokeRequest:requestDelegate requireAuthentication:request.isAuthenticationRequired];
-}
-
-- (OSSTask *)getBucket:(OSSGetBucketRequest *)request {
-    OSSNetworkingRequestDelegate * requestDelegate = request.requestDelegate;
-    
-    requestDelegate.responseParser = [[OSSHttpResponseParser alloc] initForOperationType:OSSOperationTypeGetBucket];
-    
-    OSSAllRequestNeededMessage *neededMsg = [[OSSAllRequestNeededMessage alloc] init];
-    neededMsg.endpoint = self.endpoint;
-    neededMsg.httpMethod = OSSHTTPMethodGET;
-    neededMsg.bucketName = request.bucketName;
-    neededMsg.params = request.requestParams;
-    requestDelegate.allNeededMessage = neededMsg;
-    
-    requestDelegate.operType = OSSOperationTypeGetBucket;
-    
-    return [self invokeRequest:requestDelegate requireAuthentication:request.isAuthenticationRequired];
-}
-
-- (OSSTask *)getBucketInfo:(OSSGetBucketInfoRequest *)request {
-    OSSNetworkingRequestDelegate * requestDelegate = request.requestDelegate;
-    
-    requestDelegate.responseParser = [[OSSHttpResponseParser alloc] initForOperationType:OSSOperationTypeGetBucketInfo];
-    
-    OSSAllRequestNeededMessage *neededMsg = [[OSSAllRequestNeededMessage alloc] init];
-    neededMsg.endpoint = self.endpoint;
-    neededMsg.httpMethod = OSSHTTPMethodGET;
-    neededMsg.bucketName = request.bucketName;
-    neededMsg.params = request.requestParams;
-    requestDelegate.allNeededMessage = neededMsg;
-    
-    requestDelegate.operType = OSSOperationTypeGetBucketInfo;
-    
-    return [self invokeRequest:requestDelegate requireAuthentication:request.isAuthenticationRequired];
-}
-
-- (OSSTask *)getBucketACL:(OSSGetBucketACLRequest *)request {
-    OSSNetworkingRequestDelegate * requestDelegate = request.requestDelegate;
-    
-    requestDelegate.responseParser = [[OSSHttpResponseParser alloc] initForOperationType:OSSOperationTypeGetBucketACL];
-    
-    OSSAllRequestNeededMessage *neededMsg = [[OSSAllRequestNeededMessage alloc] init];
-    neededMsg.endpoint = self.endpoint;
-    neededMsg.httpMethod = OSSHTTPMethodGET;
-    neededMsg.bucketName = request.bucketName;
-    neededMsg.params = request.requestParams;
-    requestDelegate.allNeededMessage = neededMsg;
-    
-    requestDelegate.operType = OSSOperationTypeGetBucketACL;
-    
-    return [self invokeRequest:requestDelegate requireAuthentication:request.isAuthenticationRequired];
-}
-
-@end
-
-@implementation OSSClient (Object)
-
-- (OSSTask *)headObject:(OSSHeadObjectRequest *)request {
-    OSSNetworkingRequestDelegate * requestDelegate = request.requestDelegate;
-    
-    requestDelegate.responseParser = [[OSSHttpResponseParser alloc] initForOperationType:OSSOperationTypeHeadObject];
-    
-    OSSAllRequestNeededMessage *neededMsg = [[OSSAllRequestNeededMessage alloc] init];
-    neededMsg.endpoint = self.endpoint;
-    neededMsg.httpMethod = OSSHTTPMethodHEAD;
-    neededMsg.bucketName = request.bucketName;
-    neededMsg.objectKey = request.objectKey;
-    requestDelegate.allNeededMessage = neededMsg;
-    
-    requestDelegate.operType = OSSOperationTypeHeadObject;
-    
-    return [self invokeRequest:requestDelegate requireAuthentication:request.isAuthenticationRequired];
-}
-
-- (OSSTask *)getObject:(OSSGetObjectRequest *)request {
-    OSSNetworkingRequestDelegate * requestDelegate = request.requestDelegate;
-    
-    NSString * rangeString = nil;
-    if (request.range) {
-        rangeString = [request.range toHeaderString];
-    }
-    if (request.downloadProgress) {
-        requestDelegate.downloadProgress = request.downloadProgress;
-    }
-    if (request.onRecieveData) {
-        requestDelegate.onRecieveData = request.onRecieveData;
-    }
-    NSMutableDictionary * params = [NSMutableDictionary dictionary];
-    [params oss_setObject:request.xOssProcess forKey:OSSHttpQueryProcess];
-    
-    [self enableCRC64WithFlag:request.crcFlag requestDelegate:requestDelegate];
-    OSSHttpResponseParser *responseParser = [[OSSHttpResponseParser alloc] initForOperationType:OSSOperationTypeGetObject];
-    responseParser.crc64Verifiable = requestDelegate.crc64Verifiable;
-    
-    requestDelegate.responseParser = responseParser;
-    requestDelegate.responseParser.downloadingFileURL = request.downloadToFileURL;
-    
-    OSSAllRequestNeededMessage *neededMsg = [[OSSAllRequestNeededMessage alloc] init];
-    neededMsg.endpoint = self.endpoint;
-    neededMsg.httpMethod = OSSHTTPMethodGET;
-    neededMsg.bucketName = request.bucketName;
-    neededMsg.objectKey = request.objectKey;
-    neededMsg.range = rangeString;
-    neededMsg.params = params;
-    neededMsg.headerParams = request.headerFields;
-    requestDelegate.allNeededMessage = neededMsg;
-    
-    requestDelegate.operType = OSSOperationTypeGetObject;
-    
-    return [self invokeRequest:requestDelegate requireAuthentication:request.isAuthenticationRequired];
-}
-
-- (OSSTask *)getObjectACL:(OSSGetObjectACLRequest *)request
-{
-    OSSNetworkingRequestDelegate *requestDelegate = request.requestDelegate;
-    requestDelegate.responseParser = [[OSSHttpResponseParser alloc] initForOperationType:OSSOperationTypeGetObjectACL];
-    
-    NSMutableDictionary *params = [NSMutableDictionary dictionary];
-    [params oss_setObject:@"" forKey:@"acl"];
-    
-    OSSAllRequestNeededMessage *neededMsg = [[OSSAllRequestNeededMessage alloc] init];
-    neededMsg.endpoint = self.endpoint;
-    neededMsg.httpMethod = OSSHTTPMethodGET;
-    neededMsg.bucketName = request.bucketName;
-    neededMsg.objectKey = request.objectName;
-    neededMsg.params = params;
-    requestDelegate.allNeededMessage = neededMsg;
-    
-    requestDelegate.operType = OSSOperationTypeGetObjectACL;
-    
-    return [self invokeRequest:requestDelegate requireAuthentication:request.isAuthenticationRequired];
-}
-
-- (OSSTask *)putObject:(OSSPutObjectRequest *)request
-{
-    OSSNetworkingRequestDelegate * requestDelegate = request.requestDelegate;
-    NSMutableDictionary * headerParams = [NSMutableDictionary dictionaryWithDictionary:request.objectMeta];
-    [self enableCRC64WithFlag:request.crcFlag requestDelegate:requestDelegate];
-    
-    if (request.uploadingData) {
-        requestDelegate.uploadingData = request.uploadingData;
-        if (requestDelegate.crc64Verifiable)
-        {
-            NSMutableData *mutableData = [NSMutableData dataWithData:request.uploadingData];
-            requestDelegate.contentCRC = [NSString stringWithFormat:@"%llu",[mutableData oss_crc64]];
-        }
-    }
-    if (request.uploadingFileURL) {
-        OSSTask *checkIfEmptyTask = [self checkPutObjectFileURL:request];
-        if (checkIfEmptyTask.error) {
-            return checkIfEmptyTask;
-        }
-        requestDelegate.uploadingFileURL = request.uploadingFileURL;
-    }
-    
-    if (request.uploadProgress) {
-        requestDelegate.uploadProgress = request.uploadProgress;
-    }
-    if (request.uploadRetryCallback) {
-        requestDelegate.retryCallback = request.uploadRetryCallback;
-    }
-    
-    [headerParams oss_setObject:[request.callbackParam base64JsonString] forKey:OSSHttpHeaderXOSSCallback];
-    [headerParams oss_setObject:[request.callbackVar base64JsonString] forKey:OSSHttpHeaderXOSSCallbackVar];
-    [headerParams oss_setObject:request.contentDisposition forKey:OSSHttpHeaderContentDisposition];
-    [headerParams oss_setObject:request.contentEncoding forKey:OSSHttpHeaderContentEncoding];
-    [headerParams oss_setObject:request.expires forKey:OSSHttpHeaderExpires];
-    [headerParams oss_setObject:request.cacheControl forKey:OSSHttpHeaderCacheControl];
-    
-    OSSHttpResponseParser *responseParser = [[OSSHttpResponseParser alloc] initForOperationType:OSSOperationTypePutObject];
-    responseParser.crc64Verifiable = requestDelegate.crc64Verifiable;
-    requestDelegate.responseParser = responseParser;
-    
-    OSSAllRequestNeededMessage *neededMsg = [[OSSAllRequestNeededMessage alloc] init];
-    neededMsg.endpoint = self.endpoint;
-    neededMsg.httpMethod = OSSHTTPMethodPUT;
-    neededMsg.bucketName = request.bucketName;
-    neededMsg.objectKey = request.objectKey;
-    neededMsg.contentMd5 = request.contentMd5;
-    neededMsg.contentType = request.contentType;
-    neededMsg.headerParams = headerParams;
-    neededMsg.contentSHA1 = request.contentSHA1;
-    requestDelegate.allNeededMessage = neededMsg;
-    
-    requestDelegate.operType = OSSOperationTypePutObject;
-    
-    return [self invokeRequest:requestDelegate requireAuthentication:request.isAuthenticationRequired];
-}
-
-- (OSSTask *)putObjectACL:(OSSPutObjectACLRequest *)request {
-    OSSNetworkingRequestDelegate * requestDelegate = request.requestDelegate;
-    if (request.uploadRetryCallback) {
-        requestDelegate.retryCallback = request.uploadRetryCallback;
-    }
-    NSMutableDictionary * headerParams = [NSMutableDictionary dictionary];
-    [headerParams oss_setObject:request.acl forKey:OSSHttpHeaderObjectACL];
-    
-    NSMutableDictionary * params = [NSMutableDictionary dictionary]; 
-    [params oss_setObject:@"" forKey:@"acl"];
-    
-    requestDelegate.responseParser = [[OSSHttpResponseParser alloc] initForOperationType:OSSOperationTypePutObjectACL];
-    
-    OSSAllRequestNeededMessage *neededMsg = [[OSSAllRequestNeededMessage alloc] init];
-    neededMsg.endpoint = self.endpoint;
-    neededMsg.httpMethod = OSSHTTPMethodPUT;
-    neededMsg.bucketName = request.bucketName;
-    neededMsg.objectKey = request.objectKey;
-    neededMsg.params = params;
-    neededMsg.headerParams = headerParams;
-    requestDelegate.allNeededMessage = neededMsg;
-    
-    requestDelegate.operType = OSSOperationTypePutObjectACL;
-    
-    return [self invokeRequest:requestDelegate requireAuthentication:request.isAuthenticationRequired];
-}
-
-- (OSSTask *)appendObject:(OSSAppendObjectRequest *)request
-{
-    return [self appendObject:request withCrc64ecma:nil];
-}
-
-- (OSSTask *)appendObject:(OSSAppendObjectRequest *)request withCrc64ecma:(nullable NSString *)crc64ecma
-{
-    OSSNetworkingRequestDelegate * requestDelegate = request.requestDelegate;
-    requestDelegate.lastCRC = crc64ecma;
-    [self enableCRC64WithFlag:request.crcFlag requestDelegate:requestDelegate];
-    
-    if (request.uploadingData)
-    {
-        requestDelegate.uploadingData = request.uploadingData;
-        if (requestDelegate.crc64Verifiable)
-        {
-            NSMutableData *mutableData = [NSMutableData dataWithData:request.uploadingData];
-            requestDelegate.contentCRC = [NSString stringWithFormat:@"%llu",[mutableData oss_crc64]];
-        }
-    }
-    if (request.uploadingFileURL) {
-        requestDelegate.uploadingFileURL = request.uploadingFileURL;
-    }
-    if (request.uploadProgress) {
-        requestDelegate.uploadProgress = request.uploadProgress;
-    }
-    
-    NSMutableDictionary * headerParams = [NSMutableDictionary dictionaryWithDictionary:request.objectMeta];
-    [headerParams oss_setObject:request.contentDisposition forKey:OSSHttpHeaderContentDisposition];
-    [headerParams oss_setObject:request.contentEncoding forKey:OSSHttpHeaderContentEncoding];
-    [headerParams oss_setObject:request.expires forKey:OSSHttpHeaderExpires];
-    [headerParams oss_setObject:request.cacheControl forKey:OSSHttpHeaderCacheControl];
-    
-    NSMutableDictionary* params = [NSMutableDictionary dictionary];
-    [params oss_setObject:@"" forKey:@"append"];
-    [params oss_setObject:[@(request.appendPosition) stringValue] forKey:@"position"];
-    
-    OSSHttpResponseParser *responseParser = [[OSSHttpResponseParser alloc] initForOperationType:OSSOperationTypeAppendObject];
-    responseParser.crc64Verifiable = requestDelegate.crc64Verifiable;
-    requestDelegate.responseParser = responseParser;
-    
-    OSSAllRequestNeededMessage *neededMsg = [[OSSAllRequestNeededMessage alloc] init];
-    neededMsg.endpoint = self.endpoint;
-    neededMsg.httpMethod = OSSHTTPMethodPOST;
-    neededMsg.bucketName = request.bucketName;
-    neededMsg.objectKey = request.objectKey;
-    neededMsg.contentType = request.contentType;
-    neededMsg.contentMd5 = request.contentMd5;
-    neededMsg.headerParams = headerParams;
-    neededMsg.params = params;
-    neededMsg.contentSHA1 = request.contentSHA1;
-    requestDelegate.allNeededMessage = neededMsg;
-    
-    requestDelegate.operType = OSSOperationTypeAppendObject;
-    
-    return [self invokeRequest:requestDelegate requireAuthentication:request.isAuthenticationRequired];
-}
-
-- (OSSTask *)deleteObject:(OSSDeleteObjectRequest *)request {
-    OSSNetworkingRequestDelegate * requestDelegate = request.requestDelegate;
-    
-    requestDelegate.responseParser = [[OSSHttpResponseParser alloc] initForOperationType:OSSOperationTypePutObject];
-    
-    OSSAllRequestNeededMessage *neededMsg = [[OSSAllRequestNeededMessage alloc] init];
-    neededMsg.endpoint = self.endpoint;
-    neededMsg.httpMethod = OSSHTTPMethodDELETE;
-    neededMsg.bucketName = request.bucketName;
-    neededMsg.objectKey = request.objectKey;
-    requestDelegate.allNeededMessage = neededMsg;
-    
-    requestDelegate.operType = OSSOperationTypeDeleteObject;
-    
-    return [self invokeRequest:requestDelegate requireAuthentication:request.isAuthenticationRequired];
-}
-
-- (OSSTask *)deleteMultipleObjects:(OSSDeleteMultipleObjectsRequest *)request
-{
-    if ([request.keys count] == 0) {
-        NSError *error = [NSError errorWithDomain:OSSClientErrorDomain
-                                             code:OSSClientErrorCodeInvalidArgument
-                                         userInfo:@{OSSErrorMessageTOKEN: @"keys should not be empty"}];
-        return [OSSTask taskWithError:error];
-    }
-    
-    OSSNetworkingRequestDelegate * requestDelegate = request.requestDelegate;
-    requestDelegate.uploadingData = [OSSUtil constructHttpBodyForDeleteMultipleObjects:request.keys quiet:request.quiet];
-    requestDelegate.responseParser = [[OSSHttpResponseParser alloc] initForOperationType:OSSOperationTypeDeleteMultipleObjects];
-    NSString *md5String = [OSSUtil base64Md5ForData:requestDelegate.uploadingData];
-    
-    NSMutableDictionary *params = [NSMutableDictionary dictionary];
-    [params oss_setObject:@"" forKey:@"delete"];
-    [params oss_setObject:request.encodingType forKey:@"encoding-type"];
-    
-    OSSAllRequestNeededMessage *neededMsg = [[OSSAllRequestNeededMessage alloc] init];
-    neededMsg.endpoint = self.endpoint;
-    neededMsg.httpMethod = OSSHTTPMethodPOST;
-    neededMsg.bucketName = request.bucketName;
-    neededMsg.contentMd5 = md5String;
-    neededMsg.params = params;
-    requestDelegate.allNeededMessage = neededMsg;
-    
-    requestDelegate.operType = OSSOperationTypeDeleteMultipleObjects;
-    
-    return [self invokeRequest:requestDelegate requireAuthentication:request.isAuthenticationRequired];
-}
-
-- (OSSTask *)copyObject:(OSSCopyObjectRequest *)request {
-    NSString *copySourceHeader = nil;
-    if (request.sourceCopyFrom) {
-        copySourceHeader = request.sourceCopyFrom;
-    } else {
-        if (![request.sourceBucketName oss_isNotEmpty]) {
-            NSError *error = [NSError errorWithDomain:OSSClientErrorDomain code:OSSClientErrorCodeInvalidArgument userInfo:@{NSLocalizedDescriptionKey: @"sourceBucketName should not be empty!"}];
-            return [OSSTask taskWithError:error];
-        }
-        
-        if (![request.sourceObjectKey oss_isNotEmpty]) {
-            NSError *error = [NSError errorWithDomain:OSSClientErrorDomain code:OSSClientErrorCodeInvalidArgument userInfo:@{NSLocalizedDescriptionKey: @"sourceObjectKey should not be empty!"}];
-            return [OSSTask taskWithError:error];
-        }
-        
-        copySourceHeader = [NSString stringWithFormat:@"/%@/%@",request.bucketName, request.sourceObjectKey.oss_urlEncodedString];
-    }
-    
-    OSSNetworkingRequestDelegate * requestDelegate = request.requestDelegate;
-    NSMutableDictionary * headerParams = [NSMutableDictionary dictionaryWithDictionary:request.objectMeta];
-    [headerParams oss_setObject:copySourceHeader forKey:OSSHttpHeaderCopySource];
-    
-    requestDelegate.responseParser = [[OSSHttpResponseParser alloc] initForOperationType:OSSOperationTypeCopyObject];
-    
-    OSSAllRequestNeededMessage *neededMsg = [[OSSAllRequestNeededMessage alloc] init];
-    neededMsg.endpoint = self.endpoint;
-    neededMsg.httpMethod = OSSHTTPMethodPUT;
-    neededMsg.bucketName = request.bucketName;
-    neededMsg.objectKey = request.objectKey;
-    neededMsg.contentType = request.contentType;
-    neededMsg.contentMd5 = request.contentMd5;
-    neededMsg.headerParams = headerParams;
-    neededMsg.contentSHA1 = request.contentSHA1;
-    requestDelegate.allNeededMessage = neededMsg;
-    
-    requestDelegate.operType = OSSOperationTypeCopyObject;
-    
-    return [self invokeRequest:requestDelegate requireAuthentication:request.isAuthenticationRequired];
-}
-
-- (OSSTask *)putSymlink:(OSSPutSymlinkRequest *)request {
-    OSSNetworkingRequestDelegate * requestDelegate = request.requestDelegate;
-    
-    requestDelegate.responseParser = [[OSSHttpResponseParser alloc] initForOperationType:OSSOperationTypePutSymlink];
-    
-    NSMutableDictionary *headerFields = [NSMutableDictionary dictionary];
-    [headerFields oss_setObject:[request.targetObjectName oss_urlEncodedString] forKey:OSSHttpHeaderSymlinkTarget];
-    if (request.objectMeta) {
-        [headerFields addEntriesFromDictionary:request.objectMeta];
-    }
-    
-    OSSAllRequestNeededMessage *neededMsg = [[OSSAllRequestNeededMessage alloc] init];
-    neededMsg.endpoint = self.endpoint;
-    neededMsg.httpMethod = OSSHTTPMethodPUT;
-    neededMsg.bucketName = request.bucketName;
-    neededMsg.objectKey = request.objectKey;
-    neededMsg.params = request.requestParams;
-    neededMsg.headerParams = headerFields;
-    requestDelegate.allNeededMessage = neededMsg;
-    
-    requestDelegate.operType = OSSOperationTypePutSymlink;
-    
-    return [self invokeRequest:requestDelegate requireAuthentication:request.isAuthenticationRequired];
-}
-
-- (OSSTask *)getSymlink:(OSSGetSymlinkRequest *)request {
-    OSSNetworkingRequestDelegate * requestDelegate = request.requestDelegate;
-    requestDelegate.responseParser = [[OSSHttpResponseParser alloc] initForOperationType:OSSOperationTypeGetSymlink];
-    
-    OSSAllRequestNeededMessage *neededMsg = [[OSSAllRequestNeededMessage alloc] init];
-    neededMsg.endpoint = self.endpoint;
-    neededMsg.httpMethod = OSSHTTPMethodGET;
-    neededMsg.bucketName = request.bucketName;
-    neededMsg.objectKey = request.objectKey;
-    neededMsg.params = request.requestParams;
-    requestDelegate.allNeededMessage = neededMsg;
-    
-    requestDelegate.operType = OSSOperationTypeGetSymlink;
-    
-    return [self invokeRequest:requestDelegate requireAuthentication:request.isAuthenticationRequired];
-}
-
-- (OSSTask *)restoreObject:(OSSRestoreObjectRequest *)request {
-    OSSNetworkingRequestDelegate * requestDelegate = request.requestDelegate;
-    requestDelegate.responseParser = [[OSSHttpResponseParser alloc] initForOperationType:OSSOperationTypeRestoreObject];
-    
-    OSSAllRequestNeededMessage *neededMsg = [[OSSAllRequestNeededMessage alloc] init];
-    neededMsg.endpoint = self.endpoint;
-    neededMsg.httpMethod = OSSHTTPMethodPOST;
-    neededMsg.bucketName = request.bucketName;
-    neededMsg.objectKey = request.objectKey;
-    neededMsg.params = request.requestParams;
-    requestDelegate.allNeededMessage = neededMsg;
-    
-    requestDelegate.operType = OSSOperationTypeRestoreObject;
-    
-    return [self invokeRequest:requestDelegate requireAuthentication:request.isAuthenticationRequired];
-}
-
-@end
-
-@implementation OSSClient (MultipartUpload)
-
-- (OSSTask *)listMultipartUploads:(OSSListMultipartUploadsRequest *)request {
-    OSSNetworkingRequestDelegate * requestDelegate = request.requestDelegate;
-    
-    NSMutableDictionary *params = [[NSMutableDictionary alloc] initWithDictionary:[request requestParams]];
-    [params oss_setObject:@"" forKey:@"uploads"];
-    requestDelegate.responseParser = [[OSSHttpResponseParser alloc] initForOperationType:OSSOperationTypeListMultipartUploads];
-    
-    OSSAllRequestNeededMessage *neededMsg = [[OSSAllRequestNeededMessage alloc] init];
-    neededMsg.endpoint = self.endpoint;
-    neededMsg.httpMethod = OSSHTTPMethodGET;
-    neededMsg.bucketName = request.bucketName;
-    neededMsg.params = params;
-    requestDelegate.allNeededMessage = neededMsg;
-    
-    requestDelegate.operType = OSSOperationTypeListMultipartUploads;
-    
-    return [self invokeRequest:requestDelegate requireAuthentication:request.isAuthenticationRequired];
-}
-
-- (OSSTask *)multipartUploadInit:(OSSInitMultipartUploadRequest *)request {
-    OSSNetworkingRequestDelegate * requestDelegate = request.requestDelegate;
-    NSMutableDictionary * headerParams = [NSMutableDictionary dictionaryWithDictionary:request.objectMeta];
-    
-    [headerParams oss_setObject:request.contentDisposition forKey:OSSHttpHeaderContentDisposition];
-    [headerParams oss_setObject:request.contentEncoding forKey:OSSHttpHeaderContentEncoding];
-    [headerParams oss_setObject:request.expires forKey:OSSHttpHeaderExpires];
-    [headerParams oss_setObject:request.cacheControl forKey:OSSHttpHeaderCacheControl];
-    
-    NSMutableDictionary *params = [NSMutableDictionary dictionary];
-    [params oss_setObject:@"" forKey:@"uploads"];
-    if (request.sequential) {
-        [params oss_setObject:@"" forKey:@"sequential"];
-    }
-    requestDelegate.responseParser = [[OSSHttpResponseParser alloc] initForOperationType:OSSOperationTypeInitMultipartUpload];
-    
-    OSSAllRequestNeededMessage *neededMsg = [[OSSAllRequestNeededMessage alloc] init];
-    neededMsg.endpoint = self.endpoint;
-    neededMsg.httpMethod = OSSHTTPMethodPOST;
-    neededMsg.bucketName = request.bucketName;
-    neededMsg.objectKey = request.objectKey;
-    neededMsg.contentType = request.contentType;
-    neededMsg.params = params;
-    neededMsg.headerParams = headerParams;
-    requestDelegate.allNeededMessage = neededMsg;
-    
-    requestDelegate.operType = OSSOperationTypeInitMultipartUpload;
-    
-    return [self invokeRequest:requestDelegate requireAuthentication:request.isAuthenticationRequired];
-}
-
-- (OSSTask *)uploadPart:(OSSUploadPartRequest *)request {
-    OSSNetworkingRequestDelegate * requestDelegate = request.requestDelegate;
-    
-    NSMutableDictionary * params = [NSMutableDictionary dictionary];
-    [params oss_setObject:[@(request.partNumber) stringValue] forKey:@"partNumber"];
-    [params oss_setObject:request.uploadId forKey:@"uploadId"];
-    
-    [self enableCRC64WithFlag:request.crcFlag requestDelegate:requestDelegate];
-    if (request.uploadPartData) {
-        requestDelegate.uploadingData = request.uploadPartData;
-        if (requestDelegate.crc64Verifiable)
-        {
-            NSMutableData *mutableData = [NSMutableData dataWithData:request.uploadPartData];
-            requestDelegate.contentCRC = [NSString stringWithFormat:@"%llu",[mutableData oss_crc64]];
-        }
-    }
-    if (request.uploadPartFileURL) {
-        requestDelegate.uploadingFileURL = request.uploadPartFileURL;
-    }
-    if (request.uploadPartProgress) {
-        requestDelegate.uploadProgress = request.uploadPartProgress;
-    }
-    
-    OSSHttpResponseParser *responseParser = [[OSSHttpResponseParser alloc] initForOperationType:OSSOperationTypeUploadPart];
-    responseParser.crc64Verifiable = requestDelegate.crc64Verifiable;
-    requestDelegate.responseParser = responseParser;
-    
-    OSSAllRequestNeededMessage *neededMsg = [[OSSAllRequestNeededMessage alloc] init];
-    neededMsg.endpoint = self.endpoint;
-    neededMsg.httpMethod = OSSHTTPMethodPUT;
-    neededMsg.bucketName = request.bucketName;
-    neededMsg.objectKey = request.objectkey;
-    neededMsg.contentMd5 = request.contentMd5;
-    neededMsg.params = params;
-    neededMsg.contentSHA1 = request.contentSHA1;
-    requestDelegate.allNeededMessage = neededMsg;
-    
-    requestDelegate.operType = OSSOperationTypeUploadPart;
-    
-    return [self invokeRequest:requestDelegate requireAuthentication:request.isAuthenticationRequired];
-}
-
-- (OSSTask *)completeMultipartUpload:(OSSCompleteMultipartUploadRequest *)request
-{
-    OSSNetworkingRequestDelegate * requestDelegate = request.requestDelegate;
-    NSMutableDictionary * headerParams = [NSMutableDictionary dictionary];
-    if (request.partInfos) {
-        requestDelegate.uploadingData = [OSSUtil constructHttpBodyFromPartInfos:request.partInfos];
-    }
-    
-    [headerParams oss_setObject:[request.callbackParam base64JsonString] forKey:OSSHttpHeaderXOSSCallback];
-    [headerParams oss_setObject:[request.callbackVar base64JsonString] forKey:OSSHttpHeaderXOSSCallbackVar];
-    
-    if (request.completeMetaHeader) {
-        [headerParams addEntriesFromDictionary:request.completeMetaHeader];
-    }
-    NSMutableDictionary * params = [NSMutableDictionary dictionaryWithObjectsAndKeys:request.uploadId, @"uploadId", nil];
-    
-    OSSHttpResponseParser *responseParser = [[OSSHttpResponseParser alloc] initForOperationType:OSSOperationTypeCompleteMultipartUpload];
-    responseParser.crc64Verifiable = requestDelegate.crc64Verifiable;
-    requestDelegate.responseParser = responseParser;
-    
-    OSSAllRequestNeededMessage *neededMsg = [[OSSAllRequestNeededMessage alloc] init];
-    neededMsg.endpoint = self.endpoint;
-    neededMsg.httpMethod = OSSHTTPMethodPOST;
-    neededMsg.bucketName = request.bucketName;
-    neededMsg.objectKey = request.objectKey;
-    neededMsg.contentMd5 = request.contentMd5;
-    neededMsg.headerParams = headerParams;
-    neededMsg.params = params;
-    neededMsg.contentSHA1 = request.contentSHA1;
-    requestDelegate.allNeededMessage = neededMsg;
-    
-    requestDelegate.operType = OSSOperationTypeCompleteMultipartUpload;
-    
-    return [self invokeRequest:requestDelegate requireAuthentication:request.isAuthenticationRequired];
-}
-
-- (OSSTask *)listParts:(OSSListPartsRequest *)request {
-    OSSNetworkingRequestDelegate * requestDelegate = request.requestDelegate;
-    
-    NSMutableDictionary *params = [NSMutableDictionary dictionary];
-    [params oss_setObject: request.uploadId forKey: @"uploadId"];
-    [params oss_setObject: [NSString stringWithFormat:@"%d",request.partNumberMarker] forKey: @"part-number-marker"];
-    
-    requestDelegate.responseParser = [[OSSHttpResponseParser alloc] initForOperationType:OSSOperationTypeListMultipart];
-    
-    OSSAllRequestNeededMessage *neededMsg = [[OSSAllRequestNeededMessage alloc] init];
-    neededMsg.endpoint = self.endpoint;
-    neededMsg.httpMethod = OSSHTTPMethodGET;
-    neededMsg.bucketName = request.bucketName;
-    neededMsg.objectKey = request.objectKey;
-    neededMsg.params = params;
-    requestDelegate.allNeededMessage = neededMsg;
-    
-    requestDelegate.operType = OSSOperationTypeListMultipart;
-    
-    return [self invokeRequest:requestDelegate requireAuthentication:request.isAuthenticationRequired];
-}
-
-- (OSSTask *)abortMultipartUpload:(OSSAbortMultipartUploadRequest *)request {
-    OSSNetworkingRequestDelegate * requestDelegate = request.requestDelegate;
-    
-    NSMutableDictionary * params = [NSMutableDictionary dictionaryWithObjectsAndKeys:request.uploadId, @"uploadId", nil];
-    requestDelegate.responseParser = [[OSSHttpResponseParser alloc] initForOperationType:OSSOperationTypeAbortMultipartUpload];
-    
-    OSSAllRequestNeededMessage *neededMsg = [[OSSAllRequestNeededMessage alloc] init];
-    neededMsg.endpoint = self.endpoint;
-    neededMsg.httpMethod = OSSHTTPMethodDELETE;
-    neededMsg.bucketName = request.bucketName;
-    neededMsg.objectKey = request.objectKey;
-    neededMsg.params = params;
-    requestDelegate.allNeededMessage = neededMsg;
-    
-    requestDelegate.operType = OSSOperationTypeAbortMultipartUpload;
-    
-    return [self invokeRequest:requestDelegate requireAuthentication:request.isAuthenticationRequired];
-}
-
-- (OSSTask *)abortResumableMultipartUpload:(OSSResumableUploadRequest *)request
-{
-    return [self abortMultipartUpload:request sequential:NO resumable:YES];
-}
-
-- (OSSTask *)abortMultipartUpload:(OSSMultipartUploadRequest *)request sequential:(BOOL)sequential resumable:(BOOL)resumable {
-    
-    OSSTask *errorTask = nil;
-    if(resumable) {
-        OSSResumableUploadRequest *resumableRequest = (OSSResumableUploadRequest *)request;
-        NSString *nameInfoString = [NSString stringWithFormat:@"%@%@%@%lu",request.md5String, resumableRequest.bucketName, resumableRequest.objectKey, (unsigned long)resumableRequest.partSize];
-        if (sequential) {
-            nameInfoString = [nameInfoString stringByAppendingString:kClientRecordNameWithSequentialSuffix];
-        }
-        if (request.crcFlag == OSSRequestCRCOpen) {
-            nameInfoString = [nameInfoString stringByAppendingString:kClientRecordNameWithCRC64Suffix];
-        }
-        
-        NSData *data = [nameInfoString dataUsingEncoding:NSUTF8StringEncoding];
-        NSString *recordFileName = [OSSUtil dataMD5String:data];
-        NSString *recordFilePath = [NSString stringWithFormat:@"%@/%@",resumableRequest.recordDirectoryPath,recordFileName];
-        NSFileManager *fileManager = [NSFileManager defaultManager];
-        NSString *partInfosFilePath = [[[NSString oss_documentDirectory] stringByAppendingPathComponent:kClientRecordNameWithCommonPrefix] stringByAppendingPathComponent:resumableRequest.uploadId];
-        
-        if([fileManager fileExistsAtPath:recordFilePath])
-        {
-            NSError *error;
-            if (![fileManager removeItemAtPath:recordFilePath error:&error])
-            {
-                OSSLogDebug(@"[OSSSDKError]: %@", error);
-            }
-        }
-        
-        if ([fileManager fileExistsAtPath:partInfosFilePath]) {
-            NSError *error;
-            if (![fileManager removeItemAtPath:partInfosFilePath error:&error])
-            {
-                OSSLogDebug(@"[OSSSDKError]: %@", error);
-            }
-        }
-        
-        OSSAbortMultipartUploadRequest * abort = [OSSAbortMultipartUploadRequest new];
-        abort.bucketName = request.bucketName;
-        abort.objectKey = request.objectKey;
-        if (request.uploadId) {
-            abort.uploadId = request.uploadId;
-        } else {
-            abort.uploadId = [[NSString alloc] initWithData:[[NSFileHandle fileHandleForReadingAtPath:recordFilePath] readDataToEndOfFile] encoding:NSUTF8StringEncoding];
-        }
-        
-        errorTask = [self abortMultipartUpload:abort];
-    }else
-    {
-        OSSAbortMultipartUploadRequest * abort = [OSSAbortMultipartUploadRequest new];
-        abort.bucketName = request.bucketName;
-        abort.objectKey = request.objectKey;
-        abort.uploadId = request.uploadId;
-        errorTask = [self abortMultipartUpload:abort];
-    }
-    
-    return errorTask;
-}
-
-- (OSSTask *)multipartUpload:(OSSMultipartUploadRequest *)request {
-    return [self multipartUpload: request resumable: NO sequential: NO];
-}
-
-- (OSSTask *)processCompleteMultipartUpload:(OSSMultipartUploadRequest *)request partInfos:(NSArray<OSSPartInfo *> *)partInfos clientCrc64:(uint64_t)clientCrc64 recordFilePath:(NSString *)recordFilePath localPartInfosPath:(NSString *)localPartInfosPath
-{
-    OSSCompleteMultipartUploadRequest * complete = [OSSCompleteMultipartUploadRequest new];
-    complete.bucketName = request.bucketName;
-    complete.objectKey = request.objectKey;
-    complete.uploadId = request.uploadId;
-    complete.partInfos = partInfos;
-    complete.crcFlag = request.crcFlag;
-    complete.contentSHA1 = request.contentSHA1;
-    
-    if (request.completeMetaHeader != nil) {
-        complete.completeMetaHeader = request.completeMetaHeader;
-    }
-    if (request.callbackParam != nil) {
-        complete.callbackParam = request.callbackParam;
-    }
-    if (request.callbackVar != nil) {
-        complete.callbackVar = request.callbackVar;
-    }
-    
-    OSSTask * completeTask = [self completeMultipartUpload:complete];
-    [completeTask waitUntilFinished];
-    
-    if (completeTask.error) {
-        OSSLogVerbose(@"completeTask.error %@: ",completeTask.error);
-        return completeTask;
-    } else
-    {
-        if(recordFilePath && [[NSFileManager defaultManager] fileExistsAtPath:recordFilePath])
-        {
-            NSError *deleteError;
-            if (![[NSFileManager defaultManager] removeItemAtPath:recordFilePath error:&deleteError])
-            {
-                OSSLogError(@"delete localUploadIdPath failed!Error: %@",deleteError);
-            }
-        }
-        
-        if (localPartInfosPath && [[NSFileManager defaultManager] fileExistsAtPath:localPartInfosPath])
-        {
-            NSError *deleteError;
-            if (![[NSFileManager defaultManager] removeItemAtPath:localPartInfosPath error:&deleteError])
-            {
-                OSSLogError(@"delete localPartInfosPath failed!Error: %@",deleteError);
-            }
-        }
-        OSSCompleteMultipartUploadResult * completeResult = completeTask.result;
-        if (complete.crcFlag == OSSRequestCRCOpen && completeResult.remoteCRC64ecma)
-        {
-            uint64_t remote_crc64 = 0;
-            NSScanner *scanner = [NSScanner scannerWithString:completeResult.remoteCRC64ecma];
-            if ([scanner scanUnsignedLongLong:&remote_crc64])
-            {
-                OSSLogVerbose(@"resumableUpload local_crc64 %llu",clientCrc64);
-                OSSLogVerbose(@"resumableUpload remote_crc64 %llu", remote_crc64);
-                if (remote_crc64 != clientCrc64)
-                {
-                    NSString *errorMessage = [NSString stringWithFormat:@"local_crc64(%llu) is not equal to remote_crc64(%llu)!",clientCrc64,remote_crc64];
-                    NSError *error = [NSError errorWithDomain:OSSClientErrorDomain
-                                                         code:OSSClientErrorCodeInvalidCRC
-                                                     userInfo:@{OSSErrorMessageTOKEN:errorMessage}];
-                    return [OSSTask taskWithError:error];
-                }
-            }
-        }
-        
-        OSSResumableUploadResult * result = [OSSResumableUploadResult new];
-        result.requestId = completeResult.requestId;
-        result.httpResponseCode = completeResult.httpResponseCode;
-        result.httpResponseHeaderFields = completeResult.httpResponseHeaderFields;
-        result.serverReturnJsonString = completeResult.serverReturnJsonString;
-        result.remoteCRC64ecma = completeResult.remoteCRC64ecma;
-        
-        return [OSSTask taskWithResult:result];
-    }
-}
-
-
-- (OSSTask *)resumableUpload:(OSSResumableUploadRequest *)request
-{
-    return [self multipartUpload: request resumable: YES sequential: NO];
-}
-
-- (OSSTask *)processListPartsWithObjectKey:(nonnull NSString *)objectKey bucket:(nonnull NSString *)bucket uploadId:(NSString * _Nonnull *)uploadId uploadedParts:(nonnull NSMutableArray *)uploadedParts uploadedLength:(NSUInteger *)uploadedLength totalSize:(unsigned long long)totalSize partSize:(NSUInteger)partSize
-{
-    BOOL isTruncated = NO;
-    int nextPartNumberMarker = 0;
-    
-    do {
-        OSSListPartsRequest * listParts = [OSSListPartsRequest new];
-        listParts.bucketName = bucket;
-        listParts.objectKey = objectKey;
-        listParts.uploadId = *uploadId;
-        listParts.partNumberMarker = nextPartNumberMarker;
-        OSSTask * listPartsTask = [self listParts:listParts];
-        [listPartsTask waitUntilFinished];
-        
-        if (listPartsTask.error)
-        {
-            isTruncated = NO;
-            [uploadedParts removeAllObjects];
-            if ([listPartsTask.error.domain isEqualToString: OSSServerErrorDomain] && labs(listPartsTask.error.code) == 404)
-            {
-                OSSLogVerbose(@"local record existes but the remote record is deleted");
-                *uploadId = nil;
-            } else
-            {
-                return listPartsTask;
-            }
-        }
-        else
-        {
-            OSSListPartsResult *res = listPartsTask.result;
-            isTruncated = res.isTruncated;
-            nextPartNumberMarker = res.nextPartNumberMarker;
-            OSSLogVerbose(@"resumableUpload listpart ok");
-            if (res.parts.count > 0) {
-                [uploadedParts addObjectsFromArray:res.parts];
-            }
-        }
-    } while (isTruncated);
-    
-    __block NSUInteger firstPartSize = 0;
-    __block NSUInteger bUploadedLength = 0;
-    [uploadedParts enumerateObjectsUsingBlock:^(NSDictionary *part, NSUInteger idx, BOOL * _Nonnull stop) {
-        unsigned long long iPartSize = 0;
-        NSString *partSizeString = [part objectForKey:OSSSizeXMLTOKEN];
-        NSScanner *scanner = [NSScanner scannerWithString:partSizeString];
-        [scanner scanUnsignedLongLong:&iPartSize];
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wshorten-64-to-32"
-        bUploadedLength += iPartSize;
-        if (idx == 0)
-        {
-            firstPartSize = iPartSize;
-        }
-#pragma clang diagnostic pop
-    }];
-    *uploadedLength = bUploadedLength;
-    
-    if (totalSize < bUploadedLength)
-    {
-        NSError *error = [NSError errorWithDomain:OSSClientErrorDomain
-                                             code:OSSClientErrorCodeCannotResumeUpload
-                                         userInfo:@{OSSErrorMessageTOKEN: @"The uploading file is inconsistent with before"}];
-        return [OSSTask taskWithError: error];
-    }
-    else if (firstPartSize != 0 && firstPartSize != partSize && totalSize != firstPartSize)
-    {
-        NSError *error = [NSError errorWithDomain:OSSClientErrorDomain
-                                             code:OSSClientErrorCodeCannotResumeUpload
-                                         userInfo:@{OSSErrorMessageTOKEN: @"The part size setting is inconsistent with before"}];
-        return [OSSTask taskWithError: error];
-    }
-    return nil;
-}
-
-- (OSSTask *)processResumableInitMultipartUpload:(OSSInitMultipartUploadRequest *)request recordFilePath:(NSString *)recordFilePath
-{
-    OSSTask *task = [self multipartUploadInit:request];
-    [task waitUntilFinished];
-    
-    if(task.result && [recordFilePath oss_isNotEmpty])
-    {
-        OSSInitMultipartUploadResult *result = task.result;
-        if (![result.uploadId oss_isNotEmpty])
-        {
-            NSString *errorMessage = [NSString stringWithFormat:@"Can not get uploadId!"];
-            NSError *error = [NSError errorWithDomain:OSSServerErrorDomain
-                                                 code:OSSClientErrorCodeNilUploadid userInfo:@{OSSErrorMessageTOKEN:   errorMessage}];
-            return [OSSTask taskWithError:error];
-        }
-        
-        NSFileManager *defaultFM = [NSFileManager defaultManager];
-        if (![defaultFM fileExistsAtPath:recordFilePath])
-        {
-            if (![defaultFM createFileAtPath:recordFilePath contents:nil attributes:nil]) {
-                NSError *error = [NSError errorWithDomain:OSSClientErrorDomain
-                                                     code:OSSClientErrorCodeFileCantWrite
-                                                 userInfo:@{OSSErrorMessageTOKEN: @"uploadId for this task can't be stored persistentially!"}];
-                OSSLogDebug(@"[Error]: %@", error);
-                return [OSSTask taskWithError:error];
-            }
-        }
-        NSFileHandle * write = [NSFileHandle fileHandleForWritingAtPath:recordFilePath];
-        [write writeData:[result.uploadId dataUsingEncoding:NSUTF8StringEncoding]];
-        [write closeFile];
-    }
-    return task;
-}
-
-- (OSSTask *)upload:(OSSMultipartUploadRequest *)request
-        uploadIndex:(NSMutableArray *)alreadyUploadIndex
-         uploadPart:(NSMutableArray *)alreadyUploadPart
-              count:(NSUInteger)partCout
-     uploadedLength:(NSUInteger *)uploadedLength
-           fileSize:(unsigned long long)uploadFileSize
-{
-    NSOperationQueue *queue = [[NSOperationQueue alloc] init];
-    [queue setMaxConcurrentOperationCount: 5];
-    
-    NSObject *localLock = [[NSObject alloc] init];
-    
-    OSSRequestCRCFlag crcFlag = request.crcFlag;
-    __block OSSTask *errorTask;
-    __block NSMutableDictionary *localPartInfos = nil;
-    
-    if (crcFlag == OSSRequestCRCOpen) {
-        localPartInfos = [self localPartInfosDictoryWithUploadId:request.uploadId];
-    }
-    
-    if (!localPartInfos) {
-        localPartInfos = [NSMutableDictionary dictionary];
-    }
-    
-    NSError *readError;
-    NSFileHandle *fileHande = [NSFileHandle fileHandleForReadingFromURL:request.uploadingFileURL error:&readError];
-    if (readError) {
-        return [OSSTask taskWithError: readError];
-    }
-    
-    NSData * uploadPartData;
-    NSInteger realPartLength = request.partSize;
-    __block BOOL hasError = NO;
-    
-    for (NSUInteger idx = 1; idx <= partCout; idx++)
-    {
-        if (request.isCancelled)
-        {
-            [queue cancelAllOperations];
-            break;
-        }
-        
-        if ([alreadyUploadIndex containsObject:@(idx)])
-        {
-            continue;
-        }
-        
-        // while operationCount >= 5,the loop will stay here
-        while (queue.operationCount >= 5) {
-            [NSThread sleepForTimeInterval: 0.15f];
-        }
-        
-        if (idx == partCout) {
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wshorten-64-to-32"
-            realPartLength = uploadFileSize - request.partSize * (idx - 1);
-#pragma clang diagnostic pop
-        }
-        @autoreleasepool
-        {
-            [fileHande seekToFileOffset: request.partSize * (idx - 1)];
-            uploadPartData = [fileHande readDataOfLength:realPartLength];
-            
-            NSBlockOperation *operation = [NSBlockOperation blockOperationWithBlock:^{
-                OSSTask *uploadPartErrorTask = nil;
-                
-                [self executePartUpload:request
-               totalBytesExpectedToSend:uploadFileSize
-                         totalBytesSent:uploadedLength
-                                  index:idx
-                               partData:uploadPartData
-                      alreadyUploadPart:alreadyUploadPart
-                             localParts:localPartInfos
-                              errorTask:&uploadPartErrorTask];
-                
-                if (uploadPartErrorTask != nil) {
-                    @synchronized(localLock) {
-                        if (!hasError) {
-                            hasError = YES;
-                            errorTask = uploadPartErrorTask;
-                        }
-                    }
-                    uploadPartErrorTask = nil;
-                }
-            }];
-            [queue addOperation:operation];
-        }
-    }
-    [fileHande closeFile];
-    [queue waitUntilAllOperationsAreFinished];
-    
-    localLock = nil;
-    
-    if (!errorTask && request.isCancelled) {
-        errorTask = [OSSTask taskWithError:[OSSClient cancelError]];
-    }
-    
-    return errorTask;
-}
-
-- (void)executePartUpload:(OSSMultipartUploadRequest *)request totalBytesExpectedToSend:(unsigned long long)totalBytesExpectedToSend totalBytesSent:(NSUInteger *)totalBytesSent index:(NSUInteger)idx partData:(NSData *)partData alreadyUploadPart:(NSMutableArray *)uploadedParts localParts:(NSMutableDictionary *)localParts errorTask:(OSSTask **)errorTask
-{
-    NSUInteger bytesSent = partData.length;
-    
-    OSSUploadPartRequest * uploadPart = [OSSUploadPartRequest new];
-    uploadPart.bucketName = request.bucketName;
-    uploadPart.objectkey = request.objectKey;
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wshorten-64-to-32"
-    uploadPart.partNumber = idx;
-#pragma clang diagnostic pop
-    uploadPart.uploadId = request.uploadId;
-    uploadPart.uploadPartData = partData;
-    uploadPart.contentMd5 = [OSSUtil base64Md5ForData:partData];
-    uploadPart.crcFlag = request.crcFlag;
-    
-    OSSTask * uploadPartTask = [self uploadPart:uploadPart];
-    [uploadPartTask waitUntilFinished];
-    if (uploadPartTask.error) {
-        if (labs(uploadPartTask.error.code) != 409) {
-            *errorTask = uploadPartTask;
-        }
-    } else {
-        OSSUploadPartResult * result = uploadPartTask.result;
-        OSSPartInfo * partInfo = [OSSPartInfo new];
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wshorten-64-to-32"
-        partInfo.partNum = idx;
-#pragma clang diagnostic pop
-        partInfo.eTag = result.eTag;
-        partInfo.size = bytesSent;
-        uint64_t crc64OfPart;
-        @try {
-            NSScanner *scanner = [NSScanner scannerWithString:result.remoteCRC64ecma];
-            [scanner scanUnsignedLongLong:&crc64OfPart];
-            partInfo.crc64 = crc64OfPart;
-        } @catch (NSException *exception) {
-            OSSLogError(@"multipart upload error with nil remote crc64!");
-        }
-        
-        @synchronized(lock){
-            [uploadedParts addObject:partInfo];
-            
-            if (request.crcFlag == OSSRequestCRCOpen)
-            {
-                [self processForLocalPartInfos:localParts
-                                      partInfo:partInfo
-                                      uploadId:request.uploadId];
-                [self persistencePartInfos:localParts
-                              withUploadId:request.uploadId];
-            }
-            
-            *totalBytesSent += bytesSent;
-            if (request.uploadProgress)
-            {
-                request.uploadProgress(bytesSent, *totalBytesSent, totalBytesExpectedToSend);
-            }
-        }
-    }
-}
-
-- (void)processForLocalPartInfos:(NSMutableDictionary *)localPartInfoDict partInfo:(OSSPartInfo *)partInfo uploadId:(NSString *)uploadId
-{
-    NSDictionary *partInfoDict = [partInfo entityToDictionary];
-    NSString *keyString = [NSString stringWithFormat:@"%i",partInfo.partNum];
-    [localPartInfoDict oss_setObject:partInfoDict forKey:keyString];
-}
-
-- (OSSTask *)sequentialMultipartUpload:(OSSResumableUploadRequest *)request
-{
-    return [self multipartUpload:request resumable:YES sequential:YES];
-}
-
-- (OSSTask *)multipartUpload:(OSSMultipartUploadRequest *)request resumable:(BOOL)resumable sequential:(BOOL)sequential
-{
-    if (resumable) {
-        if (![request isKindOfClass:[OSSResumableUploadRequest class]]) {
-            NSError *typoError = [NSError errorWithDomain:OSSClientErrorDomain
-                                                     code:OSSClientErrorCodeInvalidArgument
-                                                 userInfo:@{OSSErrorMessageTOKEN: @"resumable multipart request should use instance of class OSSMultipartUploadRequest!"}];
-            return [OSSTask taskWithError: typoError];
-        }
-    }
-    
-    [self checkRequestCrc64Setting:request];
-    OSSTask *preTask = [self preChecksForRequest:request];
-    if (preTask) {
-        return preTask;
-    }
-    
-    return [[OSSTask taskWithResult:nil] continueWithExecutor:self.ossOperationExecutor withBlock:^id(OSSTask *task) {
-        
-        __block NSUInteger uploadedLength = 0;
-        uploadedLength = 0;
-        __block OSSTask * errorTask;
-        __block NSString *uploadId;
-        
-        NSError *error;
-        unsigned long long uploadFileSize = [self getSizeWithFilePath:request.uploadingFileURL.path error:&error];
-        if (error) {
-            return [OSSTask taskWithError:error];
-        }
-        
-        NSUInteger partCount = [self judgePartSizeForMultipartRequest:request fileSize:uploadFileSize];
-        
-        if (partCount > 1 && request.partSize < 102400) {
-            NSError *checkPartSizeError = [NSError errorWithDomain:OSSClientErrorDomain
-                                                 code:OSSClientErrorCodeInvalidArgument
-                                             userInfo:@{OSSErrorMessageTOKEN: @"Part size must be greater than equal to 100KB"}];
-            return [OSSTask taskWithError:checkPartSizeError];
-        }
-        
-        if (request.isCancelled) {
-            return [OSSTask taskWithError:[OSSClient cancelError]];
-        }
-        
-        NSString *recordFilePath = nil;
-        NSMutableArray * uploadedPart = [NSMutableArray array];
-        NSString *localPartInfosPath = nil;
-        NSDictionary *localPartInfos = nil;
-        
-        NSMutableArray<OSSPartInfo *> *uploadedPartInfos = [NSMutableArray array];
-        NSMutableArray * alreadyUploadIndex = [NSMutableArray array];
-        
-        if (resumable) {
-            OSSResumableUploadRequest *resumableRequest = (OSSResumableUploadRequest *)request;
-            NSString *recordDirectoryPath = resumableRequest.recordDirectoryPath;
-            request.md5String = [OSSUtil fileMD5String:request.uploadingFileURL.path];
-            if ([recordDirectoryPath oss_isNotEmpty])
-            {
-                uploadId = [self readUploadIdForRequest:resumableRequest recordFilePath:&recordFilePath sequential:sequential];
-                OSSLogVerbose(@"local uploadId: %@,recordFilePath: %@",uploadId, recordFilePath);
-            }
-            
-            if([uploadId oss_isNotEmpty])
-            {
-                localPartInfosPath = [[[NSString oss_documentDirectory] stringByAppendingPathComponent:kClientRecordNameWithCommonPrefix] stringByAppendingPathComponent:uploadId];
-                
-                localPartInfos = [[NSDictionary alloc] initWithContentsOfFile:localPartInfosPath];
-                
-                OSSTask *listPartTask = [self processListPartsWithObjectKey:request.objectKey
-                                                                     bucket:request.bucketName
-                                                                   uploadId:&uploadId
-                                                              uploadedParts:uploadedPart
-                                                             uploadedLength:&uploadedLength
-                                                                  totalSize:uploadFileSize
-                                                                   partSize:request.partSize];
-                if (listPartTask.error)
-                {
-                    return listPartTask;
-                }
-            }
-            
-            [uploadedPart enumerateObjectsUsingBlock:^(NSDictionary *partInfo, NSUInteger idx, BOOL * _Nonnull stop) {
-                unsigned long long remotePartNumber = 0;
-                NSString *partNumberString = [partInfo objectForKey: OSSPartNumberXMLTOKEN];
-                NSScanner *scanner = [NSScanner scannerWithString: partNumberString];
-                [scanner scanUnsignedLongLong: &remotePartNumber];
-                
-                NSString *remotePartEtag = [partInfo objectForKey:OSSETagXMLTOKEN];
-                
-                unsigned long long remotePartSize = 0;
-                NSString *partSizeString = [partInfo objectForKey:OSSSizeXMLTOKEN];
-                scanner = [NSScanner scannerWithString:partSizeString];
-                [scanner scanUnsignedLongLong:&remotePartSize];
-                
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wshorten-64-to-32"
-                
-                OSSPartInfo * info = [[OSSPartInfo alloc] init];
-                info.partNum = remotePartNumber;
-                info.size = remotePartSize;
-                info.eTag = remotePartEtag;
-                
-#pragma clang diagnostic pop
-            
-                NSDictionary *tPartInfo = [localPartInfos objectForKey: [@(remotePartNumber) stringValue]];
-                info.crc64 = [tPartInfo[@"crc64"] unsignedLongLongValue];
-                
-                [uploadedPartInfos addObject:info];
-                [alreadyUploadIndex addObject:@(remotePartNumber)];
-            }];
-            
-            if ([alreadyUploadIndex count] > 0 && request.uploadProgress && uploadFileSize) {
-                request.uploadProgress(0, uploadedLength, uploadFileSize);
-            }
-        }
-        
-        if (![uploadId oss_isNotEmpty]) {
-            OSSInitMultipartUploadRequest *initRequest = [OSSInitMultipartUploadRequest new];
-            initRequest.bucketName = request.bucketName;
-            initRequest.objectKey = request.objectKey;
-            initRequest.contentType = request.contentType;
-            initRequest.objectMeta = request.completeMetaHeader;
-            initRequest.sequential = sequential;
-            initRequest.crcFlag = request.crcFlag;
-            
-            OSSTask *task = [self processResumableInitMultipartUpload:initRequest
-                                                       recordFilePath:recordFilePath];
-            if (task.error)
-            {
-                return task;
-            }
-            OSSInitMultipartUploadResult *initResult = (OSSInitMultipartUploadResult *)task.result;
-            uploadId = initResult.uploadId;
-        }
-        
-        request.uploadId = uploadId;
-        localPartInfosPath = [[[NSString oss_documentDirectory] stringByAppendingPathComponent:kClientRecordNameWithCommonPrefix] stringByAppendingPathComponent:uploadId];
-        
-        if (request.isCancelled)
-        {
-            if(resumable)
-            {
-                OSSResumableUploadRequest *resumableRequest = (OSSResumableUploadRequest *)request;
-                if (resumableRequest.deleteUploadIdOnCancelling) {
-                    OSSTask *abortTask = [self abortMultipartUpload:request sequential:sequential resumable:resumable];
-                    [abortTask waitUntilFinished];
-                }
-            }
-            
-            return [OSSTask taskWithError:[OSSClient cancelError]];
-        }
-        
-        if (sequential) {
-            errorTask = [self sequentialUpload:request
-                                   uploadIndex:alreadyUploadIndex
-                                    uploadPart:uploadedPartInfos
-                                         count:partCount
-                                uploadedLength:&uploadedLength
-                                      fileSize:uploadFileSize];
-        } else {
-            errorTask = [self upload:request
-                         uploadIndex:alreadyUploadIndex
-                          uploadPart:uploadedPartInfos
-                               count:partCount
-                      uploadedLength:&uploadedLength
-                            fileSize:uploadFileSize];
-        }
-        
-        if(errorTask.error)
-        {
-            OSSTask *abortTask;
-            if(resumable)
-            {
-                OSSResumableUploadRequest *resumableRequest = (OSSResumableUploadRequest *)request;
-                if (resumableRequest.deleteUploadIdOnCancelling || errorTask.error.code == OSSClientErrorCodeFileCantWrite) {
-                    abortTask = [self abortMultipartUpload:request sequential:sequential resumable:resumable];
-                }
-            }else
-            {
-                abortTask =[self abortMultipartUpload:request sequential:sequential resumable:resumable];
-            }
-            [abortTask waitUntilFinished];
-            
-            return errorTask;
-        }
-        
-        [uploadedPartInfos sortUsingComparator:^NSComparisonResult(OSSPartInfo *part1,OSSPartInfo* part2) {
-            if(part1.partNum < part2.partNum){
-                return NSOrderedAscending;
-            }else if(part1.partNum > part2.partNum){
-                return NSOrderedDescending;
-            }else{
-                return NSOrderedSame;
-            }
-        }];
-        
-        // 如果开启了crc64的校验
-        uint64_t local_crc64 = 0;
-        if (request.crcFlag == OSSRequestCRCOpen)
-        {
-            for (NSUInteger index = 0; index< uploadedPartInfos.count; index++)
-            {
-                uint64_t partCrc64 = uploadedPartInfos[index].crc64;
-                int64_t partSize = uploadedPartInfos[index].size;
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wshorten-64-to-32"
-                local_crc64 = [OSSUtil crc64ForCombineCRC1:local_crc64 CRC2:partCrc64 length:partSize];
-#pragma clang diagnostic pop
-            }
-        }
-        return [self processCompleteMultipartUpload:request
-                                          partInfos:uploadedPartInfos
-                                        clientCrc64:local_crc64
-                                     recordFilePath:recordFilePath
-                                 localPartInfosPath:localPartInfosPath];
-    }];
-}
-
-- (OSSTask *)sequentialUpload:(OSSMultipartUploadRequest *)request
-                  uploadIndex:(NSMutableArray *)alreadyUploadIndex
-                   uploadPart:(NSMutableArray *)alreadyUploadPart
-                        count:(NSUInteger)partCout
-               uploadedLength:(NSUInteger *)uploadedLength
-                     fileSize:(unsigned long long)uploadFileSize
-{
-    OSSRequestCRCFlag crcFlag = request.crcFlag;
-    __block OSSTask *errorTask;
-    __block NSMutableDictionary *localPartInfos = nil;
-    
-    if (crcFlag == OSSRequestCRCOpen) {
-        localPartInfos = [self localPartInfosDictoryWithUploadId:request.uploadId];
-    }
-    
-    if (!localPartInfos) {
-        localPartInfos = [NSMutableDictionary dictionary];
-    }
-    
-    NSError *readError;
-    NSFileHandle *fileHande = [NSFileHandle fileHandleForReadingFromURL:request.uploadingFileURL error:&readError];
-    if (readError) {
-        return [OSSTask taskWithError: readError];
-    }
-    
-    NSUInteger realPartLength = request.partSize;
-    
-    for (int i = 1; i <= partCout; i++) {
-        if (errorTask) {
-            break;
-        }
-        
-        if (request.isCancelled) {
-            errorTask = [OSSTask taskWithError:[OSSClient cancelError]];
-            break;
-        }
-        
-        if ([alreadyUploadIndex containsObject:@(i)]) {
-            continue;
-        }
-        
-        realPartLength = request.partSize;
-        [fileHande seekToFileOffset:request.partSize * (i - 1)];
-        if (i == partCout) {
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wshorten-64-to-32"
-            realPartLength = uploadFileSize - request.partSize * (i - 1);
-#pragma clang diagnostic pop
-        }
-        NSData *uploadPartData = [fileHande readDataOfLength:realPartLength];
-        
-        @autoreleasepool {
-            OSSUploadPartRequest * uploadPart = [OSSUploadPartRequest new];
-            uploadPart.bucketName = request.bucketName;
-            uploadPart.objectkey = request.objectKey;
-            uploadPart.partNumber = i;
-            uploadPart.uploadId = request.uploadId;
-            uploadPart.uploadPartData = uploadPartData;
-            uploadPart.contentMd5 = [OSSUtil base64Md5ForData:uploadPartData];
-            uploadPart.crcFlag = request.crcFlag;
-            
-            OSSTask * uploadPartTask = [self uploadPart:uploadPart];
-            [uploadPartTask waitUntilFinished];
-            
-            if (uploadPartTask.error) {
-                if (labs(uploadPartTask.error.code) != 409) {
-                    errorTask = uploadPartTask;
-                    break;
-                } else {
-                    NSDictionary *partDict = uploadPartTask.error.userInfo;
-                    OSSPartInfo *partInfo = [[OSSPartInfo alloc] init];
-                    partInfo.eTag = partDict[@"PartEtag"];
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wshorten-64-to-32"
-                    partInfo.partNum = [(NSString *)partDict[@"PartNumber"] integerValue];
-                    partInfo.size = realPartLength;
-#pragma clang diagnostic push
-                    partInfo.crc64 = [[uploadPartData mutableCopy] oss_crc64];
-
-                    [alreadyUploadPart addObject:partInfo];
-                }
-            } else {
-                OSSUploadPartResult * result = uploadPartTask.result;
-                OSSPartInfo * partInfo = [OSSPartInfo new];
-                partInfo.partNum = i;
-                partInfo.eTag = result.eTag;
-                partInfo.size = realPartLength;
-                uint64_t crc64OfPart;
-                @try {
-                    NSScanner *scanner = [NSScanner scannerWithString:result.remoteCRC64ecma];
-                    [scanner scanUnsignedLongLong:&crc64OfPart];
-                    partInfo.crc64 = crc64OfPart;
-                } @catch (NSException *exception) {
-                    OSSLogError(@"multipart upload error with nil remote crc64!");
-                }
-                
-                [alreadyUploadPart addObject:partInfo];
-                if (crcFlag == OSSRequestCRCOpen)
-                {
-                    [self processForLocalPartInfos:localPartInfos
-                                          partInfo:partInfo
-                                          uploadId:request.uploadId];
-                    [self persistencePartInfos:localPartInfos
-                                  withUploadId:request.uploadId];
-                }
-                
-                @synchronized(lock) {
-                    *uploadedLength += realPartLength;
-                    if (request.uploadProgress)
-                    {
-                        request.uploadProgress(realPartLength, *uploadedLength, uploadFileSize);
-                    }
-                }
-            }
-        }
-    }
-    [fileHande closeFile];
-    
-    return errorTask;
-}
-
-@end
-
-@implementation OSSClient (PresignURL)
-
-- (OSSTask *)presignConstrainURLWithBucketName:(NSString *)bucketName
-                                 withObjectKey:(NSString *)objectKey
-                        withExpirationInterval:(NSTimeInterval)interval {
-    
-    return [self presignConstrainURLWithBucketName:bucketName
-                                     withObjectKey:objectKey
-                            withExpirationInterval:interval
-                                    withParameters:@{}];
-}
-
-- (OSSTask *)presignConstrainURLWithBucketName:(NSString *)bucketName
-                                 withObjectKey:(NSString *)objectKey
-                        withExpirationInterval:(NSTimeInterval)interval
-                                withParameters:(NSDictionary *)parameters {
-    
-    return [self presignConstrainURLWithBucketName: bucketName
-                                     withObjectKey: objectKey
-                                        httpMethod: @"GET"
-                            withExpirationInterval: interval
-                                    withParameters: parameters];
-}
-
-- (OSSTask *)presignConstrainURLWithBucketName:(NSString *)bucketName
-                                 withObjectKey:(NSString *)objectKey
-                                    httpMethod:(NSString *)method
-                        withExpirationInterval:(NSTimeInterval)interval
-                                withParameters:(NSDictionary *)parameters
-{
-    return [[OSSTask taskWithResult:nil] continueWithBlock:^id(OSSTask *task) {
-        NSString * resource = [NSString stringWithFormat:@"/%@/%@", bucketName, objectKey];
-        NSString * expires = [@((int64_t)[[NSDate oss_clockSkewFixedDate] timeIntervalSince1970] + interval) stringValue];
-        
-        NSMutableDictionary * params = [NSMutableDictionary dictionary];
-        if (parameters.count > 0) {
-            [params addEntriesFromDictionary:parameters];
-        }
-        
-        NSString * wholeSign = nil;
-        OSSFederationToken *token = nil;
-        NSError *error = nil;
-        
-        if ([self.credentialProvider isKindOfClass:[OSSFederationCredentialProvider class]]) {
-            token = [(OSSFederationCredentialProvider *)self.credentialProvider getToken:&error];
-            if (error) {
-                return [OSSTask taskWithError:error];
-            }
-        } else if ([self.credentialProvider isKindOfClass:[OSSStsTokenCredentialProvider class]]) {
-            token = [(OSSStsTokenCredentialProvider *)self.credentialProvider getToken];
-        }
-        
-        if ([self.credentialProvider isKindOfClass:[OSSFederationCredentialProvider class]]
-            || [self.credentialProvider isKindOfClass:[OSSStsTokenCredentialProvider class]])
-        {
-            [params oss_setObject:token.tToken forKey:@"security-token"];
-            resource = [NSString stringWithFormat:@"%@?%@", resource, [OSSUtil populateSubresourceStringFromParameter:params]];
-            NSString * string2sign = [NSString stringWithFormat:@"%@\n\n\n%@\n%@", method, expires, resource];
-            wholeSign = [OSSUtil sign:string2sign withToken:token];
-        } else {
-            NSString * subresource = [OSSUtil populateSubresourceStringFromParameter:params];
-            if ([subresource length] > 0) {
-                resource = [NSString stringWithFormat:@"%@?%@", resource, [OSSUtil populateSubresourceStringFromParameter:params]];
-            }
-            NSString * string2sign = [NSString stringWithFormat:@"%@\n\n\n%@\n%@",  method, expires, resource];
-            wholeSign = [self.credentialProvider sign:string2sign error:&error];
-            if (error) {
-                return [OSSTask taskWithError:error];
-            }
-        }
-        
-        NSArray * splitResult = [wholeSign componentsSeparatedByString:@":"];
-        if ([splitResult count] != 2
-            || ![((NSString *)[splitResult objectAtIndex:0]) hasPrefix:@"OSS "]) {
-            return [OSSTask taskWithError:[NSError errorWithDomain:OSSClientErrorDomain
-                                                              code:OSSClientErrorCodeSignFailed
-                                                          userInfo:@{OSSErrorMessageTOKEN: @"the returned signature is invalid"}]];
-        }
-        NSString * accessKey = [(NSString *)[splitResult objectAtIndex:0] substringFromIndex:4];
-        NSString * signature = [splitResult objectAtIndex:1];
-        
-        NSURL * endpointURL = [NSURL URLWithString:self.endpoint];
-        NSString * host = endpointURL.host;
-        if ([OSSUtil isOssOriginBucketHost:host]) {
-            host = [NSString stringWithFormat:@"%@.%@", bucketName, host];
-        }
-        
-        [params oss_setObject:signature forKey:@"Signature"];
-        [params oss_setObject:accessKey forKey:@"OSSAccessKeyId"];
-        [params oss_setObject:expires forKey:@"Expires"];
-        NSString * stringURL = [NSString stringWithFormat:@"%@://%@/%@?%@",
-                                endpointURL.scheme,
-                                host,
-                                [OSSUtil encodeURL:objectKey],
-                                [OSSUtil populateQueryStringFromParameter:params]];
-        return [OSSTask taskWithResult:stringURL];
-    }];
-}
-
-- (OSSTask *)presignPublicURLWithBucketName:(NSString *)bucketName
-                              withObjectKey:(NSString *)objectKey {
-    
-    return [self presignPublicURLWithBucketName:bucketName
-                                  withObjectKey:objectKey
-                                 withParameters:@{}];
-}
-
-- (OSSTask *)presignPublicURLWithBucketName:(NSString *)bucketName
-                              withObjectKey:(NSString *)objectKey
-                             withParameters:(NSDictionary *)parameters {
-    
-    return [[OSSTask taskWithResult:nil] continueWithBlock:^id(OSSTask *task) {
-        NSURL * endpointURL = [NSURL URLWithString:self.endpoint];
-        NSString * host = endpointURL.host;
-        if ([OSSUtil isOssOriginBucketHost:host]) {
-            host = [NSString stringWithFormat:@"%@.%@", bucketName, host];
-        }
-        if ([parameters count] > 0) {
-            NSString * stringURL = [NSString stringWithFormat:@"%@://%@/%@?%@",
-                                    endpointURL.scheme,
-                                    host,
-                                    [OSSUtil encodeURL:objectKey],
-                                    [OSSUtil populateQueryStringFromParameter:parameters]];
-            return [OSSTask taskWithResult:stringURL];
-        } else {
-            NSString * stringURL = [NSString stringWithFormat:@"%@://%@/%@",
-                                    endpointURL.scheme,
-                                    host,
-                                    [OSSUtil encodeURL:objectKey]];
-            return [OSSTask taskWithResult:stringURL];
-        }
-    }];
-}
-
-@end
-
-@implementation OSSClient (Utilities)
-
-- (BOOL)doesObjectExistInBucket:(NSString *)bucketName
-                      objectKey:(NSString *)objectKey
-                          error:(const NSError **)error {
-    
-    OSSHeadObjectRequest * headRequest = [OSSHeadObjectRequest new];
-    headRequest.bucketName = bucketName;
-    headRequest.objectKey = objectKey;
-    OSSTask * headTask = [self headObject:headRequest];
-    [headTask waitUntilFinished];
-    NSError *headError = headTask.error;
-    if (!headError) {
-        return YES;
-    } else {
-        if ([headError.domain isEqualToString: OSSServerErrorDomain] && labs(headError.code) == 404) {
-            return NO;
-        } else {
-            if (error != nil) {
-                *error = headError;
-            }
-            return NO;
-        }
-    }
-}
-
-@end
-
-@implementation OSSClient (ImageService)
-
-- (OSSTask *)imageActionPersist:(OSSImagePersistRequest *)request
-{
-    if (![request.fromBucket oss_isNotEmpty]
-        || ![request.fromObject oss_isNotEmpty]
-        || ![request.toBucket oss_isNotEmpty]
-        || ![request.toObject oss_isNotEmpty]
-        || ![request.action oss_isNotEmpty]) {
-        NSError *error = [NSError errorWithDomain:OSSTaskErrorDomain
-                                             code:OSSClientErrorCodeInvalidArgument
-                                         userInfo:@{OSSErrorMessageTOKEN: @"imagePersist parameters not be empty!"}];
-        return [OSSTask taskWithError:error];
-    }
-    
-    OSSNetworkingRequestDelegate *requestDelegate = request.requestDelegate;
-    NSMutableDictionary *params = [NSMutableDictionary dictionary];
-    [params oss_setObject:@"" forKey:OSSHttpQueryProcess];
-    
-    requestDelegate.uploadingData = [OSSUtil constructHttpBodyForImagePersist:request.action toBucket:request.toBucket toObjectKey:request.toObject];
-    
-    OSSHttpResponseParser *responseParser = [[OSSHttpResponseParser alloc] initForOperationType:OSSOperationTypeImagePersist];
-    requestDelegate.responseParser = responseParser;
-    
-    OSSAllRequestNeededMessage *neededMsg = [[OSSAllRequestNeededMessage alloc] init];
-    neededMsg.endpoint = self.endpoint;
-    neededMsg.httpMethod = OSSHTTPMethodPOST;
-    neededMsg.bucketName = request.fromBucket;
-    neededMsg.objectKey = request.fromObject;
-    neededMsg.params = params;
-    requestDelegate.allNeededMessage = neededMsg;
-    
-    requestDelegate.operType = OSSOperationTypeImagePersist;
-    
-    return [self invokeRequest:requestDelegate requireAuthentication:request.isAuthenticationRequired];
-}
-
-@end
-
-@implementation OSSClient (Callback)
-
-- (OSSTask *)triggerCallBack:(OSSCallBackRequest *)request
-{
-    OSSNetworkingRequestDelegate *requestDelegate = request.requestDelegate;
-    NSMutableDictionary *params = [NSMutableDictionary dictionary];
-    [params oss_setObject:@"" forKey:OSSHttpQueryProcess];
-    NSString *paramString = [request.callbackParam base64JsonString];
-    NSString *variblesString = [request.callbackVar base64JsonString];
-    requestDelegate.uploadingData = [OSSUtil constructHttpBodyForTriggerCallback:paramString callbackVaribles:variblesString];
-    NSString *md5String = [OSSUtil base64Md5ForData:requestDelegate.uploadingData];
-    
-    OSSHttpResponseParser *responseParser = [[OSSHttpResponseParser alloc] initForOperationType:OSSOperationTypeTriggerCallBack];
-    requestDelegate.responseParser = responseParser;
-    
-    OSSAllRequestNeededMessage *neededMsg = [[OSSAllRequestNeededMessage alloc] init];
-    neededMsg.endpoint = self.endpoint;
-    neededMsg.httpMethod = OSSHTTPMethodPOST;
-    neededMsg.bucketName = request.bucketName;
-    neededMsg.objectKey = request.objectName;
-    neededMsg.contentMd5 = md5String;
-    neededMsg.params = params;
-    requestDelegate.allNeededMessage = neededMsg;
-    
-    requestDelegate.operType = OSSOperationTypeTriggerCallBack;
-    
-    return [self invokeRequest:requestDelegate requireAuthentication:request.isAuthenticationRequired];
-}
-
-@end

+ 0 - 85
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSCompat.h

@@ -1,85 +0,0 @@
-//
-//  OSSCompat.h
-//  oss_ios_sdk_new
-//
-//  Created by zhouzhuo on 9/10/15.
-//  Copyright (c) 2015 aliyun.com. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-#import "OSSService.h"
-
-@class OSSCancellationTokenSource;
-
-typedef OSSCancellationTokenSource OSSTaskHandler;
-
-NS_ASSUME_NONNULL_BEGIN
-
-@interface OSSClient (Compat)
-
-/**
- The old version's upload API.
- Please use putObject instead.
- */
-- (OSSTaskHandler *)uploadData:(NSData *)data
-               withContentType:(NSString *)contentType
-                withObjectMeta:(NSDictionary *)meta
-                  toBucketName:(NSString *)bucketName
-                   toObjectKey:(NSString *)objectKey
-                   onCompleted:(void(^)(BOOL, NSError *))onCompleted
-                    onProgress:(void(^)(float progress))onProgress;
-
-/**
- The old version's download API.
- Please use getObject instead.
- */
-- (OSSTaskHandler *)downloadToDataFromBucket:(NSString *)bucketName
-                   objectKey:(NSString *)objectKey
-                 onCompleted:(void(^)(NSData *, NSError *))onCompleted
-                  onProgress:(void(^)(float progress))onProgress;
-
-/**
- The old version's upload API.
- Please use putObject instead.
- */
-- (OSSTaskHandler *)uploadFile:(NSString *)filePath
-                withContentType:(NSString *)contentType
-                 withObjectMeta:(NSDictionary *)meta
-                   toBucketName:(NSString *)bucketName
-                    toObjectKey:(NSString *)objectKey
-                    onCompleted:(void(^)(BOOL, NSError *))onCompleted
-                     onProgress:(void(^)(float progress))onProgress;
-
-/**
- The old version's download API.
- Please use getObject instead.
- */
-- (OSSTaskHandler *)downloadToFileFromBucket:(NSString *)bucketName
-                  objectKey:(NSString *)objectKey
-                     toFile:(NSString *)filePath
-                onCompleted:(void(^)(BOOL, NSError *))onCompleted
-                 onProgress:(void(^)(float progress))onProgress;
-
-
-/**
- The old version's upload API with resumable upload support.
- Please use resumableUpload instead.
- */
-- (OSSTaskHandler *)resumableUploadFile:(NSString *)filePath
-          withContentType:(NSString *)contentType
-           withObjectMeta:(NSDictionary *)meta
-             toBucketName:(NSString *)bucketName
-              toObjectKey:(NSString *)objectKey
-              onCompleted:(void(^)(BOOL, NSError *))onCompleted
-               onProgress:(void(^)(float progress))onProgress;
-
-/**
- The old version's delete API.
- Please use deleteObject instead.
- */
-- (void)deleteObjectInBucket:(NSString *)bucketName
-                   objectKey:(NSString *)objectKey
-                 onCompleted:(void(^)(BOOL, NSError *))onCompleted;
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 260
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSCompat.m

@@ -1,260 +0,0 @@
-//
-//  OSSCompat.m
-//  oss_ios_sdk_new
-//
-//  Created by zhouzhuo on 9/10/15.
-//  Copyright (c) 2015 aliyun.com. All rights reserved.
-//
-
-#import "OSSDefine.h"
-#import "OSSCompat.h"
-#import "OSSBolts.h"
-#import "OSSModel.h"
-
-@implementation OSSClient (Compat)
-
-- (OSSTaskHandler *)uploadData:(NSData *)data
-               withContentType:(NSString *)contentType
-                withObjectMeta:(NSDictionary *)meta
-                  toBucketName:(NSString *)bucketName
-                   toObjectKey:(NSString *)objectKey
-                   onCompleted:(void(^)(BOOL, NSError *))onCompleted
-                    onProgress:(void(^)(float progress))onProgress {
-
-    OSSTaskHandler * bcts = [OSSCancellationTokenSource cancellationTokenSource];
-
-    [[[OSSTask taskWithResult:nil] continueWithExecutor:self.ossOperationExecutor withSuccessBlock:^id(OSSTask *task) {
-        OSSPutObjectRequest * put = [OSSPutObjectRequest new];
-        put.bucketName = bucketName;
-        put.objectKey = objectKey;
-        put.objectMeta = meta;
-        put.uploadingData = data;
-        put.contentType = contentType;
-
-        put.uploadProgress = ^(int64_t bytesSent, int64_t totalBytesSent, int64_t totalBytesExpectedToSend) {
-            if (totalBytesExpectedToSend) {
-                onProgress((float)totalBytesSent / totalBytesExpectedToSend);
-            }
-        };
-
-        [bcts.token registerCancellationObserverWithBlock:^{
-            [put cancel];
-        }];
-
-        OSSTask * putTask = [self putObject:put];
-        [putTask waitUntilFinished];
-        onProgress(1.0f);
-        return putTask;
-    }] continueWithBlock:^id(OSSTask *task) {
-        if (task.error) {
-            onCompleted(NO, task.error);
-        } else {
-            onCompleted(YES, nil);
-        }
-        return nil;
-    }];
-    return bcts;
-}
-
-- (OSSTaskHandler *)downloadToDataFromBucket:(NSString *)bucketName
-                                 objectKey:(NSString *)objectKey
-                               onCompleted:(void (^)(NSData *, NSError *))onCompleted
-                                onProgress:(void (^)(float))onProgress {
-
-    OSSTaskHandler * bcts = [OSSCancellationTokenSource cancellationTokenSource];
-
-    [[[OSSTask taskWithResult:nil] continueWithExecutor:self.ossOperationExecutor withBlock:^id(OSSTask *task) {
-        OSSGetObjectRequest * get = [OSSGetObjectRequest new];
-        get.bucketName = bucketName;
-        get.objectKey = objectKey;
-
-        get.downloadProgress = ^(int64_t bytesWritten, int64_t totalBytesWritten, int64_t totalBytesExpectedToWrite) {
-            if (totalBytesExpectedToWrite) {
-                onProgress((float)totalBytesWritten / totalBytesExpectedToWrite);
-            }
-        };
-
-        [bcts.token registerCancellationObserverWithBlock:^{
-            [get cancel];
-        }];
-
-        OSSTask * getTask = [self getObject:get];
-        [getTask waitUntilFinished];
-        onProgress(1.0f);
-        return getTask;
-    }] continueWithBlock:^id(OSSTask *task) {
-        if (task.error) {
-            onCompleted(nil, task.error);
-        } else {
-            OSSGetObjectResult * result = task.result;
-            onCompleted(result.downloadedData, nil);
-        }
-        return nil;
-    }];
-
-    return bcts;
-}
-
-- (OSSTaskHandler *)downloadToFileFromBucket:(NSString *)bucketName
-                                 objectKey:(NSString *)objectKey
-                                    toFile:(NSString *)filePath
-                               onCompleted:(void (^)(BOOL, NSError *))onCompleted
-                                onProgress:(void (^)(float))onProgress {
-
-    OSSTaskHandler * bcts = [OSSCancellationTokenSource cancellationTokenSource];
-
-    [[[OSSTask taskWithResult:nil] continueWithExecutor:self.ossOperationExecutor withBlock:^id(OSSTask *task) {
-        OSSGetObjectRequest * get = [OSSGetObjectRequest new];
-        get.bucketName = bucketName;
-        get.objectKey = objectKey;
-        get.downloadToFileURL = [NSURL fileURLWithPath:filePath];
-
-        get.downloadProgress = ^(int64_t bytesWritten, int64_t totalBytesWritten, int64_t totalBytesExpectedToWrite) {
-            if (totalBytesExpectedToWrite) {
-                onProgress((float)totalBytesWritten / totalBytesExpectedToWrite);
-            }
-        };
-
-        [bcts.token registerCancellationObserverWithBlock:^{
-            [get cancel];
-        }];
-
-        OSSTask * getTask = [self getObject:get];
-        [getTask waitUntilFinished];
-        onProgress(1.0f);
-        return getTask;
-    }] continueWithBlock:^id(OSSTask *task) {
-        if (task.error) {
-            onCompleted(NO, task.error);
-        } else {
-            onCompleted(YES, nil);
-        }
-        return nil;
-    }];
-    
-    return bcts;
-}
-
-- (void)deleteObjectInBucket:(NSString *)bucketName
-                   objectKey:(NSString *)objectKey
-                 onCompleted:(void (^)(BOOL, NSError *))onCompleted {
-
-    [[[OSSTask taskWithResult:nil] continueWithExecutor:self.ossOperationExecutor withBlock:^id(OSSTask *task) {
-        OSSDeleteObjectRequest * delete = [OSSDeleteObjectRequest new];
-        delete.bucketName = bucketName;
-        delete.objectKey = objectKey;
-
-        OSSTask * deleteTask = [self deleteObject:delete];
-        [deleteTask waitUntilFinished];
-        return deleteTask;
-    }] continueWithBlock:^id(OSSTask *task) {
-        if (task.error) {
-            onCompleted(NO, task.error);
-        } else {
-            onCompleted(YES, nil);
-        }
-        return nil;
-    }];
-}
-
-- (OSSTaskHandler *)uploadFile:(NSString *)filePath
-               withContentType:(NSString *)contentType
-                withObjectMeta:(NSDictionary *)meta
-                  toBucketName:(NSString *)bucketName
-                   toObjectKey:(NSString *)objectKey
-                   onCompleted:(void (^)(BOOL, NSError *))onCompleted
-                    onProgress:(void (^)(float))onProgress {
-
-    OSSTaskHandler * bcts = [OSSCancellationTokenSource cancellationTokenSource];
-
-    [[[OSSTask taskWithResult:nil] continueWithExecutor:self.ossOperationExecutor withSuccessBlock:^id(OSSTask *task) {
-        OSSPutObjectRequest * put = [OSSPutObjectRequest new];
-        put.bucketName = bucketName;
-        put.objectKey = objectKey;
-        put.objectMeta = meta;
-        put.uploadingFileURL = [NSURL fileURLWithPath:filePath];
-        put.contentType = contentType;
-
-        put.uploadProgress = ^(int64_t bytesSent, int64_t totalBytesSent, int64_t totalBytesExpectedToSend) {
-            if (totalBytesExpectedToSend) {
-                onProgress((float)totalBytesSent / totalBytesExpectedToSend);
-            }
-        };
-
-        [bcts.token registerCancellationObserverWithBlock:^{
-            [put cancel];
-        }];
-
-        OSSTask * putTask = [self putObject:put];
-        [putTask waitUntilFinished];
-        onProgress(1.0f);
-        return putTask;
-    }] continueWithBlock:^id(OSSTask *task) {
-        if (task.error) {
-            onCompleted(NO, task.error);
-        } else {
-            onCompleted(YES, nil);
-        }
-        return nil;
-    }];
-    return bcts;
-}
-
-- (OSSTaskHandler *)resumableUploadFile:(NSString *)filePath
-                        withContentType:(NSString *)contentType
-                         withObjectMeta:(NSDictionary *)meta
-                           toBucketName:(NSString *)bucketName
-                            toObjectKey:(NSString *)objectKey
-                            onCompleted:(void(^)(BOOL, NSError *))onComplete
-                             onProgress:(void(^)(float progress))onProgress {
-
-    OSSTaskHandler * bcts = [OSSCancellationTokenSource cancellationTokenSource];
-
-    [[[OSSTask taskWithResult:nil] continueWithBlock:^id(OSSTask *task) {
-        NSURL * fileURL = [NSURL fileURLWithPath:filePath];
-        NSDate * lastModified;
-        NSError * error;
-        [fileURL getResourceValue:&lastModified forKey:NSURLContentModificationDateKey error:&error];
-        if (error) {
-            return [OSSTask taskWithError:error];
-        }
-        OSSResumableUploadRequest * resumableUpload = [OSSResumableUploadRequest new];
-        resumableUpload.bucketName = bucketName;
-        resumableUpload.deleteUploadIdOnCancelling = NO;//cancel not delete record file
-        resumableUpload.contentType = contentType;
-        resumableUpload.completeMetaHeader = meta;
-        NSString *cachesDir = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) firstObject];
-        resumableUpload.recordDirectoryPath = cachesDir; //default record file path
-        resumableUpload.uploadingFileURL = fileURL;
-        resumableUpload.objectKey = objectKey;
-        resumableUpload.uploadId = task.result;
-        resumableUpload.uploadingFileURL = [NSURL fileURLWithPath:filePath];
-        __weak OSSResumableUploadRequest * weakRef = resumableUpload;
-        resumableUpload.uploadProgress = ^(int64_t bytesSent, int64_t totalBytesSent, int64_t totalBytesExpectedToSend) {
-            onProgress((float)totalBytesSent/totalBytesExpectedToSend);
-            if (bcts.token.isCancellationRequested || bcts.isCancellationRequested) {
-                [weakRef cancel];
-            }
-            OSSLogDebugNoFile(@"%lld %lld %lld", bytesSent, totalBytesSent, totalBytesExpectedToSend);
-        };
-        return [self resumableUpload:resumableUpload];
-    }] continueWithBlock:^id(OSSTask *task) {
-        if (task.cancelled) {
-            onComplete(NO, [NSError errorWithDomain:OSSClientErrorDomain
-                                               code:OSSClientErrorCodeTaskCancelled
-                                           userInfo:@{OSSErrorMessageTOKEN: @"This task is cancelled"}]);
-        } else if (task.error) {
-            onComplete(NO, task.error);
-        } else if (task.faulted) {
-            onComplete(NO, [NSError errorWithDomain:OSSClientErrorDomain
-                                               code:OSSClientErrorCodeExcpetionCatched
-                                           userInfo:@{OSSErrorMessageTOKEN: [NSString stringWithFormat:@"Catch exception - %@", task.exception]}]);
-        } else {
-            onComplete(YES, nil);
-        }
-        return nil;
-    }];
-    return bcts;
-}
-
-@end

+ 0 - 129
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSConstants.h

@@ -1,129 +0,0 @@
-//
-//  OSSConstants.h
-//  AliyunOSSSDK
-//
-//  Created by huaixu on 2018/1/22.
-//  Copyright © 2018年 aliyun. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-
-NS_ASSUME_NONNULL_BEGIN
-
-typedef NSString* _Nullable (^OSSCustomSignContentBlock) (NSString * contentToSign, NSError **error);
-typedef NSData * _Nullable (^OSSResponseDecoderBlock) (NSData * data);
-
-typedef void (^OSSNetworkingUploadProgressBlock) (int64_t bytesSent, int64_t totalBytesSent, int64_t totalBytesExpectedToSend);
-typedef void (^OSSNetworkingDownloadProgressBlock) (int64_t bytesWritten, int64_t totalBytesWritten, int64_t totalBytesExpectedToWrite);
-typedef void (^OSSNetworkingRetryBlock) (void);
-typedef void (^OSSNetworkingCompletionHandlerBlock) (id _Nullable responseObject, NSError * _Nullable error);
-typedef void (^OSSNetworkingOnRecieveDataBlock) (NSData * data);
-
-/**
- The flag of verification about crc64
- */
-typedef NS_ENUM(NSUInteger, OSSRequestCRCFlag) {
-    OSSRequestCRCUninitialized,
-    OSSRequestCRCOpen,
-    OSSRequestCRCClosed
-};
-
-/**
- Retry type definition
- */
-typedef NS_ENUM(NSInteger, OSSNetworkingRetryType) {
-    OSSNetworkingRetryTypeUnknown,
-    OSSNetworkingRetryTypeShouldRetry,
-    OSSNetworkingRetryTypeShouldNotRetry,
-    OSSNetworkingRetryTypeShouldRefreshCredentialsAndRetry,
-    OSSNetworkingRetryTypeShouldCorrectClockSkewAndRetry
-};
-
-/**
- * @brief: The following constants are provided by OSSNetworking as possible operation types.
- */
-typedef NS_ENUM(NSInteger, OSSOperationType) {
-    OSSOperationTypeGetService,
-    OSSOperationTypeCreateBucket,
-    OSSOperationTypeDeleteBucket,
-    OSSOperationTypeGetBucket,
-    OSSOperationTypeGetBucketInfo,
-    OSSOperationTypeGetBucketACL,
-    OSSOperationTypeHeadObject,
-    OSSOperationTypeGetObject,
-    OSSOperationTypeGetObjectACL,
-    OSSOperationTypePutObject,
-    OSSOperationTypePutObjectACL,
-    OSSOperationTypeAppendObject,
-    OSSOperationTypeDeleteObject,
-    OSSOperationTypeDeleteMultipleObjects,
-    OSSOperationTypeCopyObject,
-    OSSOperationTypeInitMultipartUpload,
-    OSSOperationTypeUploadPart,
-    OSSOperationTypeCompleteMultipartUpload,
-    OSSOperationTypeAbortMultipartUpload,
-    OSSOperationTypeListMultipart,
-    OSSOperationTypeListMultipartUploads,
-    OSSOperationTypeTriggerCallBack,
-    OSSOperationTypeImagePersist,
-    OSSOperationTypeRestoreObject,
-    OSSOperationTypePutSymlink,
-    OSSOperationTypeGetSymlink,
-};
-
-/**
- * @brief: The following constants are provided by OSSClient as possible error codes.
- */
-typedef NS_ENUM(NSInteger, OSSClientErrorCODE) {
-    OSSClientErrorCodeNetworkingFailWithResponseCode0,
-    OSSClientErrorCodeSignFailed,
-    OSSClientErrorCodeFileCantWrite,
-    OSSClientErrorCodeInvalidArgument,
-    OSSClientErrorCodeNilUploadid,
-    OSSClientErrorCodeTaskCancelled,
-    OSSClientErrorCodeNetworkError,
-    OSSClientErrorCodeInvalidCRC,
-    OSSClientErrorCodeCannotResumeUpload,
-    OSSClientErrorCodeExcpetionCatched,
-    OSSClientErrorCodeNotKnown
-};
-
-typedef NS_ENUM(NSInteger, OSSXMLDictionaryAttributesMode)
-{
-    OSSXMLDictionaryAttributesModePrefixed = 0, //default
-    OSSXMLDictionaryAttributesModeDictionary,
-    OSSXMLDictionaryAttributesModeUnprefixed,
-    OSSXMLDictionaryAttributesModeDiscard
-};
-
-
-typedef NS_ENUM(NSInteger, OSSXMLDictionaryNodeNameMode)
-{
-    OSSXMLDictionaryNodeNameModeRootOnly = 0, //default
-    OSSXMLDictionaryNodeNameModeAlways,
-    OSSXMLDictionaryNodeNameModeNever
-};
-
-typedef NS_ENUM(NSInteger, OSSBucketStorageClass)
-{
-    OSSBucketStorageClassStandard,
-    OSSBucketStorageClassIA,
-    OSSBucketStorageClassArchive
-};
-
-typedef NSString * OSSXMLDictionaryAttributeName NS_EXTENSIBLE_STRING_ENUM;
-
-OBJC_EXTERN OSSXMLDictionaryAttributeName const OSSXMLDictionaryAttributesKey;
-OBJC_EXTERN OSSXMLDictionaryAttributeName const OSSXMLDictionaryCommentsKey;
-OBJC_EXTERN OSSXMLDictionaryAttributeName const OSSXMLDictionaryTextKey;
-OBJC_EXTERN OSSXMLDictionaryAttributeName const OSSXMLDictionaryNodeNameKey;
-OBJC_EXTERN OSSXMLDictionaryAttributeName const OSSXMLDictionaryAttributePrefix;
-
-OBJC_EXTERN NSString * const OSSHTTPMethodHEAD;
-OBJC_EXTERN NSString * const OSSHTTPMethodGET;
-OBJC_EXTERN NSString * const OSSHTTPMethodPUT;
-OBJC_EXTERN NSString * const OSSHTTPMethodPOST;
-OBJC_EXTERN NSString * const OSSHTTPMethodDELETE;
-
-
-NS_ASSUME_NONNULL_END

+ 0 - 21
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSConstants.m

@@ -1,21 +0,0 @@
-//
-//  OSSConstants.m
-//  AliyunOSSSDK
-//
-//  Created by huaixu on 2018/1/22.
-//  Copyright © 2018年 aliyun. All rights reserved.
-//
-
-#import "OSSConstants.h"
-
-NSString * const OSSXMLDictionaryAttributesKey = @"__attributes";
-NSString * const OSSXMLDictionaryCommentsKey = @"__comments";
-NSString * const OSSXMLDictionaryTextKey = @"__text";
-NSString * const OSSXMLDictionaryNodeNameKey = @"__name";
-NSString * const OSSXMLDictionaryAttributePrefix = @"_";
-
-NSString * const OSSHTTPMethodHEAD = @"HEAD";
-NSString * const OSSHTTPMethodGET = @"GET";
-NSString * const OSSHTTPMethodPUT = @"PUT";
-NSString * const OSSHTTPMethodPOST = @"POST";
-NSString * const OSSHTTPMethodDELETE = @"DELETE";

+ 0 - 84
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSDefine.h

@@ -1,84 +0,0 @@
-//
-//  OSSDefine.h
-//  AliyunOSSiOS
-//
-//  Created by zhouzhuo on 5/1/16.
-//  Copyright © 2016 zhouzhuo. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-
-#ifndef OSSDefine_h
-#define OSSDefine_h
-
-#if TARGET_OS_IOS
-#define OSSUAPrefix                             @"aliyun-sdk-ios"
-#elif TARGET_OS_OSX
-#define OSSUAPrefix                             @"aliyun-sdk-mac"
-#endif
-#define OSSSDKVersion                           @"2.10.8"
-
-#define OSSListBucketResultXMLTOKEN             @"ListBucketResult"
-#define OSSNameXMLTOKEN                         @"Name"
-#define OSSDelimiterXMLTOKEN                    @"Delimiter"
-#define OSSMarkerXMLTOKEN                       @"Marker"
-#define OSSKeyMarkerXMLTOKEN                    @"KeyMarker"
-#define OSSNextMarkerXMLTOKEN                   @"NextMarker"
-#define OSSNextKeyMarkerXMLTOKEN                @"NextKeyMarker"
-#define OSSUploadIdMarkerXMLTOKEN               @"UploadIdMarker"
-#define OSSNextUploadIdMarkerXMLTOKEN           @"NextUploadIdMarker"
-#define OSSMaxKeysXMLTOKEN                      @"MaxKeys"
-#define OSSMaxUploadsXMLTOKEN                   @"MaxUploads"
-#define OSSIsTruncatedXMLTOKEN                  @"IsTruncated"
-#define OSSContentsXMLTOKEN                     @"Contents"
-#define OSSUploadXMLTOKEN                       @"Upload"
-#define OSSKeyXMLTOKEN                          @"Key"
-#define OSSLastModifiedXMLTOKEN                 @"LastModified"
-#define OSSETagXMLTOKEN                         @"ETag"
-#define OSSTypeXMLTOKEN                         @"Type"
-#define OSSSizeXMLTOKEN                         @"Size"
-#define OSSStorageClassXMLTOKEN                 @"StorageClass"
-#define OSSCommonPrefixesXMLTOKEN               @"CommonPrefixes"
-#define OSSOwnerXMLTOKEN                        @"Owner"
-#define OSSAccessControlListXMLTOKEN            @"AccessControlList"
-#define OSSGrantXMLTOKEN                        @"Grant"
-#define OSSIDXMLTOKEN                           @"ID"
-#define OSSDisplayNameXMLTOKEN                  @"DisplayName"
-#define OSSBucketsXMLTOKEN                      @"Buckets"
-#define OSSBucketXMLTOKEN                       @"Bucket"
-#define OSSCreationDate                         @"CreationDate"
-#define OSSPrefixXMLTOKEN                       @"Prefix"
-#define OSSUploadIdXMLTOKEN                     @"UploadId"
-#define OSSLocationXMLTOKEN                     @"Location"
-#define OSSNextPartNumberMarkerXMLTOKEN         @"NextPartNumberMarker"
-#define OSSMaxPartsXMLTOKEN                     @"MaxParts"
-#define OSSPartXMLTOKEN                         @"Part"
-#define OSSPartNumberXMLTOKEN                   @"PartNumber"
-
-#define OSSClientErrorDomain                    @"com.aliyun.oss.clientError"
-#define OSSServerErrorDomain                    @"com.aliyun.oss.serverError"
-
-#define OSSErrorMessageTOKEN                    @"ErrorMessage"
-
-#define OSSHttpHeaderContentDisposition         @"Content-Disposition"
-#define OSSHttpHeaderXOSSCallback               @"x-oss-callback"
-#define OSSHttpHeaderXOSSCallbackVar            @"x-oss-callback-var"
-#define OSSHttpHeaderContentEncoding            @"Content-Encoding"
-#define OSSHttpHeaderContentType                @"Content-Type"
-#define OSSHttpHeaderContentMD5                 @"Content-MD5"
-#define OSSHttpHeaderCacheControl               @"Cache-Control"
-#define OSSHttpHeaderExpires                    @"Expires"
-#define OSSHttpHeaderHashSHA1                   @"x-oss-hash-sha1"
-#define OSSHttpHeaderBucketACL                  @"x-oss-acl"
-#define OSSHttpHeaderObjectACL                  @"x-oss-object-acl"
-#define OSSHttpHeaderCopySource                 @"x-oss-copy-source"
-#define OSSHttpHeaderSymlinkTarget              @"x-oss-symlink-target"
-
-#define OSSHttpQueryProcess                     @"x-oss-process"
-
-#define OSSDefaultRetryCount                    3
-#define OSSDefaultMaxConcurrentNum              5
-#define OSSDefaultTimeoutForRequestInSecond     15
-#define OSSDefaultTimeoutForResourceInSecond    7 * 24 * 60 * 60
-
-#endif /* OSSDefine_h */

+ 0 - 31
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSDeleteMultipleObjectsRequest.h

@@ -1,31 +0,0 @@
-//
-//  OSSDeleteMultipleObjectsRequest.h
-//  AliyunOSSSDK
-//
-//  Created by huaixu on 2018/1/26.
-//  Copyright © 2018年 aliyun. All rights reserved.
-//
-#import <Foundation/Foundation.h>
-#import "OSSRequest.h"
-
-NS_ASSUME_NONNULL_BEGIN
-
-@interface OSSDeleteMultipleObjectsRequest : OSSRequest
-
-@property (nonatomic, copy) NSString *bucketName;
-
-@property (nonatomic, copy) NSArray<NSString *> *keys;
-
-/**
- invalid value is @"url"
- */
-@property (nonatomic, copy, nullable) NSString *encodingType;
-
-/**
- whether to show verbose result,the default value is YES.
- */
-@property (nonatomic, assign) BOOL quiet;
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 22
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSDeleteMultipleObjectsRequest.m

@@ -1,22 +0,0 @@
-//
-//  OSSDeleteMultipleObjectsRequest.m
-//  AliyunOSSSDK
-//
-//  Created by huaixu on 2018/1/26.
-//  Copyright © 2018年 aliyun. All rights reserved.
-//
-
-#import "OSSDeleteMultipleObjectsRequest.h"
-
-@implementation OSSDeleteMultipleObjectsRequest
-
-- (instancetype)init
-{
-    self = [super init];
-    if (self) {
-        _quiet = YES;
-    }
-    return self;
-}
-
-@end

+ 0 - 17
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSDeleteMultipleObjectsResult.h

@@ -1,17 +0,0 @@
-//
-//  OSSDeleteMultipleObjectsResult.h
-//  AliyunOSSSDK
-//
-//  Created by huaixu on 2018/1/26.
-//  Copyright © 2018年 aliyun. All rights reserved.
-//
-
-#import "OSSResult.h"
-
-@interface OSSDeleteMultipleObjectsResult : OSSResult
-
-@property (nonatomic, copy) NSArray<NSString *> *deletedObjects;
-
-@property (nonatomic, copy) NSString *encodingType;
-
-@end

+ 0 - 13
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSDeleteMultipleObjectsResult.m

@@ -1,13 +0,0 @@
-//
-//  OSSDeleteMultipleObjectsResult.m
-//  AliyunOSSSDK
-//
-//  Created by huaixu on 2018/1/26.
-//  Copyright © 2018年 aliyun. All rights reserved.
-//
-
-#import "OSSDeleteMultipleObjectsResult.h"
-
-@implementation OSSDeleteMultipleObjectsResult
-
-@end

+ 0 - 75
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSFileLog/OSSCocoaLumberjack.h

@@ -1,75 +0,0 @@
-// Software License Agreement (BSD License)
-//
-// Copyright (c) 2010-2016, Deusty, LLC
-// All rights reserved.
-//
-// Redistribution and use of this software in source and binary forms,
-// with or without modification, are permitted provided that the following conditions are met:
-//
-// * Redistributions of source code must retain the above copyright notice,
-//   this list of conditions and the following disclaimer.
-//
-// * Neither the name of Deusty nor the names of its contributors may be used
-//   to endorse or promote products derived from this software without specific
-//   prior written permission of Deusty, LLC.
-
-/**
- * Welcome to CocoaLumberjack!
- *
- * The project page has a wealth of documentation if you have any questions.
- *
- * If you're new to the project you may wish to read "Getting Started" at:
- * Documentation/GettingStarted.md
- *
- * Otherwise, here is a quick refresher.
- * There are three steps to using the macros:
- *
- * Step 1:
- * Import the header in your implementation or prefix file:
- *
- * #import <CocoaLumberjack/CocoaLumberjack.h>
- *
- * Step 2:
- * Define your logging level in your implementation file:
- *
- * // Log levels: off, error, warn, info, verbose
- * static const DDLogLevel ddLogLevel = DDLogLevelVerbose;
- *
- * Step 2 [3rd party frameworks]:
- *
- * Define your LOG_LEVEL_DEF to a different variable/function than ddLogLevel:
- *
- * // #undef LOG_LEVEL_DEF // Undefine first only if needed
- * #define LOG_LEVEL_DEF myLibLogLevel
- *
- * Define your logging level in your implementation file:
- *
- * // Log levels: off, error, warn, info, verbose
- * static const DDLogLevel myLibLogLevel = DDLogLevelVerbose;
- *
- * Step 3:
- * Replace your NSLog statements with DDLog statements according to the severity of the message.
- *
- * NSLog(@"Fatal error, no dohickey found!"); -> OSSLogError(@"Fatal error, no dohickey found!");
- *
- * DDLog works exactly the same as NSLog.
- * This means you can pass it multiple variables just like NSLog.
- **/
-
-#import <Foundation/Foundation.h>
-
-// Disable legacy macros
-#ifndef OSSDD_LEGACY_MACROS
-    #define OSSDD_LEGACY_MACROS 0
-#endif
-
-// Core
-#import "OSSDDLog.h"
-
-// Main macros
-#import "OSSLogMacros.h"
-
-// Loggers
-#import "OSSFileLogger.h"
-#import "OSSNSLogger.h"
-

+ 0 - 860
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSFileLog/OSSDDLog.h

@@ -1,860 +0,0 @@
-// Software License Agreement (BSD License)
-//
-// Copyright (c) 2010-2016, Deusty, LLC
-// All rights reserved.
-//
-// Redistribution and use of this software in source and binary forms,
-// with or without modification, are permitted provided that the following conditions are met:
-//
-// * Redistributions of source code must retain the above copyright notice,
-//   this list of conditions and the following disclaimer.
-//
-// * Neither the name of Deusty nor the names of its contributors may be used
-//   to endorse or promote products derived from this software without specific
-//   prior written permission of Deusty, LLC.
-
-#import <Foundation/Foundation.h>
-
-// Enable 1.9.x legacy macros if imported directly
-#ifndef OSSDD_LEGACY_MACROS
-    #define OSSDD_LEGACY_MACROS 1
-#endif
-
-#if OS_OBJECT_USE_OBJC
-    #define DISPATCH_QUEUE_REFERENCE_TYPE strong
-#else
-    #define DISPATCH_QUEUE_REFERENCE_TYPE assign
-#endif
-
-@class OSSDDLogMessage;
-@class OSSDDLoggerInformation;
-@protocol OSSDDLogger;
-@protocol OSSDDLogFormatter;
-
-/**
- * Define the standard options.
- *
- * We default to only 4 levels because it makes it easier for beginners
- * to make the transition to a logging framework.
- *
- * More advanced users may choose to completely customize the levels (and level names) to suite their needs.
- * For more information on this see the "Custom Log Levels" page:
- * Documentation/CustomLogLevels.md
- *
- * Advanced users may also notice that we're using a bitmask.
- * This is to allow for custom fine grained logging:
- * Documentation/FineGrainedLogging.md
- *
- * -- Flags --
- *
- * Typically you will use the LOG_LEVELS (see below), but the flags may be used directly in certain situations.
- * For example, say you have a lot of warning log messages, and you wanted to disable them.
- * However, you still needed to see your error and info log messages.
- * You could accomplish that with the following:
- *
- * static const DDLogLevel ddLogLevel = DDLogFlagError | DDLogFlagInfo;
- *
- * When LOG_LEVEL_DEF is defined as ddLogLevel.
- *
- * Flags may also be consulted when writing custom log formatters,
- * as the DDLogMessage class captures the individual flag that caused the log message to fire.
- *
- * -- Levels --
- *
- * Log levels are simply the proper bitmask of the flags.
- *
- * -- Booleans --
- *
- * The booleans may be used when your logging code involves more than one line.
- * For example:
- *
- * if (LOG_VERBOSE) {
- *     for (id sprocket in sprockets)
- *         DDLogVerbose(@"sprocket: %@", [sprocket description])
- * }
- *
- * -- Async --
- *
- * Defines the default asynchronous options.
- * The default philosophy for asynchronous logging is very simple:
- *
- * Log messages with errors should be executed synchronously.
- *     After all, an error just occurred. The application could be unstable.
- *
- * All other log messages, such as debug output, are executed asynchronously.
- *     After all, if it wasn't an error, then it was just informational output,
- *     or something the application was easily able to recover from.
- *
- * -- Changes --
- *
- * You are strongly discouraged from modifying this file.
- * If you do, you make it more difficult on yourself to merge future bug fixes and improvements from the project.
- * Instead, create your own MyLogging.h or ApplicationNameLogging.h or CompanyLogging.h
- *
- * For an example of customizing your logging experience, see the "Custom Log Levels" page:
- * Documentation/CustomLogLevels.md
- **/
-
-/**
- *  Flags accompany each log. They are used together with levels to filter out logs.
- */
-typedef NS_OPTIONS(NSUInteger, OSSDDLogFlag){
-    /**
-     *  0...00001 DDLogFlagError
-     */
-    OSSDDLogFlagError      = (1 << 0),
-    
-    /**
-     *  0...00010 DDLogFlagWarning
-     */
-    OSSDDLogFlagWarning    = (1 << 1),
-    
-    /**
-     *  0...00100 DDLogFlagInfo
-     */
-    OSSDDLogFlagInfo       = (1 << 2),
-    
-    /**
-     *  0...01000 DDLogFlagDebug
-     */
-    OSSDDLogFlagDebug      = (1 << 3),
-    
-    /**
-     *  0...10000 DDLogFlagVerbose
-     */
-    OSSDDLogFlagVerbose    = (1 << 4)
-};
-
-/**
- *  Log levels are used to filter out logs. Used together with flags.
- */
-typedef NS_ENUM(NSUInteger, OSSDDLogLevel){
-    /**
-     *  No logs
-     */
-    OSSDDLogLevelOff       = 0,
-    
-    /**
-     *  Error logs only
-     */
-    OSSDDLogLevelError     = (OSSDDLogFlagError),
-    
-    /**
-     *  Error and warning logs
-     */
-    OSSDDLogLevelWarning   = (OSSDDLogLevelError   | OSSDDLogFlagWarning),
-    
-    /**
-     *  Error, warning and info logs
-     */
-    OSSDDLogLevelInfo      = (OSSDDLogLevelWarning | OSSDDLogFlagInfo),
-    
-    /**
-     *  Error, warning, info and debug logs
-     */
-    OSSDDLogLevelDebug     = (OSSDDLogLevelInfo    | OSSDDLogFlagDebug),
-    
-    /**
-     *  Error, warning, info, debug and verbose logs
-     */
-    OSSDDLogLevelVerbose   = (OSSDDLogLevelDebug   | OSSDDLogFlagVerbose),
-    
-    /**
-     *  All logs (1...11111)
-     */
-    OSSDDLogLevelAll       = NSUIntegerMax
-};
-
-NS_ASSUME_NONNULL_BEGIN
-
-/**
- *  Extracts just the file name, no path or extension
- *
- *  @param filePath input file path
- *  @param copy     YES if we want the result to be copied
- *
- *  @return the file name
- */
-NSString * __nullable OSSDDExtractFileNameWithoutExtension(const char *filePath, BOOL copy);
-
-/**
- * The THIS_FILE macro gives you an NSString of the file name.
- * For simplicity and clarity, the file name does not include the full path or file extension.
- *
- * For example: DDLogWarn(@"%@: Unable to find thingy", THIS_FILE) -> @"MyViewController: Unable to find thingy"
- **/
-#define THIS_FILE         (DDExtractFileNameWithoutExtension(__FILE__, NO))
-
-/**
- * The THIS_METHOD macro gives you the name of the current objective-c method.
- *
- * For example: DDLogWarn(@"%@ - Requires non-nil strings", THIS_METHOD) -> @"setMake:model: requires non-nil strings"
- *
- * Note: This does NOT work in straight C functions (non objective-c).
- * Instead you should use the predefined __FUNCTION__ macro.
- **/
-#define THIS_METHOD       NSStringFromSelector(_cmd)
-
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-#pragma mark -
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-/**
- *  The main class, exposes all logging mechanisms, loggers, ...
- *  For most of the users, this class is hidden behind the logging functions like `DDLogInfo`
- */
-@interface OSSDDLog : NSObject
-
-/**
- *  Returns the singleton `DDLog`.
- *  The instance is used by `DDLog` class methods.
- */
-@property (class, nonatomic, strong, readonly) OSSDDLog *sharedInstance;
-
-/**
- * Provides access to the underlying logging queue.
- * This may be helpful to Logger classes for things like thread synchronization.
- **/
-@property (class, nonatomic, DISPATCH_QUEUE_REFERENCE_TYPE, readonly) dispatch_queue_t loggingQueue;
-
-/**
- * Logging Primitive.
- *
- * This method is used by the macros or logging functions.
- * It is suggested you stick with the macros as they're easier to use.
- *
- *  @param asynchronous YES if the logging is done async, NO if you want to force sync
- *  @param level        the log level
- *  @param flag         the log flag
- *  @param context      the context (if any is defined)
- *  @param file         the current file
- *  @param function     the current function
- *  @param line         the current code line
- *  @param tag          potential tag
- *  @param format       the log format
- */
-+ (void)log:(BOOL)asynchronous
-      level:(OSSDDLogLevel)level
-       flag:(OSSDDLogFlag)flag
-    context:(NSInteger)context
-       file:(const char *)file
-   function:(const char *)function
-       line:(NSUInteger)line
-        tag:(id __nullable)tag
-     format:(NSString *)format, ... NS_FORMAT_FUNCTION(9,10);
-
-/**
- * Logging Primitive.
- *
- * This method is used by the macros or logging functions.
- * It is suggested you stick with the macros as they're easier to use.
- *
- *  @param asynchronous YES if the logging is done async, NO if you want to force sync
- *  @param level        the log level
- *  @param flag         the log flag
- *  @param context      the context (if any is defined)
- *  @param file         the current file
- *  @param function     the current function
- *  @param line         the current code line
- *  @param tag          potential tag
- *  @param format       the log format
- */
-- (void)log:(BOOL)asynchronous
-      level:(OSSDDLogLevel)level
-       flag:(OSSDDLogFlag)flag
-    context:(NSInteger)context
-       file:(const char *)file
-   function:(const char *)function
-       line:(NSUInteger)line
-        tag:(id __nullable)tag
-     format:(NSString *)format, ... NS_FORMAT_FUNCTION(9,10);
-
-/**
- * Logging Primitive.
- *
- * This method can be used if you have a prepared va_list.
- * Similar to `log:level:flag:context:file:function:line:tag:format:...`
- *
- *  @param asynchronous YES if the logging is done async, NO if you want to force sync
- *  @param level        the log level
- *  @param flag         the log flag
- *  @param context      the context (if any is defined)
- *  @param file         the current file
- *  @param function     the current function
- *  @param line         the current code line
- *  @param tag          potential tag
- *  @param format       the log format
- *  @param argList      the arguments list as a va_list
- */
-+ (void)log:(BOOL)asynchronous
-      level:(OSSDDLogLevel)level
-       flag:(OSSDDLogFlag)flag
-    context:(NSInteger)context
-       file:(const char *)file
-   function:(const char *)function
-       line:(NSUInteger)line
-        tag:(id __nullable)tag
-     format:(NSString *)format
-       args:(va_list)argList NS_SWIFT_NAME(log(asynchronous:level:flag:context:file:function:line:tag:format:arguments:));
-
-/**
- * Logging Primitive.
- *
- * This method can be used if you have a prepared va_list.
- * Similar to `log:level:flag:context:file:function:line:tag:format:...`
- *
- *  @param asynchronous YES if the logging is done async, NO if you want to force sync
- *  @param level        the log level
- *  @param flag         the log flag
- *  @param context      the context (if any is defined)
- *  @param file         the current file
- *  @param function     the current function
- *  @param line         the current code line
- *  @param tag          potential tag
- *  @param format       the log format
- *  @param argList      the arguments list as a va_list
- */
-- (void)log:(BOOL)asynchronous
-      level:(OSSDDLogLevel)level
-       flag:(OSSDDLogFlag)flag
-    context:(NSInteger)context
-       file:(const char *)file
-   function:(const char *)function
-       line:(NSUInteger)line
-        tag:(id __nullable)tag
-     format:(NSString *)format
-       args:(va_list)argList NS_SWIFT_NAME(log(asynchronous:level:flag:context:file:function:line:tag:format:arguments:));
-
-/**
- * Logging Primitive.
- *
- * This method can be used if you manualy prepared DDLogMessage.
- *
- *  @param asynchronous YES if the logging is done async, NO if you want to force sync
- *  @param logMessage   the log message stored in a `DDLogMessage` model object
- */
-+ (void)log:(BOOL)asynchronous
-    message:(OSSDDLogMessage *)logMessage NS_SWIFT_NAME(log(asynchronous:message:));
-
-/**
- * Logging Primitive.
- *
- * This method can be used if you manualy prepared DDLogMessage.
- *
- *  @param asynchronous YES if the logging is done async, NO if you want to force sync
- *  @param logMessage   the log message stored in a `DDLogMessage` model object
- */
-- (void)log:(BOOL)asynchronous
-    message:(OSSDDLogMessage *)logMessage NS_SWIFT_NAME(log(asynchronous:message:));
-
-/**
- * Since logging can be asynchronous, there may be times when you want to flush the logs.
- * The framework invokes this automatically when the application quits.
- **/
-+ (void)flushLog;
-
-/**
- * Since logging can be asynchronous, there may be times when you want to flush the logs.
- * The framework invokes this automatically when the application quits.
- **/
-- (void)flushLog;
-
-/**
- * Loggers
- *
- * In order for your log statements to go somewhere, you should create and add a logger.
- *
- * You can add multiple loggers in order to direct your log statements to multiple places.
- * And each logger can be configured separately.
- * So you could have, for example, verbose logging to the console, but a concise log file with only warnings & errors.
- **/
-
-/**
- * Adds the logger to the system.
- *
- * This is equivalent to invoking `[DDLog addLogger:logger withLogLevel:DDLogLevelAll]`.
- **/
-+ (void)addLogger:(id <OSSDDLogger>)logger;
-
-/**
- * Adds the logger to the system.
- *
- * This is equivalent to invoking `[DDLog addLogger:logger withLogLevel:DDLogLevelAll]`.
- **/
-- (void)addLogger:(id <OSSDDLogger>)logger;
-
-/**
- * Adds the logger to the system.
- *
- * The level that you provide here is a preemptive filter (for performance).
- * That is, the level specified here will be used to filter out logMessages so that
- * the logger is never even invoked for the messages.
- *
- * More information:
- * When you issue a log statement, the logging framework iterates over each logger,
- * and checks to see if it should forward the logMessage to the logger.
- * This check is done using the level parameter passed to this method.
- *
- * For example:
- *
- * `[DDLog addLogger:consoleLogger withLogLevel:DDLogLevelVerbose];`
- * `[DDLog addLogger:fileLogger    withLogLevel:DDLogLevelWarning];`
- *
- * `DDLogError(@"oh no");` => gets forwarded to consoleLogger & fileLogger
- * `DDLogInfo(@"hi");`     => gets forwarded to consoleLogger only
- *
- * It is important to remember that Lumberjack uses a BITMASK.
- * Many developers & third party frameworks may define extra log levels & flags.
- * For example:
- *
- * `#define SOME_FRAMEWORK_LOG_FLAG_TRACE (1 << 6) // 0...1000000`
- *
- * So if you specify `DDLogLevelVerbose` to this method, you won't see the framework's trace messages.
- *
- * `(SOME_FRAMEWORK_LOG_FLAG_TRACE & DDLogLevelVerbose) => (01000000 & 00011111) => NO`
- *
- * Consider passing `DDLogLevelAll` to this method, which has all bits set.
- * You can also use the exclusive-or bitwise operator to get a bitmask that has all flags set,
- * except the ones you explicitly don't want. For example, if you wanted everything except verbose & debug:
- *
- * `((DDLogLevelAll ^ DDLogLevelVerbose) | DDLogLevelInfo)`
- **/
-+ (void)addLogger:(id <OSSDDLogger>)logger withLevel:(OSSDDLogLevel)level;
-
-/**
- * Adds the logger to the system.
- *
- * The level that you provide here is a preemptive filter (for performance).
- * That is, the level specified here will be used to filter out logMessages so that
- * the logger is never even invoked for the messages.
- *
- * More information:
- * When you issue a log statement, the logging framework iterates over each logger,
- * and checks to see if it should forward the logMessage to the logger.
- * This check is done using the level parameter passed to this method.
- *
- * For example:
- *
- * `[DDLog addLogger:consoleLogger withLogLevel:DDLogLevelVerbose];`
- * `[DDLog addLogger:fileLogger    withLogLevel:DDLogLevelWarning];`
- *
- * `DDLogError(@"oh no");` => gets forwarded to consoleLogger & fileLogger
- * `DDLogInfo(@"hi");`     => gets forwarded to consoleLogger only
- *
- * It is important to remember that Lumberjack uses a BITMASK.
- * Many developers & third party frameworks may define extra log levels & flags.
- * For example:
- *
- * `#define SOME_FRAMEWORK_LOG_FLAG_TRACE (1 << 6) // 0...1000000`
- *
- * So if you specify `DDLogLevelVerbose` to this method, you won't see the framework's trace messages.
- *
- * `(SOME_FRAMEWORK_LOG_FLAG_TRACE & DDLogLevelVerbose) => (01000000 & 00011111) => NO`
- *
- * Consider passing `DDLogLevelAll` to this method, which has all bits set.
- * You can also use the exclusive-or bitwise operator to get a bitmask that has all flags set,
- * except the ones you explicitly don't want. For example, if you wanted everything except verbose & debug:
- *
- * `((DDLogLevelAll ^ DDLogLevelVerbose) | DDLogLevelInfo)`
- **/
-- (void)addLogger:(id <OSSDDLogger>)logger withLevel:(OSSDDLogLevel)level;
-
-/**
- *  Remove the logger from the system
- */
-+ (void)removeLogger:(id <OSSDDLogger>)logger;
-
-/**
- *  Remove the logger from the system
- */
-- (void)removeLogger:(id <OSSDDLogger>)logger;
-
-/**
- *  Remove all the current loggers
- */
-+ (void)removeAllLoggers;
-
-/**
- *  Remove all the current loggers
- */
-- (void)removeAllLoggers;
-
-/**
- *  Return all the current loggers
- */
-@property (class, nonatomic, copy, readonly) NSArray<id<OSSDDLogger>> *allLoggers;
-
-/**
- *  Return all the current loggers
- */
-@property (nonatomic, copy, readonly) NSArray<id<OSSDDLogger>> *allLoggers;
-
-/**
- *  Return all the current loggers with their level (aka DDLoggerInformation).
- */
-@property (class, nonatomic, copy, readonly) NSArray<OSSDDLoggerInformation *> *allLoggersWithLevel;
-
-/**
- *  Return all the current loggers with their level (aka DDLoggerInformation).
- */
-@property (nonatomic, copy, readonly) NSArray<OSSDDLoggerInformation *> *allLoggersWithLevel;
-
-@end
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-#pragma mark -
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-/**
- *  This protocol describes a basic logger behavior. 
- *  Basically, it can log messages, store a logFormatter plus a bunch of optional behaviors.
- *  (i.e. flush, get its loggerQueue, get its name, ...
- */
-@protocol OSSDDLogger <NSObject>
-
-/**
- *  The log message method
- *
- *  @param logMessage the message (model)
- */
-- (void)logMessage:(OSSDDLogMessage *)logMessage NS_SWIFT_NAME(log(message:));
-
-/**
- * Formatters may optionally be added to any logger.
- *
- * If no formatter is set, the logger simply logs the message as it is given in logMessage,
- * or it may use its own built in formatting style.
- **/
-@property (nonatomic, strong) id <OSSDDLogFormatter> logFormatter;
-
-@optional
-
-/**
- * Since logging is asynchronous, adding and removing loggers is also asynchronous.
- * In other words, the loggers are added and removed at appropriate times with regards to log messages.
- *
- * - Loggers will not receive log messages that were executed prior to when they were added.
- * - Loggers will not receive log messages that were executed after they were removed.
- *
- * These methods are executed in the logging thread/queue.
- * This is the same thread/queue that will execute every logMessage: invocation.
- * Loggers may use these methods for thread synchronization or other setup/teardown tasks.
- **/
-- (void)didAddLogger;
-
-/**
- * Since logging is asynchronous, adding and removing loggers is also asynchronous.
- * In other words, the loggers are added and removed at appropriate times with regards to log messages.
- *
- * - Loggers will not receive log messages that were executed prior to when they were added.
- * - Loggers will not receive log messages that were executed after they were removed.
- *
- * These methods are executed in the logging thread/queue given in parameter.
- * This is the same thread/queue that will execute every logMessage: invocation.
- * Loggers may use the queue parameter to set specific values on the queue with dispatch_set_specific() function.
- **/
-- (void)didAddLoggerInQueue:(dispatch_queue_t)queue;
-
-/**
- *  See the above description for `didAddLoger`
- */
-- (void)willRemoveLogger;
-
-/**
- * Some loggers may buffer IO for optimization purposes.
- * For example, a database logger may only save occasionaly as the disk IO is slow.
- * In such loggers, this method should be implemented to flush any pending IO.
- *
- * This allows invocations of DDLog's flushLog method to be propogated to loggers that need it.
- *
- * Note that DDLog's flushLog method is invoked automatically when the application quits,
- * and it may be also invoked manually by the developer prior to application crashes, or other such reasons.
- **/
-- (void)flush;
-
-/**
- * Each logger is executed concurrently with respect to the other loggers.
- * Thus, a dedicated dispatch queue is used for each logger.
- * Logger implementations may optionally choose to provide their own dispatch queue.
- **/
-@property (nonatomic, DISPATCH_QUEUE_REFERENCE_TYPE, readonly) dispatch_queue_t loggerQueue;
-
-/**
- * If the logger implementation does not choose to provide its own queue,
- * one will automatically be created for it.
- * The created queue will receive its name from this method.
- * This may be helpful for debugging or profiling reasons.
- **/
-@property (nonatomic, readonly) NSString *loggerName;
-
-@end
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-#pragma mark -
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-/**
- *  This protocol describes the behavior of a log formatter
- */
-@protocol OSSDDLogFormatter <NSObject>
-@required
-
-/**
- * Formatters may optionally be added to any logger.
- * This allows for increased flexibility in the logging environment.
- * For example, log messages for log files may be formatted differently than log messages for the console.
- *
- * For more information about formatters, see the "Custom Formatters" page:
- * Documentation/CustomFormatters.md
- *
- * The formatter may also optionally filter the log message by returning nil,
- * in which case the logger will not log the message.
- **/
-- (NSString * __nullable)formatLogMessage:(OSSDDLogMessage *)logMessage NS_SWIFT_NAME(format(message:));
-
-@optional
-
-/**
- * A single formatter instance can be added to multiple loggers.
- * These methods provides hooks to notify the formatter of when it's added/removed.
- *
- * This is primarily for thread-safety.
- * If a formatter is explicitly not thread-safe, it may wish to throw an exception if added to multiple loggers.
- * Or if a formatter has potentially thread-unsafe code (e.g. NSDateFormatter),
- * it could possibly use these hooks to switch to thread-safe versions of the code.
- **/
-- (void)didAddToLogger:(id <OSSDDLogger>)logger;
-
-/**
- * A single formatter instance can be added to multiple loggers.
- * These methods provides hooks to notify the formatter of when it's added/removed.
- *
- * This is primarily for thread-safety.
- * If a formatter is explicitly not thread-safe, it may wish to throw an exception if added to multiple loggers.
- * Or if a formatter has potentially thread-unsafe code (e.g. NSDateFormatter),
- * it could possibly use these hooks to switch to thread-safe versions of the code or use dispatch_set_specific()
-.* to add its own specific values.
- **/
-- (void)didAddToLogger:(id <OSSDDLogger>)logger inQueue:(dispatch_queue_t)queue;
-
-/**
- *  See the above description for `didAddToLogger:`
- */
-- (void)willRemoveFromLogger:(id <OSSDDLogger>)logger;
-
-@end
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-#pragma mark -
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-/**
- *  This protocol describes a dynamic logging component
- */
-@protocol OSSDDRegisteredDynamicLogging
-
-/**
- * Implement these methods to allow a file's log level to be managed from a central location.
- *
- * This is useful if you'd like to be able to change log levels for various parts
- * of your code from within the running application.
- *
- * Imagine pulling up the settings for your application,
- * and being able to configure the logging level on a per file basis.
- *
- * The implementation can be very straight-forward:
- *
- * ```
- * + (int)ddLogLevel
- * {
- *     return ddLogLevel;
- * }
- *
- * + (void)ddSetLogLevel:(DDLogLevel)level
- * {
- *     ddLogLevel = level;
- * }
- * ```
- **/
-@property (class, nonatomic, readwrite, setter=ddSetLogLevel:) OSSDDLogLevel ossLogLevel;
-
-@end
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-#pragma mark -
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-#ifndef NS_DESIGNATED_INITIALIZER
-    #define NS_DESIGNATED_INITIALIZER
-#endif
-
-/**
- *  Log message options, allow copying certain log elements
- */
-typedef NS_OPTIONS(NSInteger, OSSDDLogMessageOptions){
-    /**
-     *  Use this to use a copy of the file path
-     */
-    OSSDDLogMessageCopyFile        = 1 << 0,
-    /**
-     *  Use this to use a copy of the function name
-     */
-    OSSDDLogMessageCopyFunction    = 1 << 1,
-    /**
-     *  Use this to use avoid a copy of the message
-     */
-    OSSDDLogMessageDontCopyMessage = 1 << 2
-};
-
-/**
- * The `DDLogMessage` class encapsulates information about the log message.
- * If you write custom loggers or formatters, you will be dealing with objects of this class.
- **/
-@interface OSSDDLogMessage : NSObject <NSCopying>
-{
-    // Direct accessors to be used only for performance
-    @public
-    NSString *_message;
-    OSSDDLogLevel _level;
-    OSSDDLogFlag _flag;
-    NSInteger _context;
-    NSString *_file;
-    NSString *_fileName;
-    NSString *_function;
-    NSUInteger _line;
-    id _tag;
-    OSSDDLogMessageOptions _options;
-    NSDate *_timestamp;
-    NSString *_threadID;
-    NSString *_threadName;
-    NSString *_queueLabel;
-}
-
-/**
- *  Default `init` for empty messages.
- */
-- (instancetype)init NS_DESIGNATED_INITIALIZER;
-
-/**
- * Standard init method for a log message object.
- * Used by the logging primitives. (And the macros use the logging primitives.)
- *
- * If you find need to manually create logMessage objects, there is one thing you should be aware of:
- *
- * If no flags are passed, the method expects the file and function parameters to be string literals.
- * That is, it expects the given strings to exist for the duration of the object's lifetime,
- * and it expects the given strings to be immutable.
- * In other words, it does not copy these strings, it simply points to them.
- * This is due to the fact that __FILE__ and __FUNCTION__ are usually used to specify these parameters,
- * so it makes sense to optimize and skip the unnecessary allocations.
- * However, if you need them to be copied you may use the options parameter to specify this.
- *
- *  @param message   the message
- *  @param level     the log level
- *  @param flag      the log flag
- *  @param context   the context (if any is defined)
- *  @param file      the current file
- *  @param function  the current function
- *  @param line      the current code line
- *  @param tag       potential tag
- *  @param options   a bitmask which supports DDLogMessageCopyFile and DDLogMessageCopyFunction.
- *  @param timestamp the log timestamp
- *
- *  @return a new instance of a log message model object
- */
-- (instancetype)initWithMessage:(NSString *)message
-                          level:(OSSDDLogLevel)level
-                           flag:(OSSDDLogFlag)flag
-                        context:(NSInteger)context
-                           file:(NSString *)file
-                       function:(NSString * __nullable)function
-                           line:(NSUInteger)line
-                            tag:(id __nullable)tag
-                        options:(OSSDDLogMessageOptions)options
-                      timestamp:(NSDate * __nullable)timestamp NS_DESIGNATED_INITIALIZER;
-
-/**
- * Read-only properties
- **/
-
-/**
- *  The log message
- */
-@property (readonly, nonatomic) NSString *message;
-@property (readonly, nonatomic) OSSDDLogLevel level;
-@property (readonly, nonatomic) OSSDDLogFlag flag;
-@property (readonly, nonatomic) NSInteger context;
-@property (readonly, nonatomic) NSString *file;
-@property (readonly, nonatomic) NSString *fileName;
-@property (readonly, nonatomic) NSString * __nullable function;
-@property (readonly, nonatomic) NSUInteger line;
-@property (readonly, nonatomic) id __nullable tag;
-@property (readonly, nonatomic) OSSDDLogMessageOptions options;
-@property (readonly, nonatomic) NSDate *timestamp;
-@property (readonly, nonatomic) NSString *threadID; // ID as it appears in NSLog calculated from the machThreadID
-@property (readonly, nonatomic) NSString *threadName;
-@property (readonly, nonatomic) NSString *queueLabel;
-
-@end
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-#pragma mark -
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-/**
- * The `DDLogger` protocol specifies that an optional formatter can be added to a logger.
- * Most (but not all) loggers will want to support formatters.
- *
- * However, writting getters and setters in a thread safe manner,
- * while still maintaining maximum speed for the logging process, is a difficult task.
- *
- * To do it right, the implementation of the getter/setter has strict requiremenets:
- * - Must NOT require the `logMessage:` method to acquire a lock.
- * - Must NOT require the `logMessage:` method to access an atomic property (also a lock of sorts).
- *
- * To simplify things, an abstract logger is provided that implements the getter and setter.
- *
- * Logger implementations may simply extend this class,
- * and they can ACCESS THE FORMATTER VARIABLE DIRECTLY from within their `logMessage:` method!
- **/
-@interface OSSDDAbstractLogger : NSObject <OSSDDLogger>
-{
-    // Direct accessors to be used only for performance
-    @public
-    id <OSSDDLogFormatter> _logFormatter;
-    dispatch_queue_t _loggerQueue;
-}
-
-@property (nonatomic, strong, nullable) id <OSSDDLogFormatter> logFormatter;
-@property (nonatomic, DISPATCH_QUEUE_REFERENCE_TYPE) dispatch_queue_t loggerQueue;
-
-// For thread-safety assertions
-
-/**
- *  Return YES if the current logger uses a global queue for logging
- */
-@property (nonatomic, readonly, getter=isOnGlobalLoggingQueue)  BOOL onGlobalLoggingQueue;
-
-/**
- *  Return YES if the current logger uses the internal designated queue for logging
- */
-@property (nonatomic, readonly, getter=isOnInternalLoggerQueue) BOOL onInternalLoggerQueue;
-
-@end
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-#pragma mark -
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-@interface OSSDDLoggerInformation : NSObject
-
-@property (nonatomic, readonly) id <OSSDDLogger> logger;
-@property (nonatomic, readonly) OSSDDLogLevel level;
-
-+ (OSSDDLoggerInformation *)informationWithLogger:(id <OSSDDLogger>)logger
-                           andLevel:(OSSDDLogLevel)level;
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 1247
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSFileLog/OSSDDLog.m

@@ -1,1247 +0,0 @@
-// Software License Agreement (BSD License)
-//
-// Copyright (c) 2010-2016, Deusty, LLC
-// All rights reserved.
-//
-// Redistribution and use of this software in source and binary forms,
-// with or without modification, are permitted provided that the following conditions are met:
-//
-// * Redistributions of source code must retain the above copyright notice,
-//   this list of conditions and the following disclaimer.
-//
-// * Neither the name of Deusty nor the names of its contributors may be used
-//   to endorse or promote products derived from this software without specific
-//   prior written permission of Deusty, LLC.
-
-// Disable legacy macros
-#ifndef OSSDD_LEGACY_MACROS
-    #define OSSDD_LEGACY_MACROS 0
-#endif
-
-#import "OSSDDLog.h"
-
-#import <pthread.h>
-#import <dispatch/dispatch.h>
-#import <objc/runtime.h>
-#import <mach/mach_host.h>
-#import <mach/host_info.h>
-#import <libkern/OSAtomic.h>
-#import <Availability.h>
-#if TARGET_OS_IOS
-    #import <UIKit/UIDevice.h>
-#endif
-
-
-#if !__has_feature(objc_arc)
-#error This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
-#endif
-
-// We probably shouldn't be using DDLog() statements within the DDLog implementation.
-// But we still want to leave our log statements for any future debugging,
-// and to allow other developers to trace the implementation (which is a great learning tool).
-//
-// So we use a primitive logging macro around NSLog.
-// We maintain the NS prefix on the macros to be explicit about the fact that we're using NSLog.
-
-#ifndef OSSDD_DEBUG
-    #define OSSDD_DEBUG NO
-#endif
-
-#define OSSNSLogDebug(frmt, ...) do{ if(OSSDD_DEBUG) NSLog((frmt), ##__VA_ARGS__); } while(0)
-
-// Specifies the maximum queue size of the logging thread.
-//
-// Since most logging is asynchronous, its possible for rogue threads to flood the logging queue.
-// That is, to issue an abundance of log statements faster than the logging thread can keepup.
-// Typically such a scenario occurs when log statements are added haphazardly within large loops,
-// but may also be possible if relatively slow loggers are being used.
-//
-// This property caps the queue size at a given number of outstanding log statements.
-// If a thread attempts to issue a log statement when the queue is already maxed out,
-// the issuing thread will block until the queue size drops below the max again.
-
-#ifndef OSSDDLOG_MAX_QUEUE_SIZE
-    #define OSSDDLOG_MAX_QUEUE_SIZE 1000 // Should not exceed INT32_MAX
-#endif
-
-// The "global logging queue" refers to [DDLog loggingQueue].
-// It is the queue that all log statements go through.
-//
-// The logging queue sets a flag via dispatch_queue_set_specific using this key.
-// We can check for this key via dispatch_get_specific() to see if we're on the "global logging queue".
-
-static void *const GlobalLoggingQueueIdentityKey = (void *)&GlobalLoggingQueueIdentityKey;
-
-@interface OSSLoggerNode : NSObject
-{
-    // Direct accessors to be used only for performance
-    @public
-    id <OSSDDLogger> _logger;
-    OSSDDLogLevel _level;
-    dispatch_queue_t _loggerQueue;
-}
-
-@property (nonatomic, readonly) id <OSSDDLogger> logger;
-@property (nonatomic, readonly) OSSDDLogLevel level;
-@property (nonatomic, readonly) dispatch_queue_t loggerQueue;
-
-+ (OSSLoggerNode *)nodeWithLogger:(id <OSSDDLogger>)logger
-                     loggerQueue:(dispatch_queue_t)loggerQueue
-                           level:(OSSDDLogLevel)level;
-
-@end
-
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-#pragma mark -
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-@interface OSSDDLog ()
-
-// An array used to manage all the individual loggers.
-// The array is only modified on the loggingQueue/loggingThread.
-@property (nonatomic, strong) NSMutableArray *_loggers;
-
-@end
-
-@implementation OSSDDLog
-
-// All logging statements are added to the same queue to ensure FIFO operation.
-static dispatch_queue_t _loggingQueue;
-
-// Individual loggers are executed concurrently per log statement.
-// Each logger has it's own associated queue, and a dispatch group is used for synchrnoization.
-static dispatch_group_t _loggingGroup;
-
-// In order to prevent to queue from growing infinitely large,
-// a maximum size is enforced (DDLOG_MAX_QUEUE_SIZE).
-static dispatch_semaphore_t _queueSemaphore;
-
-// Minor optimization for uniprocessor machines
-static NSUInteger _numProcessors;
-
-/**
- *  Returns the singleton `DDLog`.
- *  The instance is used by `DDLog` class methods.
- *
- *  @return The singleton `DDLog`.
- */
-+ (instancetype)sharedInstance {
-    static id sharedInstance = nil;
-    
-    static dispatch_once_t onceToken;
-    dispatch_once(&onceToken, ^{
-        sharedInstance = [[self alloc] init];
-    });
-    
-    return sharedInstance;
-}
-
-/**
- * The runtime sends initialize to each class in a program exactly one time just before the class,
- * or any class that inherits from it, is sent its first message from within the program. (Thus the
- * method may never be invoked if the class is not used.) The runtime sends the initialize message to
- * classes in a thread-safe manner. Superclasses receive this message before their subclasses.
- *
- * This method may also be called directly (assumably by accident), hence the safety mechanism.
- **/
-+ (void)initialize {
-    static dispatch_once_t OSSDDLogOnceToken;
-    
-    dispatch_once(&OSSDDLogOnceToken, ^{
-        OSSNSLogDebug(@"OSSDDLog: Using grand central dispatch");
-        
-        _loggingQueue = dispatch_queue_create("oss.cocoa.lumberjack", NULL);
-        _loggingGroup = dispatch_group_create();
-        
-        void *nonNullValue = GlobalLoggingQueueIdentityKey; // Whatever, just not null
-        dispatch_queue_set_specific(_loggingQueue, GlobalLoggingQueueIdentityKey, nonNullValue, NULL);
-        
-        _queueSemaphore = dispatch_semaphore_create(OSSDDLOG_MAX_QUEUE_SIZE);
-        
-        // Figure out how many processors are available.
-        // This may be used later for an optimization on uniprocessor machines.
-        
-        _numProcessors = MAX([NSProcessInfo processInfo].processorCount, (NSUInteger) 1);
-        
-        OSSNSLogDebug(@"DDLog: numProcessors = %@", @(_numProcessors));
-    });
-}
-
-/**
- *  The `DDLog` initializer.
- *  Static variables are set only once.
- *
- *  @return An initialized `DDLog` instance.
- */
-- (id)init {
-    self = [super init];
-    
-    if (self) {
-        self._loggers = [[NSMutableArray alloc] initWithCapacity:4];
-        
-#if TARGET_OS_IOS
-        NSString *notificationName = @"UIApplicationWillTerminateNotification";
-#else
-        NSString *notificationName = nil;
-        
-        // On Command Line Tool apps AppKit may not be avaliable
-#ifdef NSAppKitVersionNumber10_0
-        
-        if (NSApp) {
-            notificationName = @"NSApplicationWillTerminateNotification";
-        }
-        
-#endif
-        
-        if (!notificationName) {
-            // If there is no NSApp -> we are running Command Line Tool app.
-            // In this case terminate notification wouldn't be fired, so we use workaround.
-            atexit_b (^{
-                [self applicationWillTerminate:nil];
-            });
-        }
-        
-#endif /* if TARGET_OS_IOS */
-        
-        if (notificationName) {
-            [[NSNotificationCenter defaultCenter] addObserver:self
-                                                     selector:@selector(applicationWillTerminate:)
-                                                         name:notificationName
-                                                       object:nil];
-        }
-    }
-    
-    return self;
-}
-
-/**
- * Provides access to the logging queue.
- **/
-+ (dispatch_queue_t)loggingQueue {
-    return _loggingQueue;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-#pragma mark Notifications
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-- (void)applicationWillTerminate:(NSNotification * __attribute__((unused)))notification {
-    [self flushLog];
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-#pragma mark Logger Management
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-+ (void)addLogger:(id <OSSDDLogger>)logger {
-    [self.sharedInstance addLogger:logger];
-}
-
-- (void)addLogger:(id <OSSDDLogger>)logger {
-    [self addLogger:logger withLevel:OSSDDLogLevelAll]; // DDLogLevelAll has all bits set
-}
-
-+ (void)addLogger:(id <OSSDDLogger>)logger withLevel:(OSSDDLogLevel)level {
-    [self.sharedInstance addLogger:logger withLevel:level];
-}
-
-- (void)addLogger:(id <OSSDDLogger>)logger withLevel:(OSSDDLogLevel)level {
-    if (!logger) {
-        return;
-    }
-    
-    dispatch_async(_loggingQueue, ^{ @autoreleasepool {
-        [self lt_addLogger:logger level:level];
-    } });
-}
-
-+ (void)removeLogger:(id <OSSDDLogger>)logger {
-    [self.sharedInstance removeLogger:logger];
-}
-
-- (void)removeLogger:(id <OSSDDLogger>)logger {
-    if (!logger) {
-        return;
-    }
-    
-    dispatch_async(_loggingQueue, ^{ @autoreleasepool {
-        [self lt_removeLogger:logger];
-    } });
-}
-
-+ (void)removeAllLoggers {
-    [self.sharedInstance removeAllLoggers];
-}
-
-- (void)removeAllLoggers {
-    dispatch_async(_loggingQueue, ^{ @autoreleasepool {
-        [self lt_removeAllLoggers];
-    } });
-}
-
-+ (NSArray<id<OSSDDLogger>> *)allLoggers {
-    return [self.sharedInstance allLoggers];
-}
-
-- (NSArray<id<OSSDDLogger>> *)allLoggers {
-    __block NSArray *theLoggers;
-    
-    dispatch_sync(_loggingQueue, ^{ @autoreleasepool {
-        theLoggers = [self lt_allLoggers];
-    } });
-    
-    return theLoggers;
-}
-
-+ (NSArray<OSSDDLoggerInformation *> *)allLoggersWithLevel {
-    return [self.sharedInstance allLoggersWithLevel];
-}
-
-- (NSArray<OSSDDLoggerInformation *> *)allLoggersWithLevel {
-    __block NSArray *theLoggersWithLevel;
-    
-    dispatch_sync(_loggingQueue, ^{ @autoreleasepool {
-        theLoggersWithLevel = [self lt_allLoggersWithLevel];
-    } });
-    
-    return theLoggersWithLevel;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-#pragma mark - Master Logging
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-- (void)queueLogMessage:(OSSDDLogMessage *)logMessage asynchronously:(BOOL)asyncFlag {
-    // We have a tricky situation here...
-    //
-    // In the common case, when the queueSize is below the maximumQueueSize,
-    // we want to simply enqueue the logMessage. And we want to do this as fast as possible,
-    // which means we don't want to block and we don't want to use any locks.
-    //
-    // However, if the queueSize gets too big, we want to block.
-    // But we have very strict requirements as to when we block, and how long we block.
-    //
-    // The following example should help illustrate our requirements:
-    //
-    // Imagine that the maximum queue size is configured to be 5,
-    // and that there are already 5 log messages queued.
-    // Let us call these 5 queued log messages A, B, C, D, and E. (A is next to be executed)
-    //
-    // Now if our thread issues a log statement (let us call the log message F),
-    // it should block before the message is added to the queue.
-    // Furthermore, it should be unblocked immediately after A has been unqueued.
-    //
-    // The requirements are strict in this manner so that we block only as long as necessary,
-    // and so that blocked threads are unblocked in the order in which they were blocked.
-    //
-    // Returning to our previous example, let us assume that log messages A through E are still queued.
-    // Our aforementioned thread is blocked attempting to queue log message F.
-    // Now assume we have another separate thread that attempts to issue log message G.
-    // It should block until log messages A and B have been unqueued.
-
-
-    // We are using a counting semaphore provided by GCD.
-    // The semaphore is initialized with our DDLOG_MAX_QUEUE_SIZE value.
-    // Everytime we want to queue a log message we decrement this value.
-    // If the resulting value is less than zero,
-    // the semaphore function waits in FIFO order for a signal to occur before returning.
-    //
-    // A dispatch semaphore is an efficient implementation of a traditional counting semaphore.
-    // Dispatch semaphores call down to the kernel only when the calling thread needs to be blocked.
-    // If the calling semaphore does not need to block, no kernel call is made.
-
-    dispatch_semaphore_wait(_queueSemaphore, DISPATCH_TIME_FOREVER);
-
-    // We've now sure we won't overflow the queue.
-    // It is time to queue our log message.
-
-    dispatch_block_t logBlock = ^{
-        @autoreleasepool {
-            [self lt_log:logMessage];
-        }
-    };
-
-    if (asyncFlag) {
-        dispatch_async(_loggingQueue, logBlock);
-    } else {
-        dispatch_sync(_loggingQueue, logBlock);
-    }
-}
-
-+ (void)log:(BOOL)asynchronous
-      level:(OSSDDLogLevel)level
-       flag:(OSSDDLogFlag)flag
-    context:(NSInteger)context
-       file:(const char *)file
-   function:(const char *)function
-       line:(NSUInteger)line
-        tag:(id)tag
-     format:(NSString *)format, ... {
-    va_list args;
-    
-    if (format) {
-        va_start(args, format);
-        
-        NSString *message = [[NSString alloc] initWithFormat:format arguments:args];
-        
-        va_end(args);
-        
-        va_start(args, format);
-        
-        [self log:asynchronous
-          message:message
-            level:level
-             flag:flag
-          context:context
-             file:file
-         function:function
-             line:line
-              tag:tag];
-        
-        va_end(args);
-    }
-}
-
-- (void)log:(BOOL)asynchronous
-      level:(OSSDDLogLevel)level
-       flag:(OSSDDLogFlag)flag
-    context:(NSInteger)context
-       file:(const char *)file
-   function:(const char *)function
-       line:(NSUInteger)line
-        tag:(id)tag
-     format:(NSString *)format, ... {
-    va_list args;
-    
-    if (format) {
-        va_start(args, format);
-        
-        NSString *message = [[NSString alloc] initWithFormat:format arguments:args];
-        
-        va_end(args);
-        
-        va_start(args, format);
-        
-        [self log:asynchronous
-          message:message
-            level:level
-             flag:flag
-          context:context
-             file:file
-         function:function
-             line:line
-              tag:tag];
-        
-        va_end(args);
-    }
-}
-
-+ (void)log:(BOOL)asynchronous
-      level:(OSSDDLogLevel)level
-       flag:(OSSDDLogFlag)flag
-    context:(NSInteger)context
-       file:(const char *)file
-   function:(const char *)function
-       line:(NSUInteger)line
-        tag:(id)tag
-     format:(NSString *)format
-       args:(va_list)args {
-    [self.sharedInstance log:asynchronous level:level flag:flag context:context file:file function:function line:line tag:tag format:format args:args];
-}
-
-- (void)log:(BOOL)asynchronous
-      level:(OSSDDLogLevel)level
-       flag:(OSSDDLogFlag)flag
-    context:(NSInteger)context
-       file:(const char *)file
-   function:(const char *)function
-       line:(NSUInteger)line
-        tag:(id)tag
-     format:(NSString *)format
-       args:(va_list)args {
-    if (format) {
-        NSString *message = [[NSString alloc] initWithFormat:format arguments:args];
-        [self log:asynchronous
-          message:message
-            level:level
-             flag:flag
-          context:context
-             file:file
-         function:function
-             line:line
-              tag:tag];
-    }
-}
-
-+ (void)log:(BOOL)asynchronous
-    message:(NSString *)message
-      level:(OSSDDLogLevel)level
-       flag:(OSSDDLogFlag)flag
-    context:(NSInteger)context
-       file:(const char *)file
-   function:(const char *)function
-       line:(NSUInteger)line
-        tag:(id)tag {
-    [self.sharedInstance log:asynchronous message:message level:level flag:flag context:context file:file function:function line:line tag:tag];
-}
-
-- (void)log:(BOOL)asynchronous
-    message:(NSString *)message
-      level:(OSSDDLogLevel)level
-       flag:(OSSDDLogFlag)flag
-    context:(NSInteger)context
-       file:(const char *)file
-   function:(const char *)function
-       line:(NSUInteger)line
-        tag:(id)tag {
-    OSSDDLogMessage *logMessage = [[OSSDDLogMessage alloc] initWithMessage:message
-                                                                     level:level
-                                                                      flag:flag
-                                                                   context:context
-                                                                      file:[NSString stringWithFormat:@"%s", file]
-                                                                  function:[NSString stringWithFormat:@"%s", function]
-                                                                      line:line
-                                                                       tag:tag
-                                                                   options:(OSSDDLogMessageOptions)0
-                                                                 timestamp:nil];
-    
-    [self queueLogMessage:logMessage asynchronously:asynchronous];
-}
-
-+ (void)log:(BOOL)asynchronous
-    message:(OSSDDLogMessage *)logMessage {
-    [self.sharedInstance log:asynchronous message:logMessage];
-}
-
-- (void)log:(BOOL)asynchronous
-    message:(OSSDDLogMessage *)logMessage {
-    [self queueLogMessage:logMessage asynchronously:asynchronous];
-}
-
-+ (void)flushLog {
-    [self.sharedInstance flushLog];
-}
-
-- (void)flushLog {
-    dispatch_sync(_loggingQueue, ^{ @autoreleasepool {
-        [self lt_flush];
-    } });
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-#pragma mark Logging Thread
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-- (void)lt_addLogger:(id <OSSDDLogger>)logger level:(OSSDDLogLevel)level {
-    // Add to loggers array.
-    // Need to create loggerQueue if loggerNode doesn't provide one.
-
-    for (OSSLoggerNode* node in self._loggers) {
-        if (node->_logger == logger
-            && node->_level == level) {
-            // Exactly same logger already added, exit
-            return;
-        }
-    }
-
-    NSAssert(dispatch_get_specific(GlobalLoggingQueueIdentityKey),
-             @"This method should only be run on the logging thread/queue");
-
-    dispatch_queue_t loggerQueue = NULL;
-
-    if ([logger respondsToSelector:@selector(loggerQueue)]) {
-        // Logger may be providing its own queue
-
-        loggerQueue = [logger loggerQueue];
-    }
-
-    if (loggerQueue == nil) {
-        // Automatically create queue for the logger.
-        // Use the logger name as the queue name if possible.
-
-        const char *loggerQueueName = NULL;
-
-        if ([logger respondsToSelector:@selector(loggerName)]) {
-            loggerQueueName = [[logger loggerName] UTF8String];
-        }
-
-        loggerQueue = dispatch_queue_create(loggerQueueName, NULL);
-    }
-
-    OSSLoggerNode *loggerNode = [OSSLoggerNode nodeWithLogger:logger loggerQueue:loggerQueue level:level];
-    [self._loggers addObject:loggerNode];
-
-    if ([logger respondsToSelector:@selector(didAddLoggerInQueue:)]) {
-        dispatch_async(loggerNode->_loggerQueue, ^{ @autoreleasepool {
-            [logger didAddLoggerInQueue:loggerNode->_loggerQueue];
-        } });
-    } else if ([logger respondsToSelector:@selector(didAddLogger)]) {
-        dispatch_async(loggerNode->_loggerQueue, ^{ @autoreleasepool {
-            [logger didAddLogger];
-        } });
-    }
-}
-
-- (void)lt_removeLogger:(id <OSSDDLogger>)logger {
-    // Find associated loggerNode in list of added loggers
-
-    NSAssert(dispatch_get_specific(GlobalLoggingQueueIdentityKey),
-             @"This method should only be run on the logging thread/queue");
-
-    OSSLoggerNode *loggerNode = nil;
-
-    for (OSSLoggerNode *node in self._loggers) {
-        if (node->_logger == logger) {
-            loggerNode = node;
-            break;
-        }
-    }
-    
-    if (loggerNode == nil) {
-        OSSNSLogDebug(@"DDLog: Request to remove logger which wasn't added");
-        return;
-    }
-    
-    // Notify logger
-    if ([logger respondsToSelector:@selector(willRemoveLogger)]) {
-        dispatch_async(loggerNode->_loggerQueue, ^{ @autoreleasepool {
-            [logger willRemoveLogger];
-        } });
-    }
-    
-    // Remove from loggers array
-    [self._loggers removeObject:loggerNode];
-}
-
-- (void)lt_removeAllLoggers {
-    NSAssert(dispatch_get_specific(GlobalLoggingQueueIdentityKey),
-             @"This method should only be run on the logging thread/queue");
-    
-    // Notify all loggers
-    for (OSSLoggerNode *loggerNode in self._loggers) {
-        if ([loggerNode->_logger respondsToSelector:@selector(willRemoveLogger)]) {
-            dispatch_async(loggerNode->_loggerQueue, ^{ @autoreleasepool {
-                [loggerNode->_logger willRemoveLogger];
-            } });
-        }
-    }
-    
-    // Remove all loggers from array
-
-    [self._loggers removeAllObjects];
-}
-
-- (NSArray *)lt_allLoggers {
-    NSAssert(dispatch_get_specific(GlobalLoggingQueueIdentityKey),
-             @"This method should only be run on the logging thread/queue");
-
-    NSMutableArray *theLoggers = [NSMutableArray new];
-
-    for (OSSLoggerNode *loggerNode in self._loggers) {
-        [theLoggers addObject:loggerNode->_logger];
-    }
-
-    return [theLoggers copy];
-}
-
-- (NSArray *)lt_allLoggersWithLevel {
-    NSAssert(dispatch_get_specific(GlobalLoggingQueueIdentityKey),
-             @"This method should only be run on the logging thread/queue");
-    
-    NSMutableArray *theLoggersWithLevel = [NSMutableArray new];
-    
-    for (OSSLoggerNode *loggerNode in self._loggers) {
-        [theLoggersWithLevel addObject:[OSSDDLoggerInformation informationWithLogger:loggerNode->_logger
-                                                                         andLevel:loggerNode->_level]];
-    }
-    
-    return [theLoggersWithLevel copy];
-}
-
-- (void)lt_log:(OSSDDLogMessage *)logMessage {
-    // Execute the given log message on each of our loggers.
-
-    NSAssert(dispatch_get_specific(GlobalLoggingQueueIdentityKey),
-             @"This method should only be run on the logging thread/queue");
-
-    if (_numProcessors > 1) {
-        // Execute each logger concurrently, each within its own queue.
-        // All blocks are added to same group.
-        // After each block has been queued, wait on group.
-        //
-        // The waiting ensures that a slow logger doesn't end up with a large queue of pending log messages.
-        // This would defeat the purpose of the efforts we made earlier to restrict the max queue size.
-
-        for (OSSLoggerNode *loggerNode in self._loggers) {
-            // skip the loggers that shouldn't write this message based on the log level
-
-            if (!(logMessage->_flag & loggerNode->_level)) {
-                continue;
-            }
-            
-            dispatch_group_async(_loggingGroup, loggerNode->_loggerQueue, ^{ @autoreleasepool {
-                [loggerNode->_logger logMessage:logMessage];
-            } });
-        }
-        
-        dispatch_group_wait(_loggingGroup, DISPATCH_TIME_FOREVER);
-    } else {
-        // Execute each logger serialy, each within its own queue.
-        
-        for (OSSLoggerNode *loggerNode in self._loggers) {
-            // skip the loggers that shouldn't write this message based on the log level
-
-            if (!(logMessage->_flag & loggerNode->_level)) {
-                continue;
-            }
-            
-            dispatch_sync(loggerNode->_loggerQueue, ^{ @autoreleasepool {
-                [loggerNode->_logger logMessage:logMessage];
-            } });
-        }
-    }
-
-    // If our queue got too big, there may be blocked threads waiting to add log messages to the queue.
-    // Since we've now dequeued an item from the log, we may need to unblock the next thread.
-
-    // We are using a counting semaphore provided by GCD.
-    // The semaphore is initialized with our DDLOG_MAX_QUEUE_SIZE value.
-    // When a log message is queued this value is decremented.
-    // When a log message is dequeued this value is incremented.
-    // If the value ever drops below zero,
-    // the queueing thread blocks and waits in FIFO order for us to signal it.
-    //
-    // A dispatch semaphore is an efficient implementation of a traditional counting semaphore.
-    // Dispatch semaphores call down to the kernel only when the calling thread needs to be blocked.
-    // If the calling semaphore does not need to block, no kernel call is made.
-
-    dispatch_semaphore_signal(_queueSemaphore);
-}
-
-- (void)lt_flush {
-    // All log statements issued before the flush method was invoked have now been executed.
-    //
-    // Now we need to propogate the flush request to any loggers that implement the flush method.
-    // This is designed for loggers that buffer IO.
-    
-    NSAssert(dispatch_get_specific(GlobalLoggingQueueIdentityKey),
-             @"This method should only be run on the logging thread/queue");
-    
-    for (OSSLoggerNode *loggerNode in self._loggers) {
-        if ([loggerNode->_logger respondsToSelector:@selector(flush)]) {
-            dispatch_group_async(_loggingGroup, loggerNode->_loggerQueue, ^{ @autoreleasepool {
-                [loggerNode->_logger flush];
-            } });
-        }
-    }
-    
-    dispatch_group_wait(_loggingGroup, DISPATCH_TIME_FOREVER);
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-#pragma mark Utilities
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-NSString * __nullable OSSDDExtractFileNameWithoutExtension(const char *filePath, BOOL copy) {
-    if (filePath == NULL) {
-        return nil;
-    }
-
-    char *lastSlash = NULL;
-    char *lastDot = NULL;
-
-    char *p = (char *)filePath;
-
-    while (*p != '\0') {
-        if (*p == '/') {
-            lastSlash = p;
-        } else if (*p == '.') {
-            lastDot = p;
-        }
-
-        p++;
-    }
-
-    char *subStr;
-    NSUInteger subLen;
-
-    if (lastSlash) {
-        if (lastDot) {
-            // lastSlash -> lastDot
-            subStr = lastSlash + 1;
-            subLen = (NSUInteger)(lastDot - subStr);
-        } else {
-            // lastSlash -> endOfString
-            subStr = lastSlash + 1;
-            subLen = (NSUInteger)(p - subStr);
-        }
-    } else {
-        if (lastDot) {
-            // startOfString -> lastDot
-            subStr = (char *)filePath;
-            subLen = (NSUInteger)(lastDot - subStr);
-        } else {
-            // startOfString -> endOfString
-            subStr = (char *)filePath;
-            subLen = (NSUInteger)(p - subStr);
-        }
-    }
-
-    if (copy) {
-        return [[NSString alloc] initWithBytes:subStr
-                                        length:subLen
-                                      encoding:NSUTF8StringEncoding];
-    } else {
-        // We can take advantage of the fact that __FILE__ is a string literal.
-        // Specifically, we don't need to waste time copying the string.
-        // We can just tell NSString to point to a range within the string literal.
-
-        return [[NSString alloc] initWithBytesNoCopy:subStr
-                                              length:subLen
-                                            encoding:NSUTF8StringEncoding
-                                        freeWhenDone:NO];
-    }
-}
-
-@end
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-#pragma mark -
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-@implementation OSSLoggerNode
-
-- (instancetype)initWithLogger:(id <OSSDDLogger>)logger loggerQueue:(dispatch_queue_t)loggerQueue level:(OSSDDLogLevel)level {
-    if ((self = [super init])) {
-        _logger = logger;
-
-        if (loggerQueue) {
-            _loggerQueue = loggerQueue;
-            #if !OS_OBJECT_USE_OBJC
-            dispatch_retain(loggerQueue);
-            #endif
-        }
-
-        _level = level;
-    }
-    return self;
-}
-
-+ (OSSLoggerNode *)nodeWithLogger:(id <OSSDDLogger>)logger loggerQueue:(dispatch_queue_t)loggerQueue level:(OSSDDLogLevel)level {
-    return [[OSSLoggerNode alloc] initWithLogger:logger loggerQueue:loggerQueue level:level];
-}
-
-- (void)dealloc {
-    #if !OS_OBJECT_USE_OBJC
-    if (_loggerQueue) {
-        dispatch_release(_loggerQueue);
-    }
-    #endif
-}
-
-@end
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-#pragma mark -
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-@implementation OSSDDLogMessage
-
-// Can we use DISPATCH_CURRENT_QUEUE_LABEL ?
-// Can we use dispatch_get_current_queue (without it crashing) ?
-//
-// a) Compiling against newer SDK's (iOS 7+/OS X 10.9+) where DISPATCH_CURRENT_QUEUE_LABEL is defined
-//    on a (iOS 7.0+/OS X 10.9+) runtime version
-//
-// b) Systems where dispatch_get_current_queue is not yet deprecated and won't crash (< iOS 6.0/OS X 10.9)
-//
-//    dispatch_get_current_queue(void);
-//      __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_6,__MAC_10_9,__IPHONE_4_0,__IPHONE_6_0)
-
-#if TARGET_OS_IOS
-
-// Compiling for iOS
-
-static BOOL _use_dispatch_current_queue_label;
-static BOOL _use_dispatch_get_current_queue;
-
-static void _dispatch_queue_label_init_once(void * __attribute__((unused)) context)
-{
-    _use_dispatch_current_queue_label = (UIDevice.currentDevice.systemVersion.floatValue >= 7.0f);
-    _use_dispatch_get_current_queue = (!_use_dispatch_current_queue_label && UIDevice.currentDevice.systemVersion.floatValue >= 6.1f);
-}
-
-static __inline__ __attribute__((__always_inline__)) void _dispatch_queue_label_init()
-{
-    static dispatch_once_t onceToken;
-    dispatch_once_f(&onceToken, NULL, _dispatch_queue_label_init_once);
-}
-
-  #define USE_DISPATCH_CURRENT_QUEUE_LABEL (_dispatch_queue_label_init(), _use_dispatch_current_queue_label)
-  #define USE_DISPATCH_GET_CURRENT_QUEUE   (_dispatch_queue_label_init(), _use_dispatch_get_current_queue)
-
-#elif TARGET_OS_WATCH || TARGET_OS_TV
-
-// Compiling for watchOS, tvOS
-
-  #define USE_DISPATCH_CURRENT_QUEUE_LABEL YES
-  #define USE_DISPATCH_GET_CURRENT_QUEUE   NO
-
-#else
-
-// Compiling for Mac OS X
-
-  #ifndef MAC_OS_X_VERSION_10_9
-    #define MAC_OS_X_VERSION_10_9            1090
-  #endif
-
-  #if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_9 // Mac OS X 10.9 or later required
-
-    #define USE_DISPATCH_CURRENT_QUEUE_LABEL YES
-    #define USE_DISPATCH_GET_CURRENT_QUEUE   NO
-
-  #else
-
-static BOOL _use_dispatch_current_queue_label;
-static BOOL _use_dispatch_get_current_queue;
-
-static void _dispatch_queue_label_init_once(void * __attribute__((unused)) context)
-{
-    _use_dispatch_current_queue_label = [NSTimer instancesRespondToSelector : @selector(tolerance)]; // OS X 10.9+
-    _use_dispatch_get_current_queue = !_use_dispatch_current_queue_label;                            // < OS X 10.9
-}
-
-static __inline__ __attribute__((__always_inline__)) void _dispatch_queue_label_init()
-{
-    static dispatch_once_t onceToken;
-    dispatch_once_f(&onceToken, NULL, _dispatch_queue_label_init_once);
-}
-
-    #define USE_DISPATCH_CURRENT_QUEUE_LABEL (_dispatch_queue_label_init(), _use_dispatch_current_queue_label)
-    #define USE_DISPATCH_GET_CURRENT_QUEUE   (_dispatch_queue_label_init(), _use_dispatch_get_current_queue)
-
-  #endif
-
-#endif /* if TARGET_OS_IOS */
-
-// Should we use pthread_threadid_np ?
-// With iOS 8+/OSX 10.10+ NSLog uses pthread_threadid_np instead of pthread_mach_thread_np
-
-#if TARGET_OS_IOS
-
-// Compiling for iOS
-
-  #ifndef kCFCoreFoundationVersionNumber_iOS_8_0
-    #define kCFCoreFoundationVersionNumber_iOS_8_0 1140.10
-  #endif
-
-  #define USE_PTHREAD_THREADID_NP                (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iOS_8_0)
-
-#elif TARGET_OS_WATCH || TARGET_OS_TV
-
-// Compiling for watchOS, tvOS
-
-  #define USE_PTHREAD_THREADID_NP                YES
-
-#else
-
-// Compiling for Mac OS X
-
-  #ifndef kCFCoreFoundationVersionNumber10_10
-    #define kCFCoreFoundationVersionNumber10_10    1151.16
-  #endif
-
-  #define USE_PTHREAD_THREADID_NP                (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber10_10)
-
-#endif /* if TARGET_OS_IOS */
-
-- (instancetype)init {
-    self = [super init];
-    return self;
-}
-
-- (instancetype)initWithMessage:(NSString *)message
-                          level:(OSSDDLogLevel)level
-                           flag:(OSSDDLogFlag)flag
-                        context:(NSInteger)context
-                           file:(NSString *)file
-                       function:(NSString *)function
-                           line:(NSUInteger)line
-                            tag:(id)tag
-                        options:(OSSDDLogMessageOptions)options
-                      timestamp:(NSDate *)timestamp {
-    if ((self = [super init])) {
-        BOOL copyMessage = (options & OSSDDLogMessageDontCopyMessage) == 0;
-        _message      = copyMessage ? [message copy] : message;
-        _level        = level;
-        _flag         = flag;
-        _context      = context;
-
-        BOOL copyFile = (options & OSSDDLogMessageCopyFile) != 0;
-        _file = copyFile ? [file copy] : file;
-
-        BOOL copyFunction = (options & OSSDDLogMessageCopyFunction) != 0;
-        _function = copyFunction ? [function copy] : function;
-
-        _line         = line;
-        _tag          = tag;
-        _options      = options;
-        _timestamp    = timestamp ?: [NSDate new];
-
-        if (USE_PTHREAD_THREADID_NP) {
-            __uint64_t tid;
-            pthread_threadid_np(NULL, &tid);
-            _threadID = [[NSString alloc] initWithFormat:@"%llu", tid];
-        } else {
-            _threadID = [[NSString alloc] initWithFormat:@"%x", pthread_mach_thread_np(pthread_self())];
-        }
-        _threadName   = NSThread.currentThread.name;
-
-        // Get the file name without extension
-        _fileName = [_file lastPathComponent];
-        NSUInteger dotLocation = [_fileName rangeOfString:@"." options:NSBackwardsSearch].location;
-        if (dotLocation != NSNotFound)
-        {
-            _fileName = [_fileName substringToIndex:dotLocation];
-        }
-        
-        // Try to get the current queue's label
-        if (USE_DISPATCH_CURRENT_QUEUE_LABEL) {
-            _queueLabel = [[NSString alloc] initWithFormat:@"%s", dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LABEL)];
-        } else if (USE_DISPATCH_GET_CURRENT_QUEUE) {
-            #pragma clang diagnostic push
-            #pragma clang diagnostic ignored "-Wdeprecated-declarations"
-            dispatch_queue_t currentQueue = dispatch_get_current_queue();
-            #pragma clang diagnostic pop
-            _queueLabel = [[NSString alloc] initWithFormat:@"%s", dispatch_queue_get_label(currentQueue)];
-        } else {
-            _queueLabel = @""; // iOS 6.x only
-        }
-    }
-    return self;
-}
-
-- (id)copyWithZone:(NSZone * __attribute__((unused)))zone {
-    OSSDDLogMessage *newMessage = [OSSDDLogMessage new];
-    
-    newMessage->_message = _message;
-    newMessage->_level = _level;
-    newMessage->_flag = _flag;
-    newMessage->_context = _context;
-    newMessage->_file = _file;
-    newMessage->_fileName = _fileName;
-    newMessage->_function = _function;
-    newMessage->_line = _line;
-    newMessage->_tag = _tag;
-    newMessage->_options = _options;
-    newMessage->_timestamp = _timestamp;
-    newMessage->_threadID = _threadID;
-    newMessage->_threadName = _threadName;
-    newMessage->_queueLabel = _queueLabel;
-
-    return newMessage;
-}
-
-@end
-
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-#pragma mark -
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-@implementation OSSDDAbstractLogger
-
-- (instancetype)init {
-    if ((self = [super init])) {
-        const char *loggerQueueName = NULL;
-
-        if ([self respondsToSelector:@selector(loggerName)]) {
-            loggerQueueName = [[self loggerName] UTF8String];
-        }
-
-        _loggerQueue = dispatch_queue_create(loggerQueueName, NULL);
-
-        // We're going to use dispatch_queue_set_specific() to "mark" our loggerQueue.
-        // Later we can use dispatch_get_specific() to determine if we're executing on our loggerQueue.
-        // The documentation states:
-        //
-        // > Keys are only compared as pointers and are never dereferenced.
-        // > Thus, you can use a pointer to a static variable for a specific subsystem or
-        // > any other value that allows you to identify the value uniquely.
-        // > Specifying a pointer to a string constant is not recommended.
-        //
-        // So we're going to use the very convenient key of "self",
-        // which also works when multiple logger classes extend this class, as each will have a different "self" key.
-        //
-        // This is used primarily for thread-safety assertions (via the isOnInternalLoggerQueue method below).
-
-        void *key = (__bridge void *)self;
-        void *nonNullValue = (__bridge void *)self;
-
-        dispatch_queue_set_specific(_loggerQueue, key, nonNullValue, NULL);
-    }
-
-    return self;
-}
-
-- (void)dealloc {
-    #if !OS_OBJECT_USE_OBJC
-
-    if (_loggerQueue) {
-        dispatch_release(_loggerQueue);
-    }
-
-    #endif
-}
-
-- (void)logMessage:(OSSDDLogMessage * __attribute__((unused)))logMessage {
-    // Override me
-}
-
-- (id <OSSDDLogFormatter>)logFormatter {
-    // This method must be thread safe and intuitive.
-    // Therefore if somebody executes the following code:
-    //
-    // [logger setLogFormatter:myFormatter];
-    // formatter = [logger logFormatter];
-    //
-    // They would expect formatter to equal myFormatter.
-    // This functionality must be ensured by the getter and setter method.
-    //
-    // The thread safety must not come at a cost to the performance of the logMessage method.
-    // This method is likely called sporadically, while the logMessage method is called repeatedly.
-    // This means, the implementation of this method:
-    // - Must NOT require the logMessage method to acquire a lock.
-    // - Must NOT require the logMessage method to access an atomic property (also a lock of sorts).
-    //
-    // Thread safety is ensured by executing access to the formatter variable on the loggerQueue.
-    // This is the same queue that the logMessage method operates on.
-    //
-    // Note: The last time I benchmarked the performance of direct access vs atomic property access,
-    // direct access was over twice as fast on the desktop and over 6 times as fast on the iPhone.
-    //
-    // Furthermore, consider the following code:
-    //
-    // DDLogVerbose(@"log msg 1");
-    // DDLogVerbose(@"log msg 2");
-    // [logger setFormatter:myFormatter];
-    // DDLogVerbose(@"log msg 3");
-    //
-    // Our intuitive requirement means that the new formatter will only apply to the 3rd log message.
-    // This must remain true even when using asynchronous logging.
-    // We must keep in mind the various queue's that are in play here:
-    //
-    // loggerQueue : Our own private internal queue that the logMessage method runs on.
-    //               Operations are added to this queue from the global loggingQueue.
-    //
-    // globalLoggingQueue : The queue that all log messages go through before they arrive in our loggerQueue.
-    //
-    // All log statements go through the serial gloabalLoggingQueue before they arrive at our loggerQueue.
-    // Thus this method also goes through the serial globalLoggingQueue to ensure intuitive operation.
-
-    // IMPORTANT NOTE:
-    //
-    // Methods within the DDLogger implementation MUST access the formatter ivar directly.
-    // This method is designed explicitly for external access.
-    //
-    // Using "self." syntax to go through this method will cause immediate deadlock.
-    // This is the intended result. Fix it by accessing the ivar directly.
-    // Great strides have been take to ensure this is safe to do. Plus it's MUCH faster.
-
-    NSAssert(![self isOnGlobalLoggingQueue], @"Core architecture requirement failure");
-    NSAssert(![self isOnInternalLoggerQueue], @"MUST access ivar directly, NOT via self.* syntax.");
-
-    dispatch_queue_t globalLoggingQueue = [OSSDDLog loggingQueue];
-
-    __block id <OSSDDLogFormatter> result;
-
-    dispatch_sync(globalLoggingQueue, ^{
-        dispatch_sync(_loggerQueue, ^{
-            result = _logFormatter;
-        });
-    });
-
-    return result;
-}
-
-- (void)setLogFormatter:(id <OSSDDLogFormatter>)logFormatter {
-    // The design of this method is documented extensively in the logFormatter message (above in code).
-
-    NSAssert(![self isOnGlobalLoggingQueue], @"Core architecture requirement failure");
-    NSAssert(![self isOnInternalLoggerQueue], @"MUST access ivar directly, NOT via self.* syntax.");
-
-    dispatch_block_t block = ^{
-        @autoreleasepool {
-            if (_logFormatter != logFormatter) {
-                if ([_logFormatter respondsToSelector:@selector(willRemoveFromLogger:)]) {
-                    [_logFormatter willRemoveFromLogger:self];
-                }
-
-                _logFormatter = logFormatter;
- 
-                if ([_logFormatter respondsToSelector:@selector(didAddToLogger:inQueue:)]) {
-                    [_logFormatter didAddToLogger:self inQueue:_loggerQueue];
-                } else if ([_logFormatter respondsToSelector:@selector(didAddToLogger:)]) {
-                    [_logFormatter didAddToLogger:self];
-                }
-            }
-        }
-    };
-
-    dispatch_queue_t globalLoggingQueue = [OSSDDLog loggingQueue];
-
-    dispatch_async(globalLoggingQueue, ^{
-        dispatch_async(_loggerQueue, block);
-    });
-}
-
-- (dispatch_queue_t)loggerQueue {
-    return _loggerQueue;
-}
-
-- (NSString *)loggerName {
-    return NSStringFromClass([self class]);
-}
-
-- (BOOL)isOnGlobalLoggingQueue {
-    return (dispatch_get_specific(GlobalLoggingQueueIdentityKey) != NULL);
-}
-
-- (BOOL)isOnInternalLoggerQueue {
-    void *key = (__bridge void *)self;
-
-    return (dispatch_get_specific(key) != NULL);
-}
-
-@end
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-#pragma mark -
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-@interface OSSDDLoggerInformation()
-{
-    // Direct accessors to be used only for performance
-    @public
-    id <OSSDDLogger> _logger;
-    OSSDDLogLevel _level;
-}
-
-@end
-
-@implementation OSSDDLoggerInformation
-
-- (instancetype)initWithLogger:(id <OSSDDLogger>)logger andLevel:(OSSDDLogLevel)level {
-    if ((self = [super init])) {
-        _logger = logger;
-        _level = level;
-    }
-    return self;
-}
-
-+ (OSSDDLoggerInformation *)informationWithLogger:(id <OSSDDLogger>)logger andLevel:(OSSDDLogLevel)level {
-    return [[OSSDDLoggerInformation alloc] initWithLogger:logger andLevel:level];
-}
-
-@end

+ 0 - 509
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSFileLog/OSSFileLogger.h

@@ -1,509 +0,0 @@
-// Software License Agreement (BSD License)
-//
-// Copyright (c) 2010-2016, Deusty, LLC
-// All rights reserved.
-//
-// Redistribution and use of this software in source and binary forms,
-// with or without modification, are permitted provided that the following conditions are met:
-//
-// * Redistributions of source code must retain the above copyright notice,
-//   this list of conditions and the following disclaimer.
-//
-// * Neither the name of Deusty nor the names of its contributors may be used
-//   to endorse or promote products derived from this software without specific
-//   prior written permission of Deusty, LLC.
-
-// Disable legacy macros
-#ifndef DD_LEGACY_MACROS
-    #define DD_LEGACY_MACROS 0
-#endif
-
-#import "OSSDDLog.h"
-
-@class OSSDDLogFileInfo;
-
-/**
- * This class provides a logger to write log statements to a file.
- **/
-
-
-// Default configuration and safety/sanity values.
-//
-// maximumFileSize         -> kDDDefaultLogMaxFileSize
-// rollingFrequency        -> kDDDefaultLogRollingFrequency
-// maximumNumberOfLogFiles -> kDDDefaultLogMaxNumLogFiles
-// logFilesDiskQuota       -> kDDDefaultLogFilesDiskQuota
-//
-// You should carefully consider the proper configuration values for your application.
-
-extern unsigned long long const osskDDDefaultLogMaxFileSize;
-extern NSTimeInterval     const osskDDDefaultLogRollingFrequency;
-extern NSUInteger         const osskDDDefaultLogMaxNumLogFiles;
-extern unsigned long long const osskDDDefaultLogFilesDiskQuota;
-
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-#pragma mark -
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-/**
- *  The LogFileManager protocol is designed to allow you to control all aspects of your log files.
- *
- *  The primary purpose of this is to allow you to do something with the log files after they have been rolled.
- *  Perhaps you want to compress them to save disk space.
- *  Perhaps you want to upload them to an FTP server.
- *  Perhaps you want to run some analytics on the file.
- *
- *  A default LogFileManager is, of course, provided.
- *  The default LogFileManager simply deletes old log files according to the maximumNumberOfLogFiles property.
- *
- *  This protocol provides various methods to fetch the list of log files.
- *
- *  There are two variants: sorted and unsorted.
- *  If sorting is not necessary, the unsorted variant is obviously faster.
- *  The sorted variant will return an array sorted by when the log files were created,
- *  with the most recently created log file at index 0, and the oldest log file at the end of the array.
- *
- *  You can fetch only the log file paths (full path including name), log file names (name only),
- *  or an array of `DDLogFileInfo` objects.
- *  The `DDLogFileInfo` class is documented below, and provides a handy wrapper that
- *  gives you easy access to various file attributes such as the creation date or the file size.
- */
-@protocol OSSDDLogFileManager <NSObject>
-@required
-
-// Public properties
-
-/**
- * The maximum number of archived log files to keep on disk.
- * For example, if this property is set to 3,
- * then the LogFileManager will only keep 3 archived log files (plus the current active log file) on disk.
- * Once the active log file is rolled/archived, then the oldest of the existing 3 rolled/archived log files is deleted.
- *
- * You may optionally disable this option by setting it to zero.
- **/
-@property (readwrite, assign, atomic) NSUInteger maximumNumberOfLogFiles;
-
-/**
- * The maximum space that logs can take. On rolling logfile all old logfiles that exceed logFilesDiskQuota will
- * be deleted.
- *
- * You may optionally disable this option by setting it to zero.
- **/
-@property (readwrite, assign, atomic) unsigned long long logFilesDiskQuota;
-
-// Public methods
-
-/**
- *  Returns the logs directory (path)
- */
-@property (nonatomic, readonly, copy) NSString *logsDirectory;
-
-/**
- * Returns an array of `NSString` objects,
- * each of which is the filePath to an existing log file on disk.
- **/
-@property (nonatomic, readonly, strong) NSArray<NSString *> *unsortedLogFilePaths;
-
-/**
- * Returns an array of `NSString` objects,
- * each of which is the fileName of an existing log file on disk.
- **/
-@property (nonatomic, readonly, strong) NSArray<NSString *> *unsortedLogFileNames;
-
-/**
- * Returns an array of `DDLogFileInfo` objects,
- * each representing an existing log file on disk,
- * and containing important information about the log file such as it's modification date and size.
- **/
-@property (nonatomic, readonly, strong) NSArray<OSSDDLogFileInfo *> *unsortedLogFileInfos;
-
-/**
- * Just like the `unsortedLogFilePaths` method, but sorts the array.
- * The items in the array are sorted by creation date.
- * The first item in the array will be the most recently created log file.
- **/
-@property (nonatomic, readonly, strong) NSArray<NSString *> *sortedLogFilePaths;
-
-/**
- * Just like the `unsortedLogFileNames` method, but sorts the array.
- * The items in the array are sorted by creation date.
- * The first item in the array will be the most recently created log file.
- **/
-@property (nonatomic, readonly, strong) NSArray<NSString *> *sortedLogFileNames;
-
-/**
- * Just like the `unsortedLogFileInfos` method, but sorts the array.
- * The items in the array are sorted by creation date.
- * The first item in the array will be the most recently created log file.
- **/
-@property (nonatomic, readonly, strong) NSArray<OSSDDLogFileInfo *> *sortedLogFileInfos;
-
-// Private methods (only to be used by DDFileLogger)
-
-/**
- * Generates a new unique log file path, and creates the corresponding log file.
- **/
-- (NSString *)createNewLogFile;
-
-@optional
-
-// Notifications from DDFileLogger
-
-/**
- *  Called when a log file was archieved
- */
-- (void)didArchiveLogFile:(NSString *)logFilePath NS_SWIFT_NAME(didArchiveLogFile(atPath:));
-
-/**
- *  Called when the roll action was executed and the log was archieved
- */
-- (void)didRollAndArchiveLogFile:(NSString *)logFilePath NS_SWIFT_NAME(didRollAndArchiveLogFile(atPath:));
-
-@end
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-#pragma mark -
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-/**
- * Default log file manager.
- *
- * All log files are placed inside the logsDirectory.
- * If a specific logsDirectory isn't specified, the default directory is used.
- * On Mac, this is in `~/Library/Logs/<Application Name>`.
- * On iPhone, this is in `~/Library/Caches/Logs`.
- *
- * Log files are named `"<bundle identifier> <date> <time>.log"`
- * Example: `com.organization.myapp 2013-12-03 17-14.log`
- *
- * Archived log files are automatically deleted according to the `maximumNumberOfLogFiles` property.
- **/
-@interface OSSDDLogFileManagerDefault : NSObject <OSSDDLogFileManager>
-
-/**
- *  Default initializer
- */
-- (instancetype)init;
-
-/**
- *  Designated initialized, requires the logs directory
- */
-- (instancetype)initWithLogsDirectory:(NSString *)logsDirectory NS_DESIGNATED_INITIALIZER;
-
-#if TARGET_OS_IPHONE
-/*
- * Calling this constructor you can override the default "automagically" chosen NSFileProtection level.
- * Useful if you are writing a command line utility / CydiaSubstrate addon for iOS that has no NSBundle
- * or like SpringBoard no BackgroundModes key in the NSBundle:
- *    iPhone:~ root# cycript -p SpringBoard
- *    cy# [NSBundle mainBundle]
- *    #"NSBundle </System/Library/CoreServices/SpringBoard.app> (loaded)"
- *    cy# [[NSBundle mainBundle] objectForInfoDictionaryKey:@"UIBackgroundModes"];
- *    null
- *    cy#
- **/
-- (instancetype)initWithLogsDirectory:(NSString *)logsDirectory defaultFileProtectionLevel:(NSFileProtectionType)fileProtectionLevel;
-#endif
-
-/*
- * Methods to override.
- *
- * Log files are named `"<bundle identifier> <date> <time>.log"`
- * Example: `com.organization.myapp 2013-12-03 17-14.log`
- *
- * If you wish to change default filename, you can override following two methods.
- * - `newLogFileName` method would be called on new logfile creation.
- * - `isLogFile:` method would be called to filter logfiles from all other files in logsDirectory.
- *   You have to parse given filename and return YES if it is logFile.
- *
- * **NOTE**
- * `newLogFileName` returns filename. If appropriate file already exists, number would be added
- * to filename before extension. You have to handle this case in isLogFile: method.
- *
- * Example:
- * - newLogFileName returns `"com.organization.myapp 2013-12-03.log"`,
- *   file `"com.organization.myapp 2013-12-03.log"` would be created.
- * - after some time `"com.organization.myapp 2013-12-03.log"` is archived
- * - newLogFileName again returns `"com.organization.myapp 2013-12-03.log"`,
- *   file `"com.organization.myapp 2013-12-03 2.log"` would be created.
- * - after some time `"com.organization.myapp 2013-12-03 1.log"` is archived
- * - newLogFileName again returns `"com.organization.myapp 2013-12-03.log"`,
- *   file `"com.organization.myapp 2013-12-03 3.log"` would be created.
- **/
-
-/**
- * Generates log file name with default format `"<bundle identifier> <date> <time>.log"`
- * Example: `MobileSafari 2013-12-03 17-14.log`
- *
- * You can change it by overriding `newLogFileName` and `isLogFile:` methods.
- **/
-@property (readonly, copy) NSString *newLogFileName;
-
-/**
- * Default log file name is `"<bundle identifier> <date> <time>.log"`.
- * Example: `MobileSafari 2013-12-03 17-14.log`
- *
- * You can change it by overriding `newLogFileName` and `isLogFile:` methods.
- **/
-- (BOOL)isLogFile:(NSString *)fileName NS_SWIFT_NAME(isLogFile(withName:));
-
-/* Inherited from DDLogFileManager protocol:
-
-   @property (readwrite, assign, atomic) NSUInteger maximumNumberOfLogFiles;
-   @property (readwrite, assign, atomic) NSUInteger logFilesDiskQuota;
-
-   - (NSString *)logsDirectory;
-
-   - (NSArray *)unsortedLogFilePaths;
-   - (NSArray *)unsortedLogFileNames;
-   - (NSArray *)unsortedLogFileInfos;
-
-   - (NSArray *)sortedLogFilePaths;
-   - (NSArray *)sortedLogFileNames;
-   - (NSArray *)sortedLogFileInfos;
-
- */
-
-@end
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-#pragma mark -
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-/**
- * Most users will want file log messages to be prepended with the date and time.
- * Rather than forcing the majority of users to write their own formatter,
- * we will supply a logical default formatter.
- * Users can easily replace this formatter with their own by invoking the `setLogFormatter:` method.
- * It can also be removed by calling `setLogFormatter:`, and passing a nil parameter.
- *
- * In addition to the convenience of having a logical default formatter,
- * it will also provide a template that makes it easy for developers to copy and change.
- **/
-@interface OSSDDLogFileFormatterDefault : NSObject <OSSDDLogFormatter>
-
-/**
- *  Default initializer
- */
-- (instancetype)init;
-
-/**
- *  Designated initializer, requires a date formatter
- */
-- (instancetype)initWithDateFormatter:(NSDateFormatter *)dateFormatter NS_DESIGNATED_INITIALIZER;
-
-@end
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-#pragma mark -
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-/**
- *  The standard implementation for a file logger
- */
-@interface OSSDDFileLogger : OSSDDAbstractLogger <OSSDDLogger> {
-	OSSDDLogFileInfo *_currentLogFileInfo;
-}
-
-/**
- *  Default initializer
- */
-- (instancetype)init;
-
-/**
- *  Designated initializer, requires a `DDLogFileManager` instance
- */
-- (instancetype)initWithLogFileManager:(id <OSSDDLogFileManager>)logFileManager NS_DESIGNATED_INITIALIZER;
-
-/**
- *  Called when the logger is about to write message. Call super before your implementation.
- */
-- (void)willLogMessage NS_REQUIRES_SUPER;
-
-/**
- *  Called when the logger wrote message. Call super after your implementation.
- */
-- (void)didLogMessage NS_REQUIRES_SUPER;
-
-/**
- *  Called when the logger checks archive or not current log file. 
- *  Override this method to exdend standart behavior. By default returns NO.
- */
-- (BOOL)shouldArchiveRecentLogFileInfo:(OSSDDLogFileInfo *)recentLogFileInfo;
-
-/**
- * Log File Rolling:
- *
- * `maximumFileSize`:
- *   The approximate maximum size (in bytes) to allow log files to grow.
- *   If a log file is larger than this value after a log statement is appended,
- *   then the log file is rolled.
- *
- * `rollingFrequency`
- *   How often to roll the log file.
- *   The frequency is given as an `NSTimeInterval`, which is a double that specifies the interval in seconds.
- *   Once the log file gets to be this old, it is rolled.
- *
- * `doNotReuseLogFiles`
- *   When set, will always create a new log file at application launch.
- *
- * Both the `maximumFileSize` and the `rollingFrequency` are used to manage rolling.
- * Whichever occurs first will cause the log file to be rolled.
- *
- * For example:
- * The `rollingFrequency` is 24 hours,
- * but the log file surpasses the `maximumFileSize` after only 20 hours.
- * The log file will be rolled at that 20 hour mark.
- * A new log file will be created, and the 24 hour timer will be restarted.
- *
- * You may optionally disable rolling due to filesize by setting `maximumFileSize` to zero.
- * If you do so, rolling is based solely on `rollingFrequency`.
- *
- * You may optionally disable rolling due to time by setting `rollingFrequency` to zero (or any non-positive number).
- * If you do so, rolling is based solely on `maximumFileSize`.
- *
- * If you disable both `maximumFileSize` and `rollingFrequency`, then the log file won't ever be rolled.
- * This is strongly discouraged.
- **/
-@property (readwrite, assign) unsigned long long maximumFileSize;
-
-/**
- *  See description for `maximumFileSize`
- */
-@property (readwrite, assign) NSTimeInterval rollingFrequency;
-
-/**
- *  See description for `maximumFileSize`
- */
-@property (readwrite, assign, atomic) BOOL doNotReuseLogFiles;
-
-/**
- * The DDLogFileManager instance can be used to retrieve the list of log files,
- * and configure the maximum number of archived log files to keep.
- *
- * @see DDLogFileManager.maximumNumberOfLogFiles
- **/
-@property (strong, nonatomic, readonly) id <OSSDDLogFileManager> logFileManager;
-
-/**
- * When using a custom formatter you can set the `logMessage` method not to append
- * `\n` character after each output. This allows for some greater flexibility with
- * custom formatters. Default value is YES.
- **/
-@property (nonatomic, readwrite, assign) BOOL automaticallyAppendNewlineForCustomFormatters;
-
-/**
- *  You can optionally force the current log file to be rolled with this method.
- *  CompletionBlock will be called on main queue.
- */
-- (void)rollLogFileWithCompletionBlock:(void (^)(void))completionBlock NS_SWIFT_NAME(rollLogFile(withCompletion:));
-
-/**
- *  Method is deprecated.
- *  @deprecated Use `rollLogFileWithCompletionBlock:` method instead.
- */
-- (void)rollLogFile __attribute((deprecated));
-
-// Inherited from DDAbstractLogger
-
-// - (id <DDLogFormatter>)logFormatter;
-// - (void)setLogFormatter:(id <DDLogFormatter>)formatter;
-
-/**
- * Returns the log file that should be used.
- * If there is an existing log file that is suitable,
- * within the constraints of `maximumFileSize` and `rollingFrequency`, then it is returned.
- *
- * Otherwise a new file is created and returned.
- **/
-@property (nonatomic, readonly, strong) OSSDDLogFileInfo *currentLogFileInfo;
-
-@end
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-#pragma mark -
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-/**
- * `DDLogFileInfo` is a simple class that provides access to various file attributes.
- * It provides good performance as it only fetches the information if requested,
- * and it caches the information to prevent duplicate fetches.
- *
- * It was designed to provide quick snapshots of the current state of log files,
- * and to help sort log files in an array.
- *
- * This class does not monitor the files, or update it's cached attribute values if the file changes on disk.
- * This is not what the class was designed for.
- *
- * If you absolutely must get updated values,
- * you can invoke the reset method which will clear the cache.
- **/
-@interface OSSDDLogFileInfo : NSObject
-
-@property (strong, nonatomic, readonly) NSString *filePath;
-@property (strong, nonatomic, readonly) NSString *fileName;
-
-#if FOUNDATION_SWIFT_SDK_EPOCH_AT_LEAST(8)
-@property (strong, nonatomic, readonly) NSDictionary<NSFileAttributeKey, id> *fileAttributes;
-#else
-@property (strong, nonatomic, readonly) NSDictionary<NSString *, id> *fileAttributes;
-#endif
-
-@property (strong, nonatomic, readonly) NSDate *creationDate;
-@property (strong, nonatomic, readonly) NSDate *modificationDate;
-
-@property (nonatomic, readonly) unsigned long long fileSize;
-
-@property (nonatomic, readonly) NSTimeInterval age;
-
-@property (nonatomic, readwrite) BOOL isArchived;
-
-+ (instancetype)logFileWithPath:(NSString *)filePath NS_SWIFT_UNAVAILABLE("Use init(filePath:)");
-
-- (instancetype)init NS_UNAVAILABLE;
-- (instancetype)initWithFilePath:(NSString *)filePath NS_DESIGNATED_INITIALIZER;
-
-- (void)reset;
-- (void)renameFile:(NSString *)newFileName NS_SWIFT_NAME(renameFile(to:));
-
-#if TARGET_IPHONE_SIMULATOR
-
-// So here's the situation.
-// Extended attributes are perfect for what we're trying to do here (marking files as archived).
-// This is exactly what extended attributes were designed for.
-//
-// But Apple screws us over on the simulator.
-// Everytime you build-and-go, they copy the application into a new folder on the hard drive,
-// and as part of the process they strip extended attributes from our log files.
-// Normally, a copy of a file preserves extended attributes.
-// So obviously Apple has gone to great lengths to piss us off.
-//
-// Thus we use a slightly different tactic for marking log files as archived in the simulator.
-// That way it "just works" and there's no confusion when testing.
-//
-// The difference in method names is indicative of the difference in functionality.
-// On the simulator we add an attribute by appending a filename extension.
-//
-// For example:
-// "mylog.txt" -> "mylog.archived.txt"
-// "mylog"     -> "mylog.archived"
-
-- (BOOL)hasExtensionAttributeWithName:(NSString *)attrName;
-
-- (void)addExtensionAttributeWithName:(NSString *)attrName;
-- (void)removeExtensionAttributeWithName:(NSString *)attrName;
-
-#else /* if TARGET_IPHONE_SIMULATOR */
-
-// Normal use of extended attributes used everywhere else,
-// such as on Macs and on iPhone devices.
-
-- (BOOL)hasExtendedAttributeWithName:(NSString *)attrName;
-
-- (void)addExtendedAttributeWithName:(NSString *)attrName;
-- (void)removeExtendedAttributeWithName:(NSString *)attrName;
-
-#endif /* if TARGET_IPHONE_SIMULATOR */
-
-@end

+ 0 - 1460
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSFileLog/OSSFileLogger.m

@@ -1,1460 +0,0 @@
-// Software License Agreement (BSD License)
-//
-// Copyright (c) 2010-2016, Deusty, LLC
-// All rights reserved.
-//
-// Redistribution and use of this software in source and binary forms,
-// with or without modification, are permitted provided that the following conditions are met:
-//
-// * Redistributions of source code must retain the above copyright notice,
-//   this list of conditions and the following disclaimer.
-//
-// * Neither the name of Deusty nor the names of its contributors may be used
-//   to endorse or promote products derived from this software without specific
-//   prior written permission of Deusty, LLC.
-
-#import "OSSFileLogger.h"
-
-#import <unistd.h>
-#import <sys/attr.h>
-#import <sys/xattr.h>
-#import <libkern/OSAtomic.h>
-
-#if !__has_feature(objc_arc)
-#error This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
-#endif
-
-// We probably shouldn't be using DDLog() statements within the DDLog implementation.
-// But we still want to leave our log statements for any future debugging,
-// and to allow other developers to trace the implementation (which is a great learning tool).
-//
-// So we use primitive logging macros around NSLog.
-// We maintain the NS prefix on the macros to be explicit about the fact that we're using NSLog.
-
-#ifndef OSSDD_NSLOG_LEVEL
-    #define OSSDD_NSLOG_LEVEL 2
-#endif
-
-#define OSSNSLogError(frmt, ...)    do{ if(OSSDD_NSLOG_LEVEL >= 1) NSLog((frmt), ##__VA_ARGS__); } while(0)
-#define OSSNSLogWarn(frmt, ...)     do{ if(OSSDD_NSLOG_LEVEL >= 2) NSLog((frmt), ##__VA_ARGS__); } while(0)
-#define OSSNSLogInfo(frmt, ...)     do{ if(OSSDD_NSLOG_LEVEL >= 3) NSLog((frmt), ##__VA_ARGS__); } while(0)
-#define OSSNSLogDebug(frmt, ...)    do{ if(OSSDD_NSLOG_LEVEL >= 4) NSLog((frmt), ##__VA_ARGS__); } while(0)
-#define OSSNSLogVerbose(frmt, ...)  do{ if(OSSDD_NSLOG_LEVEL >= 5) NSLog((frmt), ##__VA_ARGS__); } while(0)
-
-
-#if TARGET_OS_IPHONE
-BOOL ossdoesAppRunInBackground(void);
-#endif
-
-unsigned long long const osskDDDefaultLogMaxFileSize      = 5 * 1024 * 1024;      // 5 MB
-NSTimeInterval     const osskDDDefaultLogRollingFrequency = 60 * 60 * 24;     // 24 Hours
-NSUInteger         const osskDDDefaultLogMaxNumLogFiles   = 1;                // 1 Files
-unsigned long long const osskDDDefaultLogFilesDiskQuota   = 5 * 1024 * 1024; // 5 MB
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-#pragma mark -
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-@interface OSSDDLogFileManagerDefault () {
-    NSUInteger _maximumNumberOfLogFiles;
-    unsigned long long _logFilesDiskQuota;
-    NSString *_logsDirectory;
-#if TARGET_OS_IPHONE
-    NSFileProtectionType _defaultFileProtectionLevel;
-#endif
-}
-
-- (void)deleteOldLogFiles;
-- (NSString *)defaultLogsDirectory;
-
-@end
-
-@implementation OSSDDLogFileManagerDefault
-
-@synthesize maximumNumberOfLogFiles = _maximumNumberOfLogFiles;
-@synthesize logFilesDiskQuota = _logFilesDiskQuota;
-
-
-- (instancetype)init {
-    return [self initWithLogsDirectory:nil];
-}
-
-- (instancetype)initWithLogsDirectory:(NSString *)aLogsDirectory {
-    if ((self = [super init])) {
-        _maximumNumberOfLogFiles = osskDDDefaultLogMaxNumLogFiles;
-        _logFilesDiskQuota = osskDDDefaultLogFilesDiskQuota;
-
-        if (aLogsDirectory) {
-            _logsDirectory = [aLogsDirectory copy];
-        } else {
-            _logsDirectory = [[self defaultLogsDirectory] copy];
-        }
-
-        NSKeyValueObservingOptions kvoOptions = NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew;
-
-        [self addObserver:self forKeyPath:NSStringFromSelector(@selector(maximumNumberOfLogFiles)) options:kvoOptions context:nil];
-        [self addObserver:self forKeyPath:NSStringFromSelector(@selector(logFilesDiskQuota)) options:kvoOptions context:nil];
-
-        OSSNSLogVerbose(@"DDFileLogManagerDefault: logsDirectory:\n%@", [self logsDirectory]);
-        OSSNSLogVerbose(@"DDFileLogManagerDefault: sortedLogFileNames:\n%@", [self sortedLogFileNames]);
-    }
-
-    return self;
-}
-
-+ (BOOL)automaticallyNotifiesObserversForKey:(NSString *)theKey
-{
-    BOOL automatic = NO;
-    if ([theKey isEqualToString:@"maximumNumberOfLogFiles"] || [theKey isEqualToString:@"logFilesDiskQuota"]) {
-        automatic = NO;
-    } else {
-        automatic = [super automaticallyNotifiesObserversForKey:theKey];
-    }
-    
-    return automatic;
-}
-
-#if TARGET_OS_IPHONE
-- (instancetype)initWithLogsDirectory:(NSString *)logsDirectory defaultFileProtectionLevel:(NSFileProtectionType)fileProtectionLevel {
-    if ((self = [self initWithLogsDirectory:logsDirectory])) {
-        if ([fileProtectionLevel isEqualToString:NSFileProtectionNone] ||
-            [fileProtectionLevel isEqualToString:NSFileProtectionComplete] ||
-            [fileProtectionLevel isEqualToString:NSFileProtectionCompleteUnlessOpen] ||
-            [fileProtectionLevel isEqualToString:NSFileProtectionCompleteUntilFirstUserAuthentication]) {
-            _defaultFileProtectionLevel = fileProtectionLevel;
-        }
-    }
-
-    return self;
-}
-
-#endif
-
-- (void)dealloc {
-    // try-catch because the observer might be removed or never added. In this case, removeObserver throws and exception
-    @try {
-        [self removeObserver:self forKeyPath:NSStringFromSelector(@selector(maximumNumberOfLogFiles))];
-        [self removeObserver:self forKeyPath:NSStringFromSelector(@selector(logFilesDiskQuota))];
-    } @catch (NSException *exception) {
-    }
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-#pragma mark Configuration
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-- (void)observeValueForKeyPath:(NSString *)keyPath
-                      ofObject:(id)object
-                        change:(NSDictionary *)change
-                       context:(void *)context {
-    NSNumber *old = change[NSKeyValueChangeOldKey];
-    NSNumber *new = change[NSKeyValueChangeNewKey];
-
-    if ([old isEqual:new]) {
-        // No change in value - don't bother with any processing.
-        return;
-    }
-
-    if ([keyPath isEqualToString:NSStringFromSelector(@selector(maximumNumberOfLogFiles))] ||
-        [keyPath isEqualToString:NSStringFromSelector(@selector(logFilesDiskQuota))]) {
-        OSSNSLogInfo(@"DDFileLogManagerDefault: Responding to configuration change: %@", keyPath);
-
-        dispatch_async([OSSDDLog loggingQueue], ^{ @autoreleasepool {
-                                                    [self deleteOldLogFiles];
-                                                } });
-    }
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-#pragma mark File Deleting
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-/**
- * Deletes archived log files that exceed the maximumNumberOfLogFiles or logFilesDiskQuota configuration values.
- **/
-- (void)deleteOldLogFiles {
-    OSSNSLogVerbose(@"OSSDDLogFileManagerDefault: deleteOldLogFiles");
-
-    NSArray *sortedLogFileInfos = [self sortedLogFileInfos];
-
-    NSUInteger firstIndexToDelete = NSNotFound;
-
-    const unsigned long long diskQuota = self.logFilesDiskQuota;
-    const NSUInteger maxNumLogFiles = self.maximumNumberOfLogFiles;
-
-    if (diskQuota) {
-        unsigned long long used = 0;
-
-        for (NSUInteger i = 0; i < sortedLogFileInfos.count; i++) {
-            OSSDDLogFileInfo *info = sortedLogFileInfos[i];
-            used += info.fileSize;
-
-            if (used > diskQuota) {
-                firstIndexToDelete = i;
-                break;
-            }
-        }
-    }
-
-    if (maxNumLogFiles) {
-        if (firstIndexToDelete == NSNotFound) {
-            firstIndexToDelete = maxNumLogFiles;
-        } else {
-            firstIndexToDelete = MIN(firstIndexToDelete, maxNumLogFiles);
-        }
-    }
-
-    if (firstIndexToDelete == 0) {
-        // Do we consider the first file?
-        // We are only supposed to be deleting archived files.
-        // In most cases, the first file is likely the log file that is currently being written to.
-        // So in most cases, we do not want to consider this file for deletion.
-
-        if (sortedLogFileInfos.count > 0) {
-            OSSDDLogFileInfo *logFileInfo = sortedLogFileInfos[0];
-
-            if (!logFileInfo.isArchived) {
-                // Don't delete active file.
-                ++firstIndexToDelete;
-            }
-        }
-    }
-
-    if (firstIndexToDelete != NSNotFound) {
-        // removing all logfiles starting with firstIndexToDelete
-
-        for (NSUInteger i = firstIndexToDelete; i < sortedLogFileInfos.count; i++) {
-            OSSDDLogFileInfo *logFileInfo = sortedLogFileInfos[i];
-
-            OSSNSLogInfo(@"DDLogFileManagerDefault: Deleting file: %@", logFileInfo.fileName);
-
-            [[NSFileManager defaultManager] removeItemAtPath:logFileInfo.filePath error:nil];
-        }
-    }
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-#pragma mark Log Files
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-/**
- * Returns the path to the default logs directory.
- * If the logs directory doesn't exist, this method automatically creates it.
- **/
-- (NSString *)defaultLogsDirectory {
-    NSString *logsDir;
-#if TARGET_OS_IOS
-    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
-    logsDir = [paths[0] stringByAppendingPathComponent:@"OSSLogs"];
-#elif TARGET_OS_OSX
-    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES);
-    NSString *suffixPath = [NSString stringWithFormat:@"Logs/%@/OSSLogs",[self applicationName]];
-    logsDir = [paths[0] stringByAppendingPathComponent:suffixPath];
-#endif
-    
-    return logsDir;
-}
-
-- (NSString *)logsDirectory {
-    // We could do this check once, during initalization, and not bother again.
-    // But this way the code continues to work if the directory gets deleted while the code is running.
-
-    if (![[NSFileManager defaultManager] fileExistsAtPath:_logsDirectory]) {
-        NSError *err = nil;
-
-        if (![[NSFileManager defaultManager] createDirectoryAtPath:_logsDirectory
-                                       withIntermediateDirectories:YES
-                                                        attributes:nil
-                                                             error:&err]) {
-            OSSNSLogError(@"DDFileLogManagerDefault: Error creating logsDirectory: %@", err);
-        }
-    }
-
-    return _logsDirectory;
-}
-
-- (BOOL)isLogFile:(NSString *)fileName {
-    NSString *appName = [self applicationName];
-
-    BOOL hasProperPrefix = [fileName hasPrefix:appName];
-    BOOL hasProperSuffix = [fileName hasSuffix:@".log"];
-    
-    return (hasProperPrefix && hasProperSuffix);
-}
-
-//if you change formater , then  change sortedLogFileInfos method also accordingly
-- (NSDateFormatter *)logFileDateFormatter {
-    NSMutableDictionary *dictionary = [[NSThread currentThread]
-                                       threadDictionary];
-    NSString *dateFormat = @"yyyy'-'MM'-'dd'--'HH'-'mm'-'ss'-'SSS'";
-    NSString *key = [NSString stringWithFormat:@"logFileDateFormatter.%@", dateFormat];
-    NSDateFormatter *dateFormatter = dictionary[key];
-
-    if (dateFormatter == nil) {
-        dateFormatter = [[NSDateFormatter alloc] init];
-        [dateFormatter setLocale:[NSLocale localeWithLocaleIdentifier:@"en_US_POSIX"]];
-        [dateFormatter setDateFormat:dateFormat];
-        [dateFormatter setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]];
-        dictionary[key] = dateFormatter;
-    }
-
-    return dateFormatter;
-}
-
-- (NSArray *)unsortedLogFilePaths {
-    NSString *logsDirectory = [self logsDirectory];
-    NSArray *fileNames = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:logsDirectory error:nil];
-
-    NSMutableArray *unsortedLogFilePaths = [NSMutableArray arrayWithCapacity:[fileNames count]];
-
-    for (NSString *fileName in fileNames) {
-        // Filter out any files that aren't log files. (Just for extra safety)
-
-    #if TARGET_IPHONE_SIMULATOR
-        // In case of iPhone simulator there can be 'archived' extension. isLogFile:
-        // method knows nothing about it. Thus removing it for this method.
-        //
-        // See full explanation in the header file.
-        NSString *theFileName = [fileName stringByReplacingOccurrencesOfString:@".archived"
-                                                                    withString:@""];
-
-        if ([self isLogFile:theFileName])
-    #else
-
-        if ([self isLogFile:fileName])
-    #endif
-        {
-            NSString *filePath = [logsDirectory stringByAppendingPathComponent:fileName];
-
-            [unsortedLogFilePaths addObject:filePath];
-        }
-    }
-
-    return unsortedLogFilePaths;
-}
-
-- (NSArray *)unsortedLogFileNames {
-    NSArray *unsortedLogFilePaths = [self unsortedLogFilePaths];
-
-    NSMutableArray *unsortedLogFileNames = [NSMutableArray arrayWithCapacity:[unsortedLogFilePaths count]];
-
-    for (NSString *filePath in unsortedLogFilePaths) {
-        [unsortedLogFileNames addObject:[filePath lastPathComponent]];
-    }
-
-    return unsortedLogFileNames;
-}
-
-- (NSArray *)unsortedLogFileInfos {
-    NSArray *unsortedLogFilePaths = [self unsortedLogFilePaths];
-
-    NSMutableArray *unsortedLogFileInfos = [NSMutableArray arrayWithCapacity:[unsortedLogFilePaths count]];
-
-    for (NSString *filePath in unsortedLogFilePaths) {
-        OSSDDLogFileInfo *logFileInfo = [[OSSDDLogFileInfo alloc] initWithFilePath:filePath];
-
-        [unsortedLogFileInfos addObject:logFileInfo];
-    }
-
-    return unsortedLogFileInfos;
-}
-
-- (NSArray *)sortedLogFilePaths {
-    NSArray *sortedLogFileInfos = [self sortedLogFileInfos];
-
-    NSMutableArray *sortedLogFilePaths = [NSMutableArray arrayWithCapacity:[sortedLogFileInfos count]];
-
-    for (OSSDDLogFileInfo *logFileInfo in sortedLogFileInfos) {
-        [sortedLogFilePaths addObject:[logFileInfo filePath]];
-    }
-
-    return sortedLogFilePaths;
-}
-
-- (NSArray *)sortedLogFileNames {
-    NSArray *sortedLogFileInfos = [self sortedLogFileInfos];
-
-    NSMutableArray *sortedLogFileNames = [NSMutableArray arrayWithCapacity:[sortedLogFileInfos count]];
-
-    for (OSSDDLogFileInfo *logFileInfo in sortedLogFileInfos) {
-        [sortedLogFileNames addObject:[logFileInfo fileName]];
-    }
-
-    return sortedLogFileNames;
-}
-
-- (NSArray *)sortedLogFileInfos {
-    return  [[self unsortedLogFileInfos] sortedArrayUsingComparator:^NSComparisonResult(OSSDDLogFileInfo   * _Nonnull obj1, OSSDDLogFileInfo   * _Nonnull obj2) {
-        NSDate *date1 = [NSDate new];
-        NSDate *date2 = [NSDate new];
-
-        NSArray<NSString *> *arrayComponent = [[obj1 fileName] componentsSeparatedByString:@" "];
-        if (arrayComponent.count > 0) {
-            NSString *stringDate = arrayComponent.lastObject;
-            stringDate = [stringDate stringByReplacingOccurrencesOfString:@".log" withString:@""];
-            stringDate = [stringDate stringByReplacingOccurrencesOfString:@".archived" withString:@""];
-            date1 = [[self logFileDateFormatter] dateFromString:stringDate] ?: [obj1 creationDate];
-        }
-        
-        arrayComponent = [[obj2 fileName] componentsSeparatedByString:@" "];
-        if (arrayComponent.count > 0) {
-            NSString *stringDate = arrayComponent.lastObject;
-            stringDate = [stringDate stringByReplacingOccurrencesOfString:@".log" withString:@""];
-            stringDate = [stringDate stringByReplacingOccurrencesOfString:@".archived" withString:@""];
-            date2 = [[self logFileDateFormatter] dateFromString:stringDate] ?: [obj2 creationDate];
-        }
-        
-        return [date2 compare:date1];
-    }];
-
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-#pragma mark Creation
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-//if you change newLogFileName , then  change isLogFile method also accordingly
-- (NSString *)newLogFileName {
-    NSString *appName = [self applicationName];
-
-    NSDateFormatter *dateFormatter = [self logFileDateFormatter];
-    NSString *formattedDate = [dateFormatter stringFromDate:[NSDate date]];
-
-    return [NSString stringWithFormat:@"%@ %@.log", appName, formattedDate];
-}
-
-- (NSString *)createNewLogFile {
-    NSString *fileName = [self newLogFileName];
-    NSString *logsDirectory = [self logsDirectory];
-
-    NSUInteger attempt = 1;
-
-    do {
-        NSString *actualFileName = fileName;
-
-        if (attempt > 1) {
-            NSString *extension = [actualFileName pathExtension];
-
-            actualFileName = [actualFileName stringByDeletingPathExtension];
-            actualFileName = [actualFileName stringByAppendingFormat:@" %lu", (unsigned long)attempt];
-
-            if (extension.length) {
-                actualFileName = [actualFileName stringByAppendingPathExtension:extension];
-            }
-        }
-
-        NSString *filePath = [logsDirectory stringByAppendingPathComponent:actualFileName];
-
-        if (![[NSFileManager defaultManager] fileExistsAtPath:filePath]) {
-            OSSNSLogVerbose(@"DDLogFileManagerDefault: Creating new log file: %@", actualFileName);
-
-            NSDictionary *attributes = nil;
-
-        #if TARGET_OS_IPHONE
-            // When creating log file on iOS we're setting NSFileProtectionKey attribute to NSFileProtectionCompleteUnlessOpen.
-            //
-            // But in case if app is able to launch from background we need to have an ability to open log file any time we
-            // want (even if device is locked). Thats why that attribute have to be changed to
-            // NSFileProtectionCompleteUntilFirstUserAuthentication.
-
-            NSFileProtectionType key = _defaultFileProtectionLevel ? :
-                (ossdoesAppRunInBackground() ? NSFileProtectionCompleteUntilFirstUserAuthentication : NSFileProtectionCompleteUnlessOpen);
-
-            attributes = @{
-                NSFileProtectionKey: key
-            };
-        #endif
-
-            [[NSFileManager defaultManager] createFileAtPath:filePath contents:nil attributes:attributes];
-
-            // Since we just created a new log file, we may need to delete some old log files
-            [self deleteOldLogFiles];
-
-            return filePath;
-        } else {
-            attempt++;
-        }
-    } while (YES);
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-#pragma mark Utility
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-- (NSString *)applicationName {
-    static NSString *_appName;
-    static dispatch_once_t onceToken;
-
-    dispatch_once(&onceToken, ^{
-        _appName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleIdentifier"];
-
-        if (!_appName) {
-            _appName = [[NSProcessInfo processInfo] processName];
-        }
-
-        if (!_appName) {
-            _appName = @"";
-        }
-    });
-
-    return _appName;
-}
-
-@end
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-#pragma mark -
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-@interface OSSDDLogFileFormatterDefault () {
-    NSDateFormatter *_dateFormatter;
-}
-
-@end
-
-@implementation OSSDDLogFileFormatterDefault
-
-- (instancetype)init {
-    return [self initWithDateFormatter:nil];
-}
-
-- (instancetype)initWithDateFormatter:(NSDateFormatter *)aDateFormatter {
-    if ((self = [super init])) {
-        if (aDateFormatter) {
-            _dateFormatter = aDateFormatter;
-        } else {
-            _dateFormatter = [[NSDateFormatter alloc] init];
-            [_dateFormatter setFormatterBehavior:NSDateFormatterBehavior10_4]; // 10.4+ style
-            [_dateFormatter setDateFormat:@"yyyy/MM/dd HH:mm:ss:SSS"];
-        }
-    }
-
-    return self;
-}
-
-- (NSString *)formatLogMessage:(OSSDDLogMessage *)logMessage {
-    NSString *dateAndTime = [_dateFormatter stringFromDate:(logMessage->_timestamp)];
-
-    return [NSString stringWithFormat:@"%@  %@", dateAndTime, logMessage->_message];
-}
-
-@end
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-#pragma mark -
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-@interface OSSDDFileLogger () {
-    __strong id <OSSDDLogFileManager> _logFileManager;
-    
-    NSFileHandle *_currentLogFileHandle;
-    
-    dispatch_source_t _currentLogFileVnode;
-    dispatch_source_t _rollingTimer;
-    
-    unsigned long long _maximumFileSize;
-    NSTimeInterval _rollingFrequency;
-}
-
-- (void)rollLogFileNow;
-- (void)maybeRollLogFileDueToAge;
-- (void)maybeRollLogFileDueToSize;
-
-@end
-
-@implementation OSSDDFileLogger
-
-- (instancetype)init {
-    OSSDDLogFileManagerDefault *defaultLogFileManager = [[OSSDDLogFileManagerDefault alloc] init];
-
-    return [self initWithLogFileManager:defaultLogFileManager];
-}
-
-- (instancetype)initWithLogFileManager:(id <OSSDDLogFileManager>)aLogFileManager {
-    if ((self = [super init])) {
-        _maximumFileSize = osskDDDefaultLogMaxFileSize;
-        _rollingFrequency = osskDDDefaultLogRollingFrequency;
-        _automaticallyAppendNewlineForCustomFormatters = YES;
-
-        logFileManager = aLogFileManager;
-
-        self.logFormatter = [OSSDDLogFileFormatterDefault new];
-    }
-
-    return self;
-}
-
-- (void)dealloc {
-    [_currentLogFileHandle synchronizeFile];
-    [_currentLogFileHandle closeFile];
-
-    if (_currentLogFileVnode) {
-        dispatch_source_cancel(_currentLogFileVnode);
-        _currentLogFileVnode = NULL;
-    }
-
-    if (_rollingTimer) {
-        dispatch_source_cancel(_rollingTimer);
-        _rollingTimer = NULL;
-    }
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-#pragma mark Properties
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-@synthesize logFileManager;
-
-- (unsigned long long)maximumFileSize {
-    __block unsigned long long result;
-
-    dispatch_block_t block = ^{
-        result = _maximumFileSize;
-    };
-
-    // The design of this method is taken from the DDAbstractLogger implementation.
-    // For extensive documentation please refer to the DDAbstractLogger implementation.
-
-    // Note: The internal implementation MUST access the maximumFileSize variable directly,
-    // This method is designed explicitly for external access.
-    //
-    // Using "self." syntax to go through this method will cause immediate deadlock.
-    // This is the intended result. Fix it by accessing the ivar directly.
-    // Great strides have been take to ensure this is safe to do. Plus it's MUCH faster.
-
-    NSAssert(![self isOnGlobalLoggingQueue], @"Core architecture requirement failure");
-    NSAssert(![self isOnInternalLoggerQueue], @"MUST access ivar directly, NOT via self.* syntax.");
-
-    dispatch_queue_t globalLoggingQueue = [OSSDDLog loggingQueue];
-
-    dispatch_sync(globalLoggingQueue, ^{
-        dispatch_sync(self.loggerQueue, block);
-    });
-
-    return result;
-}
-
-- (void)setMaximumFileSize:(unsigned long long)newMaximumFileSize {
-    dispatch_block_t block = ^{
-        @autoreleasepool {
-            _maximumFileSize = newMaximumFileSize;
-            [self maybeRollLogFileDueToSize];
-        }
-    };
-
-    // The design of this method is taken from the DDAbstractLogger implementation.
-    // For extensive documentation please refer to the DDAbstractLogger implementation.
-
-    // Note: The internal implementation MUST access the maximumFileSize variable directly,
-    // This method is designed explicitly for external access.
-    //
-    // Using "self." syntax to go through this method will cause immediate deadlock.
-    // This is the intended result. Fix it by accessing the ivar directly.
-    // Great strides have been take to ensure this is safe to do. Plus it's MUCH faster.
-
-    NSAssert(![self isOnGlobalLoggingQueue], @"Core architecture requirement failure");
-    NSAssert(![self isOnInternalLoggerQueue], @"MUST access ivar directly, NOT via self.* syntax.");
-
-    dispatch_queue_t globalLoggingQueue = [OSSDDLog loggingQueue];
-
-    dispatch_async(globalLoggingQueue, ^{
-        dispatch_async(self.loggerQueue, block);
-    });
-}
-
-- (NSTimeInterval)rollingFrequency {
-    __block NSTimeInterval result;
-
-    dispatch_block_t block = ^{
-        result = _rollingFrequency;
-    };
-
-    // The design of this method is taken from the DDAbstractLogger implementation.
-    // For extensive documentation please refer to the DDAbstractLogger implementation.
-
-    // Note: The internal implementation should access the rollingFrequency variable directly,
-    // This method is designed explicitly for external access.
-    //
-    // Using "self." syntax to go through this method will cause immediate deadlock.
-    // This is the intended result. Fix it by accessing the ivar directly.
-    // Great strides have been take to ensure this is safe to do. Plus it's MUCH faster.
-
-    NSAssert(![self isOnGlobalLoggingQueue], @"Core architecture requirement failure");
-    NSAssert(![self isOnInternalLoggerQueue], @"MUST access ivar directly, NOT via self.* syntax.");
-
-    dispatch_queue_t globalLoggingQueue = [OSSDDLog loggingQueue];
-
-    dispatch_sync(globalLoggingQueue, ^{
-        dispatch_sync(self.loggerQueue, block);
-    });
-
-    return result;
-}
-
-- (void)setRollingFrequency:(NSTimeInterval)newRollingFrequency {
-    dispatch_block_t block = ^{
-        @autoreleasepool {
-            _rollingFrequency = newRollingFrequency;
-            [self maybeRollLogFileDueToAge];
-        }
-    };
-
-    // The design of this method is taken from the DDAbstractLogger implementation.
-    // For extensive documentation please refer to the DDAbstractLogger implementation.
-
-    // Note: The internal implementation should access the rollingFrequency variable directly,
-    // This method is designed explicitly for external access.
-    //
-    // Using "self." syntax to go through this method will cause immediate deadlock.
-    // This is the intended result. Fix it by accessing the ivar directly.
-    // Great strides have been take to ensure this is safe to do. Plus it's MUCH faster.
-
-    NSAssert(![self isOnGlobalLoggingQueue], @"Core architecture requirement failure");
-    NSAssert(![self isOnInternalLoggerQueue], @"MUST access ivar directly, NOT via self.* syntax.");
-
-    dispatch_queue_t globalLoggingQueue = [OSSDDLog loggingQueue];
-
-    dispatch_async(globalLoggingQueue, ^{
-        dispatch_async(self.loggerQueue, block);
-    });
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-#pragma mark File Rolling
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-- (void)scheduleTimerToRollLogFileDueToAge {
-    if (_rollingTimer) {
-        dispatch_source_cancel(_rollingTimer);
-        _rollingTimer = NULL;
-    }
-
-    if (_currentLogFileInfo == nil || _rollingFrequency <= 0.0) {
-        return;
-    }
-
-    NSDate *logFileCreationDate = [_currentLogFileInfo creationDate];
-
-    NSTimeInterval ti = [logFileCreationDate timeIntervalSinceReferenceDate];
-    ti += _rollingFrequency;
-
-    NSDate *logFileRollingDate = [NSDate dateWithTimeIntervalSinceReferenceDate:ti];
-
-    OSSNSLogVerbose(@"DDFileLogger: scheduleTimerToRollLogFileDueToAge");
-
-    OSSNSLogVerbose(@"DDFileLogger: logFileCreationDate: %@", logFileCreationDate);
-    OSSNSLogVerbose(@"DDFileLogger: logFileRollingDate : %@", logFileRollingDate);
-
-    _rollingTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, self.loggerQueue);
-
-    dispatch_source_set_event_handler(_rollingTimer, ^{ @autoreleasepool {
-                                                           [self maybeRollLogFileDueToAge];
-                                                       } });
-
-    #if !OS_OBJECT_USE_OBJC
-    dispatch_source_t theRollingTimer = _rollingTimer;
-    dispatch_source_set_cancel_handler(_rollingTimer, ^{
-        dispatch_release(theRollingTimer);
-    });
-    #endif
-
-    uint64_t delay = (uint64_t)([logFileRollingDate timeIntervalSinceNow] * (NSTimeInterval) NSEC_PER_SEC);
-    dispatch_time_t fireTime = dispatch_time(DISPATCH_TIME_NOW, delay);
-
-    dispatch_source_set_timer(_rollingTimer, fireTime, DISPATCH_TIME_FOREVER, 1ull * NSEC_PER_SEC);
-    dispatch_resume(_rollingTimer);
-}
-
-- (void)rollLogFile {
-    [self rollLogFileWithCompletionBlock:nil];
-}
-
-- (void)rollLogFileWithCompletionBlock:(void (^)(void))completionBlock {
-    // This method is public.
-    // We need to execute the rolling on our logging thread/queue.
-
-    dispatch_block_t block = ^{
-        @autoreleasepool {
-            [self rollLogFileNow];
-
-            if (completionBlock) {
-                dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-                    completionBlock();
-                });
-            }
-        }
-    };
-
-    // The design of this method is taken from the DDAbstractLogger implementation.
-    // For extensive documentation please refer to the DDAbstractLogger implementation.
-
-    if ([self isOnInternalLoggerQueue]) {
-        block();
-    } else {
-        dispatch_queue_t globalLoggingQueue = [OSSDDLog loggingQueue];
-        NSAssert(![self isOnGlobalLoggingQueue], @"Core architecture requirement failure");
-
-        dispatch_async(globalLoggingQueue, ^{
-            dispatch_async(self.loggerQueue, block);
-        });
-    }
-}
-
-- (void)rollLogFileNow {
-    OSSNSLogVerbose(@"OSSDDFileLogger: rollLogFileNow");
-
-    if (_currentLogFileHandle == nil) {
-        return;
-    }
-
-    [_currentLogFileHandle synchronizeFile];
-    [_currentLogFileHandle closeFile];
-    _currentLogFileHandle = nil;
-
-    _currentLogFileInfo.isArchived = YES;
-
-    if ([logFileManager respondsToSelector:@selector(didRollAndArchiveLogFile:)]) {
-        [logFileManager didRollAndArchiveLogFile:(_currentLogFileInfo.filePath)];
-    }
-
-    _currentLogFileInfo = nil;
-
-    if (_currentLogFileVnode) {
-        dispatch_source_cancel(_currentLogFileVnode);
-        _currentLogFileVnode = NULL;
-    }
-
-    if (_rollingTimer) {
-        dispatch_source_cancel(_rollingTimer);
-        _rollingTimer = NULL;
-    }
-}
-
-- (void)maybeRollLogFileDueToAge {
-//    if (_rollingFrequency > 0.0 && _currentLogFileInfo.age >= _rollingFrequency) {
-//        NSLogVerbose(@"DDFileLogger: Rolling log file due to age...");
-//
-//        [self rollLogFileNow];
-//    } else {
-//        [self scheduleTimerToRollLogFileDueToAge];
-//    }
-}
-
-- (void)maybeRollLogFileDueToSize {
-    // This method is called from logMessage.
-    // Keep it FAST.
-
-    // Note: Use direct access to maximumFileSize variable.
-    // We specifically wrote our own getter/setter method to allow us to do this (for performance reasons).
-
-    if (_maximumFileSize > 0) {
-        unsigned long long fileSize = [_currentLogFileHandle offsetInFile];
-
-        if (fileSize >= _maximumFileSize) {
-            OSSNSLogVerbose(@"DDFileLogger: Rolling log file due to size (%qu)...", fileSize);
-
-            [self rollLogFileNow];
-        }
-    }
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-#pragma mark File Logging
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-/**
- * Returns the log file that should be used.
- * If there is an existing log file that is suitable,
- * within the constraints of maximumFileSize and rollingFrequency, then it is returned.
- *
- * Otherwise a new file is created and returned.
- **/
-- (OSSDDLogFileInfo *)currentLogFileInfo {
-    if (_currentLogFileInfo == nil) {
-        NSArray *sortedLogFileInfos = [logFileManager sortedLogFileInfos];
-
-        if ([sortedLogFileInfos count] > 0) {
-            OSSDDLogFileInfo *mostRecentLogFileInfo = sortedLogFileInfos[0];
-
-            BOOL shouldArchiveMostRecent = NO;
-
-            if (mostRecentLogFileInfo.isArchived) {
-                shouldArchiveMostRecent = NO;
-			} else if ([self shouldArchiveRecentLogFileInfo:mostRecentLogFileInfo]) {
-				shouldArchiveMostRecent = YES;
-			} else if (_maximumFileSize > 0 && mostRecentLogFileInfo.fileSize >= _maximumFileSize) {
-                shouldArchiveMostRecent = YES;
-            } else if (_rollingFrequency > 0.0 && mostRecentLogFileInfo.age >= _rollingFrequency) {
-                shouldArchiveMostRecent = YES;
-            }
-
-        #if TARGET_OS_IPHONE
-            // When creating log file on iOS we're setting NSFileProtectionKey attribute to NSFileProtectionCompleteUnlessOpen.
-            //
-            // But in case if app is able to launch from background we need to have an ability to open log file any time we
-            // want (even if device is locked). Thats why that attribute have to be changed to
-            // NSFileProtectionCompleteUntilFirstUserAuthentication.
-            //
-            // If previous log was created when app wasn't running in background, but now it is - we archive it and create
-            // a new one.
-            //
-            // If user has overwritten to NSFileProtectionNone there is no neeed to create a new one.
-
-            if (!_doNotReuseLogFiles && ossdoesAppRunInBackground()) {
-                NSFileProtectionType key = mostRecentLogFileInfo.fileAttributes[NSFileProtectionKey];
-
-                if ([key length] > 0 && !([key isEqualToString:NSFileProtectionCompleteUntilFirstUserAuthentication] || [key isEqualToString:NSFileProtectionNone])) {
-                    shouldArchiveMostRecent = YES;
-                }
-            }
-
-        #endif
-
-            if (!_doNotReuseLogFiles && !mostRecentLogFileInfo.isArchived && !shouldArchiveMostRecent) {
-                OSSNSLogVerbose(@"DDFileLogger: Resuming logging with file %@", mostRecentLogFileInfo.fileName);
-
-                _currentLogFileInfo = mostRecentLogFileInfo;
-            } else {
-                if (shouldArchiveMostRecent) {
-                    mostRecentLogFileInfo.isArchived = YES;
-
-                    if ([logFileManager respondsToSelector:@selector(didArchiveLogFile:)]) {
-                        [logFileManager didArchiveLogFile:(mostRecentLogFileInfo.filePath)];
-                    }
-                }
-            }
-        }
-
-        if (_currentLogFileInfo == nil) {
-            NSString *currentLogFilePath = [logFileManager createNewLogFile];
-
-            _currentLogFileInfo = [[OSSDDLogFileInfo alloc] initWithFilePath:currentLogFilePath];
-        }
-    }
-
-    return _currentLogFileInfo;
-}
-
-- (NSFileHandle *)currentLogFileHandle {
-    if (_currentLogFileHandle == nil) {
-        NSString *logFilePath = [[self currentLogFileInfo] filePath];
-
-        _currentLogFileHandle = [NSFileHandle fileHandleForWritingAtPath:logFilePath];
-        [_currentLogFileHandle seekToEndOfFile];
-
-        if (_currentLogFileHandle) {
-//            [self scheduleTimerToRollLogFileDueToAge];
-
-            // Here we are monitoring the log file. In case if it would be deleted ormoved
-            // somewhere we want to roll it and use a new one.
-            _currentLogFileVnode = dispatch_source_create(
-                    DISPATCH_SOURCE_TYPE_VNODE,
-                    [_currentLogFileHandle fileDescriptor],
-                    DISPATCH_VNODE_DELETE | DISPATCH_VNODE_RENAME,
-                    self.loggerQueue
-                    );
-    
-            dispatch_source_set_event_handler(_currentLogFileVnode, ^{ @autoreleasepool {
-                                                                          OSSNSLogInfo(@"OSSDDFileLogger: Current logfile was moved. Rolling it and creating a new one");
-                                                                          [self rollLogFileNow];
-                                                                      } });
-
-            #if !OS_OBJECT_USE_OBJC
-            dispatch_source_t vnode = _currentLogFileVnode;
-            dispatch_source_set_cancel_handler(_currentLogFileVnode, ^{
-                dispatch_release(vnode);
-            });
-            #endif
-
-            dispatch_resume(_currentLogFileVnode);
-        }
-    }
-
-    return _currentLogFileHandle;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-#pragma mark DDLogger Protocol
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-static int exception_count = 0;
-
-- (void)logMessage:(OSSDDLogMessage *)logMessage {
-    NSString *message = logMessage->_message;
-    BOOL isFormatted = NO;
-    
-    if (_logFormatter) {
-        message = [_logFormatter formatLogMessage:logMessage];
-        isFormatted = message != logMessage->_message;
-    }
-
-    if (message) {
-        if ((!isFormatted || _automaticallyAppendNewlineForCustomFormatters) &&
-            (![message hasSuffix:@"\n"])) {
-            message = [message stringByAppendingString:@"\n"];
-            
-        }
-        
-        NSData *logData = [message dataUsingEncoding:NSUTF8StringEncoding];
-
-        @try {
-            [self willLogMessage];
-			
-            [[self currentLogFileHandle] writeData:logData];
-
-            [self didLogMessage];
-        } @catch (NSException *exception) {
-            exception_count++;
-
-            if (exception_count <= 10) {
-                OSSNSLogError(@"DDFileLogger.logMessage: %@", exception);
-
-                if (exception_count == 10) {
-                    OSSNSLogError(@"DDFileLogger.logMessage: Too many exceptions -- will not log any more of them.");
-                }
-            }
-        }
-    }
-}
-
-- (void)willLogMessage {
-    
-}
-
-- (void)didLogMessage {
-    [self maybeRollLogFileDueToSize];
-}
-
-- (BOOL)shouldArchiveRecentLogFileInfo:(OSSDDLogFileInfo *)recentLogFileInfo {
-    return NO;
-}
-
-- (void)willRemoveLogger {
-    // If you override me be sure to invoke [super willRemoveLogger];
-
-    [self rollLogFileNow];
-}
-
-- (NSString *)loggerName {
-    return @"cocoa.lumberjack.fileLogger";
-}
-
-@end
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-#pragma mark -
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-#if TARGET_IPHONE_SIMULATOR
-    static NSString * const kDDXAttrArchivedName = @"archived";
-#else
-    static NSString * const kDDXAttrArchivedName = @"lumberjack.log.archived";
-#endif
-
-@interface OSSDDLogFileInfo () {
-    __strong NSString *_filePath;
-    __strong NSString *_fileName;
-    
-    __strong NSDictionary *_fileAttributes;
-    
-    __strong NSDate *_creationDate;
-    __strong NSDate *_modificationDate;
-    
-    unsigned long long _fileSize;
-}
-
-@end
-
-
-@implementation OSSDDLogFileInfo
-
-@synthesize filePath;
-
-@dynamic fileName;
-@dynamic fileAttributes;
-@dynamic creationDate;
-@dynamic modificationDate;
-@dynamic fileSize;
-@dynamic age;
-
-@dynamic isArchived;
-
-
-#pragma mark Lifecycle
-
-+ (instancetype)logFileWithPath:(NSString *)aFilePath {
-    return [[self alloc] initWithFilePath:aFilePath];
-}
-
-- (instancetype)initWithFilePath:(NSString *)aFilePath {
-    if ((self = [super init])) {
-        filePath = [aFilePath copy];
-    }
-
-    return self;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-#pragma mark Standard Info
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-- (NSDictionary *)fileAttributes {
-    if (_fileAttributes == nil && filePath != nil) {
-        _fileAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:filePath error:nil];
-    }
-
-    return _fileAttributes;
-}
-
-- (NSString *)fileName {
-    if (_fileName == nil) {
-        _fileName = [filePath lastPathComponent];
-    }
-
-    return _fileName;
-}
-
-- (NSDate *)modificationDate {
-    if (_modificationDate == nil) {
-        _modificationDate = self.fileAttributes[NSFileModificationDate];
-    }
-
-    return _modificationDate;
-}
-
-- (NSDate *)creationDate {
-    if (_creationDate == nil) {
-        _creationDate = self.fileAttributes[NSFileCreationDate];
-    }
-
-    return _creationDate;
-}
-
-- (unsigned long long)fileSize {
-    if (_fileSize == 0) {
-        _fileSize = [self.fileAttributes[NSFileSize] unsignedLongLongValue];
-    }
-
-    return _fileSize;
-}
-
-- (NSTimeInterval)age {
-    return [[self creationDate] timeIntervalSinceNow] * -1.0;
-}
-
-- (NSString *)description {
-    return [@{ @"filePath": self.filePath ? : @"",
-               @"fileName": self.fileName ? : @"",
-               @"fileAttributes": self.fileAttributes ? : @"",
-               @"creationDate": self.creationDate ? : @"",
-               @"modificationDate": self.modificationDate ? : @"",
-               @"fileSize": @(self.fileSize),
-               @"age": @(self.age),
-               @"isArchived": @(self.isArchived) } description];
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-#pragma mark Archiving
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-- (BOOL)isArchived {
-#if TARGET_IPHONE_SIMULATOR
-
-    // Extended attributes don't work properly on the simulator.
-    // So we have to use a less attractive alternative.
-    // See full explanation in the header file.
-
-    return [self hasExtensionAttributeWithName:kDDXAttrArchivedName];
-
-#else
-
-    return [self hasExtendedAttributeWithName:kDDXAttrArchivedName];
-
-#endif
-}
-
-- (void)setIsArchived:(BOOL)flag {
-#if TARGET_IPHONE_SIMULATOR
-
-    // Extended attributes don't work properly on the simulator.
-    // So we have to use a less attractive alternative.
-    // See full explanation in the header file.
-
-    if (flag) {
-        [self addExtensionAttributeWithName:kDDXAttrArchivedName];
-    } else {
-        [self removeExtensionAttributeWithName:kDDXAttrArchivedName];
-    }
-
-#else
-
-    if (flag) {
-        [self addExtendedAttributeWithName:kDDXAttrArchivedName];
-    } else {
-        [self removeExtendedAttributeWithName:kDDXAttrArchivedName];
-    }
-
-#endif
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-#pragma mark Changes
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-- (void)reset {
-    _fileName = nil;
-    _fileAttributes = nil;
-    _creationDate = nil;
-    _modificationDate = nil;
-}
-
-- (void)renameFile:(NSString *)newFileName {
-    // This method is only used on the iPhone simulator, where normal extended attributes are broken.
-    // See full explanation in the header file.
-
-    if (![newFileName isEqualToString:[self fileName]]) {
-        NSString *fileDir = [filePath stringByDeletingLastPathComponent];
-
-        NSString *newFilePath = [fileDir stringByAppendingPathComponent:newFileName];
-
-        OSSNSLogVerbose(@"DDLogFileInfo: Renaming file: '%@' -> '%@'", self.fileName, newFileName);
-
-        NSError *error = nil;
-
-        if ([[NSFileManager defaultManager] fileExistsAtPath:newFilePath] &&
-            ![[NSFileManager defaultManager] removeItemAtPath:newFilePath error:&error]) {
-            OSSNSLogError(@"DDLogFileInfo: Error deleting archive (%@): %@", self.fileName, error);
-        }
-
-        if (![[NSFileManager defaultManager] moveItemAtPath:filePath toPath:newFilePath error:&error]) {
-            OSSNSLogError(@"DDLogFileInfo: Error renaming file (%@): %@", self.fileName, error);
-        }
-
-        filePath = newFilePath;
-        [self reset];
-    }
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-#pragma mark Attribute Management
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-#if TARGET_IPHONE_SIMULATOR
-
-// Extended attributes don't work properly on the simulator.
-// So we have to use a less attractive alternative.
-// See full explanation in the header file.
-
-- (BOOL)hasExtensionAttributeWithName:(NSString *)attrName {
-    // This method is only used on the iPhone simulator, where normal extended attributes are broken.
-    // See full explanation in the header file.
-
-    // Split the file name into components. File name may have various format, but generally
-    // structure is same:
-    //
-    // <name part>.<extension part> and <name part>.archived.<extension part>
-    // or
-    // <name part> and <name part>.archived
-    //
-    // So we want to search for the attrName in the components (ignoring the first array index).
-
-    NSArray *components = [[self fileName] componentsSeparatedByString:@"."];
-
-    // Watch out for file names without an extension
-
-    for (NSUInteger i = 1; i < components.count; i++) {
-        NSString *attr = components[i];
-
-        if ([attrName isEqualToString:attr]) {
-            return YES;
-        }
-    }
-
-    return NO;
-}
-
-- (void)addExtensionAttributeWithName:(NSString *)attrName {
-    // This method is only used on the iPhone simulator, where normal extended attributes are broken.
-    // See full explanation in the header file.
-
-    if ([attrName length] == 0) {
-        return;
-    }
-
-    // Example:
-    // attrName = "archived"
-    //
-    // "mylog.txt" -> "mylog.archived.txt"
-    // "mylog"     -> "mylog.archived"
-
-    NSArray *components = [[self fileName] componentsSeparatedByString:@"."];
-
-    NSUInteger count = [components count];
-
-    NSUInteger estimatedNewLength = [[self fileName] length] + [attrName length] + 1;
-    NSMutableString *newFileName = [NSMutableString stringWithCapacity:estimatedNewLength];
-
-    if (count > 0) {
-        [newFileName appendString:components.firstObject];
-    }
-
-    NSString *lastExt = @"";
-
-    NSUInteger i;
-
-    for (i = 1; i < count; i++) {
-        NSString *attr = components[i];
-
-        if ([attr length] == 0) {
-            continue;
-        }
-
-        if ([attrName isEqualToString:attr]) {
-            // Extension attribute already exists in file name
-            return;
-        }
-
-        if ([lastExt length] > 0) {
-            [newFileName appendFormat:@".%@", lastExt];
-        }
-
-        lastExt = attr;
-    }
-
-    [newFileName appendFormat:@".%@", attrName];
-
-    if ([lastExt length] > 0) {
-        [newFileName appendFormat:@".%@", lastExt];
-    }
-
-    [self renameFile:newFileName];
-}
-
-- (void)removeExtensionAttributeWithName:(NSString *)attrName {
-    // This method is only used on the iPhone simulator, where normal extended attributes are broken.
-    // See full explanation in the header file.
-
-    if ([attrName length] == 0) {
-        return;
-    }
-
-    // Example:
-    // attrName = "archived"
-    //
-    // "mylog.archived.txt" -> "mylog.txt"
-    // "mylog.archived"     -> "mylog"
-
-    NSArray *components = [[self fileName] componentsSeparatedByString:@"."];
-
-    NSUInteger count = [components count];
-
-    NSUInteger estimatedNewLength = [[self fileName] length];
-    NSMutableString *newFileName = [NSMutableString stringWithCapacity:estimatedNewLength];
-
-    if (count > 0) {
-        [newFileName appendString:components.firstObject];
-    }
-
-    BOOL found = NO;
-
-    NSUInteger i;
-
-    for (i = 1; i < count; i++) {
-        NSString *attr = components[i];
-
-        if ([attrName isEqualToString:attr]) {
-            found = YES;
-        } else {
-            [newFileName appendFormat:@".%@", attr];
-        }
-    }
-
-    if (found) {
-        [self renameFile:newFileName];
-    }
-}
-
-#else /* if TARGET_IPHONE_SIMULATOR */
-
-- (BOOL)hasExtendedAttributeWithName:(NSString *)attrName {
-    const char *path = [filePath UTF8String];
-    const char *name = [attrName UTF8String];
-
-    ssize_t result = getxattr(path, name, NULL, 0, 0, 0);
-
-    return (result >= 0);
-}
-
-- (void)addExtendedAttributeWithName:(NSString *)attrName {
-    const char *path = [filePath UTF8String];
-    const char *name = [attrName UTF8String];
-
-    int result = setxattr(path, name, NULL, 0, 0, 0);
-
-    if (result < 0) {
-        OSSNSLogError(@"DDLogFileInfo: setxattr(%@, %@): error = %s",
-                   attrName,
-                   filePath,
-                   strerror(errno));
-    }
-}
-
-- (void)removeExtendedAttributeWithName:(NSString *)attrName {
-    const char *path = [filePath UTF8String];
-    const char *name = [attrName UTF8String];
-
-    int result = removexattr(path, name, 0);
-
-    if (result < 0 && errno != ENOATTR) {
-        OSSNSLogError(@"DDLogFileInfo: removexattr(%@, %@): error = %s",
-                   attrName,
-                   self.fileName,
-                   strerror(errno));
-    }
-}
-
-#endif /* if TARGET_IPHONE_SIMULATOR */
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-#pragma mark Comparisons
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-- (BOOL)isEqual:(id)object {
-    if ([object isKindOfClass:[self class]]) {
-        OSSDDLogFileInfo *another = (OSSDDLogFileInfo *)object;
-
-        return [filePath isEqualToString:[another filePath]];
-    }
-
-    return NO;
-}
-
--(NSUInteger)hash {
-    return [filePath hash];
-}
-
-@end
-
-#if TARGET_OS_IPHONE
-/**
- * When creating log file on iOS we're setting NSFileProtectionKey attribute to NSFileProtectionCompleteUnlessOpen.
- *
- * But in case if app is able to launch from background we need to have an ability to open log file any time we
- * want (even if device is locked). Thats why that attribute have to be changed to
- * NSFileProtectionCompleteUntilFirstUserAuthentication.
- */
-BOOL ossdoesAppRunInBackground() {
-    BOOL answer = NO;
-
-    NSArray *backgroundModes = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"UIBackgroundModes"];
-
-    for (NSString *mode in backgroundModes) {
-        if (mode.length > 0) {
-            answer = YES;
-            break;
-        }
-    }
-
-    return answer;
-}
-
-#endif

+ 0 - 82
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSFileLog/OSSLogMacros.h

@@ -1,82 +0,0 @@
-// Software License Agreement (BSD License)
-//
-// Copyright (c) 2010-2016, Deusty, LLC
-// All rights reserved.
-//
-// Redistribution and use of this software in source and binary forms,
-// with or without modification, are permitted provided that the following conditions are met:
-//
-// * Redistributions of source code must retain the above copyright notice,
-//   this list of conditions and the following disclaimer.
-//
-// * Neither the name of Deusty nor the names of its contributors may be used
-//   to endorse or promote products derived from this software without specific
-//   prior written permission of Deusty, LLC.
-
-// Disable legacy macros
-#ifndef OSSDD_LEGACY_MACROS
-    #define OSSDD_LEGACY_MACROS 0
-#endif
-
-#import "OSSDDLog.h"
-
-/**
- * The constant/variable/method responsible for controlling the current log level.
- **/
-#ifndef OSSLOG_LEVEL_DEF
-    #define OSSLOG_LEVEL_DEF ossLogLevel
-#endif
-
-/**
- * Whether async should be used by log messages, excluding error messages that are always sent sync.
- **/
-#ifndef OSSLOG_ASYNC_ENABLED
-    #define OSSLOG_ASYNC_ENABLED YES
-#endif
-
-/**
- * These are the two macros that all other macros below compile into.
- * These big multiline macros makes all the other macros easier to read.
- **/
-#define OSSLOG_MACRO(isAsynchronous, lvl, flg, ctx, atag, fnct, frmt, ...) \
-        [OSSDDLog log : isAsynchronous                                     \
-             level : lvl                                                \
-              flag : flg                                                \
-           context : ctx                                                \
-              file : __FILE__                                           \
-          function : fnct                                               \
-              line : __LINE__                                           \
-               tag : atag                                               \
-            format : (frmt), ## __VA_ARGS__]
-
-/**
- * Define version of the macro that only execute if the log level is above the threshold.
- * The compiled versions essentially look like this:
- *
- * if (logFlagForThisLogMsg & ddLogLevel) { execute log message }
- *
- * When LOG_LEVEL_DEF is defined as ddLogLevel.
- *
- * As shown further below, Lumberjack actually uses a bitmask as opposed to primitive log levels.
- * This allows for a great amount of flexibility and some pretty advanced fine grained logging techniques.
- *
- * Note that when compiler optimizations are enabled (as they are for your release builds),
- * the log messages above your logging threshold will automatically be compiled out.
- *
- * (If the compiler sees LOG_LEVEL_DEF/ddLogLevel declared as a constant, the compiler simply checks to see
- *  if the 'if' statement would execute, and if not it strips it from the binary.)
- *
- * We also define shorthand versions for asynchronous and synchronous logging.
- **/
-#define OSSLOG_MAYBE(async, lvl, flg, ctx, tag, fnct, frmt, ...) \
-        do { if(lvl & flg) OSSLOG_MACRO(async, lvl, flg, ctx, tag, fnct, frmt, ##__VA_ARGS__); } while(0)
-
-/**
- * Ready to use log macros with no context or tag.
- **/
-#define OSSDDLogError(frmt, ...)   OSSLOG_MAYBE(NO,                OSSLOG_LEVEL_DEF, OSSDDLogFlagError,   0, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__)
-#define OSSDDLogWarn(frmt, ...)    OSSLOG_MAYBE(OSSLOG_ASYNC_ENABLED, OSSLOG_LEVEL_DEF, OSSDDLogFlagWarning, 0, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__)
-#define OSSDDLogInfo(frmt, ...)    OSSLOG_MAYBE(OSSLOG_ASYNC_ENABLED, OSSLOG_LEVEL_DEF, OSSDDLogFlagInfo,    0, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__)
-#define OSSDDLogDebug(frmt, ...)   OSSLOG_MAYBE(OSSLOG_ASYNC_ENABLED, OSSLOG_LEVEL_DEF, OSSDDLogFlagDebug,   0, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__)
-#define OSSDDLogVerbose(frmt, ...) OSSLOG_MAYBE(OSSLOG_ASYNC_ENABLED, OSSLOG_LEVEL_DEF, OSSDDLogFlagVerbose, 0, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__)
-

+ 0 - 14
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSFileLog/OSSNSLogger.h

@@ -1,14 +0,0 @@
-//
-//  OSSNSLogger.h
-//  AliyunOSSiOS
-//
-//  Created by jingdan on 2017/10/24.
-//  Copyright © 2017年 zhouzhuo. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-#import "OSSDDLog.h"
-
-@interface OSSNSLogger : OSSDDAbstractLogger <OSSDDLogger>
-@property (class, readonly, strong) OSSNSLogger *sharedInstance;
-@end

+ 0 - 32
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSFileLog/OSSNSLogger.m

@@ -1,32 +0,0 @@
-//
-//  OSSNSLogger.m
-//  AliyunOSSiOS
-//
-//  Created by jingdan on 2017/10/24.
-//  Copyright © 2017年 zhouzhuo. All rights reserved.
-//
-
-#import "OSSNSLogger.h"
-
-static OSSNSLogger *sharedInstance;
-
-@implementation OSSNSLogger
-+ (instancetype)sharedInstance {
-    static dispatch_once_t OSSNSLoggerOnceToken;
-    
-    dispatch_once(&OSSNSLoggerOnceToken, ^{
-        sharedInstance = [[[self class] alloc] init];
-    });
-    
-    return sharedInstance;
-}
-
-- (void)logMessage:(OSSDDLogMessage *)logMessage {
-    NSString * message = _logFormatter ? [_logFormatter formatLogMessage:logMessage] : logMessage->_message;
-    
-    if (message) {
-        NSLog(@"%@",message);
-    }
-}
-
-@end

+ 0 - 64
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSFileLog/OSSReachability.h

@@ -1,64 +0,0 @@
-/*
- Copyright (C) 2016 Apple Inc. All Rights Reserved.
- See LICENSE.txt for this sample’s licensing information
- 
- Abstract:
- Basic demonstration of how to use the SystemConfiguration Reachablity APIs.
- */
-
-#import <Foundation/Foundation.h>
-#import <SystemConfiguration/SystemConfiguration.h>
-#import <netinet/in.h>
-
-
-typedef enum : NSInteger {
-	OSSNotReachable = 0,
-	OSSReachableViaWiFi,
-	OSSReachableViaWWAN
-} OSSNetworkStatus;
-
-#pragma mark IPv6 Support
-//Reachability fully support IPv6.  For full details, see ReadMe.md.
-
-
-extern NSString *ossReachabilityChangedNotification;
-
-
-@interface OSSReachability : NSObject
-
-/*!
- * Use to check the reachability of a given host name.
- */
-+ (instancetype)reachabilityWithHostName:(NSString *)hostName;
-
-/*!
- * Use to check the reachability of a given IP address.
- */
-+ (instancetype)reachabilityWithAddress:(const struct sockaddr *)hostAddress;
-
-/*!
- * Checks whether the default route is available. Should be used by applications that do not connect to a particular host.
- */
-+ (instancetype)reachabilityForInternetConnection;
-
-
-#pragma mark reachabilityForLocalWiFi
-//reachabilityForLocalWiFi has been removed from the sample.  See ReadMe.md for more information.
-//+ (instancetype)reachabilityForLocalWiFi;
-
-/*!
- * Start listening for reachability notifications on the current run loop.
- */
-- (BOOL)startNotifier;
-- (void)stopNotifier;
-
-- (OSSNetworkStatus)currentReachabilityStatus;
-
-/*!
- * WWAN may be available, but not active until a connection has been established. WiFi may require a connection for VPN on Demand.
- */
-- (BOOL)connectionRequired;
-
-@end
-
-

+ 0 - 248
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSFileLog/OSSReachability.m

@@ -1,248 +0,0 @@
-/*
- Copyright (C) 2016 Apple Inc. All Rights Reserved.
- See LICENSE.txt for this sample’s licensing information
- 
- Abstract:
- Basic demonstration of how to use the SystemConfiguration Reachablity APIs.
- */
-
-#import <arpa/inet.h>
-#import <ifaddrs.h>
-#import <netdb.h>
-#import <sys/socket.h>
-#import <netinet/in.h>
-#import <CoreFoundation/CoreFoundation.h>
-
-#import "OSSReachability.h"
-
-#pragma mark IPv6 Support
-//Reachability fully support IPv6.  For full details, see ReadMe.md.
-
-
-NSString *ossReachabilityChangedNotification = @"ossNetworkReachabilityChangedNotification";
-
-#ifndef kShouldPrintReachabilityFlags
-#if TARGET_OS_IOS
-#define kShouldPrintReachabilityFlags 1
-#else
-#define kShouldPrintReachabilityFlags 0
-#endif
-#endif
-
-#pragma mark - Supporting functions
-static void PrintReachabilityFlags(SCNetworkReachabilityFlags flags, const char* comment)
-{
-#if kShouldPrintReachabilityFlags
-
-    NSLog(@"Reachability Flag Status: %c%c %c%c%c%c%c%c%c %s\n",
-          (flags & kSCNetworkReachabilityFlagsIsWWAN)				? 'W' : '-',
-          (flags & kSCNetworkReachabilityFlagsReachable)            ? 'R' : '-',
-
-          (flags & kSCNetworkReachabilityFlagsTransientConnection)  ? 't' : '-',
-          (flags & kSCNetworkReachabilityFlagsConnectionRequired)   ? 'c' : '-',
-          (flags & kSCNetworkReachabilityFlagsConnectionOnTraffic)  ? 'C' : '-',
-          (flags & kSCNetworkReachabilityFlagsInterventionRequired) ? 'i' : '-',
-          (flags & kSCNetworkReachabilityFlagsConnectionOnDemand)   ? 'D' : '-',
-          (flags & kSCNetworkReachabilityFlagsIsLocalAddress)       ? 'l' : '-',
-          (flags & kSCNetworkReachabilityFlagsIsDirect)             ? 'd' : '-',
-          comment
-          );
-#endif
-}
-
-
-static void ReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void* info)
-{
-#pragma unused (target, flags)
-	NSCAssert(info != NULL, @"info was NULL in ReachabilityCallback");
-	NSCAssert([(__bridge NSObject*) info isKindOfClass: [OSSReachability class]], @"info was wrong class in ReachabilityCallback");
-
-    OSSReachability* noteObject = (__bridge OSSReachability *)info;
-    // Post a notification to notify the client that the network reachability changed.
-    [[NSNotificationCenter defaultCenter] postNotificationName: ossReachabilityChangedNotification object: noteObject];
-}
-
-
-#pragma mark - Reachability implementation
-
-@implementation OSSReachability
-{
-	SCNetworkReachabilityRef _reachabilityRef;
-}
-
-+ (instancetype)reachabilityWithHostName:(NSString *)hostName
-{
-	OSSReachability* returnValue = NULL;
-	SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithName(NULL, [hostName UTF8String]);
-	if (reachability != NULL)
-	{
-		returnValue= [[self alloc] init];
-		if (returnValue != NULL)
-		{
-			returnValue->_reachabilityRef = reachability;
-		}
-        else {
-            CFRelease(reachability);
-        }
-	}
-	return returnValue;
-}
-
-
-+ (instancetype)reachabilityWithAddress:(const struct sockaddr *)hostAddress
-{
-	SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithAddress(kCFAllocatorDefault, hostAddress);
-
-	OSSReachability* returnValue = NULL;
-
-	if (reachability != NULL)
-	{
-		returnValue = [[self alloc] init];
-		if (returnValue != NULL)
-		{
-			returnValue->_reachabilityRef = reachability;
-		}
-        else {
-            CFRelease(reachability);
-        }
-	}
-	return returnValue;
-}
-
-
-+ (instancetype)reachabilityForInternetConnection
-{
-	struct sockaddr_in zeroAddress;
-	bzero(&zeroAddress, sizeof(zeroAddress));
-	zeroAddress.sin_len = sizeof(zeroAddress);
-	zeroAddress.sin_family = AF_INET;
-    
-    return [self reachabilityWithAddress: (const struct sockaddr *) &zeroAddress];
-}
-
-#pragma mark reachabilityForLocalWiFi
-//reachabilityForLocalWiFi has been removed from the sample.  See ReadMe.md for more information.
-//+ (instancetype)reachabilityForLocalWiFi
-
-
-
-#pragma mark - Start and stop notifier
-
-- (BOOL)startNotifier
-{
-	BOOL returnValue = NO;
-	SCNetworkReachabilityContext context = {0, (__bridge void *)(self), NULL, NULL, NULL};
-
-	if (SCNetworkReachabilitySetCallback(_reachabilityRef, ReachabilityCallback, &context))
-	{
-		if (SCNetworkReachabilityScheduleWithRunLoop(_reachabilityRef, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode))
-		{
-			returnValue = YES;
-		}
-	}
-    
-	return returnValue;
-}
-
-
-- (void)stopNotifier
-{
-	if (_reachabilityRef != NULL)
-	{
-		SCNetworkReachabilityUnscheduleFromRunLoop(_reachabilityRef, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
-	}
-}
-
-
-- (void)dealloc
-{
-	[self stopNotifier];
-	if (_reachabilityRef != NULL)
-	{
-		CFRelease(_reachabilityRef);
-	}
-}
-
-
-#pragma mark - Network Flag Handling
-
-- (OSSNetworkStatus)networkStatusForFlags:(SCNetworkReachabilityFlags)flags
-{
-	PrintReachabilityFlags(flags, "networkStatusForFlags");
-	if ((flags & kSCNetworkReachabilityFlagsReachable) == 0)
-	{
-		// The target host is not reachable.
-		return OSSNotReachable;
-	}
-
-    OSSNetworkStatus returnValue = OSSNotReachable;
-
-	if ((flags & kSCNetworkReachabilityFlagsConnectionRequired) == 0)
-	{
-		/*
-         If the target host is reachable and no connection is required then we'll assume (for now) that you're on Wi-Fi...
-         */
-		returnValue = OSSReachableViaWiFi;
-	}
-
-	if ((((flags & kSCNetworkReachabilityFlagsConnectionOnDemand ) != 0) ||
-        (flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) != 0))
-	{
-        /*
-         ... and the connection is on-demand (or on-traffic) if the calling application is using the CFSocketStream or higher APIs...
-         */
-
-        if ((flags & kSCNetworkReachabilityFlagsInterventionRequired) == 0)
-        {
-            /*
-             ... and no [user] intervention is needed...
-             */
-            returnValue = OSSReachableViaWiFi;
-        }
-    }
-
-#if TARGET_OS_IOS
-    if ((flags & kSCNetworkReachabilityFlagsIsWWAN) == kSCNetworkReachabilityFlagsIsWWAN)
-    {
-        /*
-         ... but WWAN connections are OK if the calling application is using the CFNetwork APIs.
-         */
-        returnValue = OSSReachableViaWWAN;
-    }
-#endif
-
-    
-	return returnValue;
-}
-
-
-- (BOOL)connectionRequired
-{
-	NSAssert(_reachabilityRef != NULL, @"connectionRequired called with NULL reachabilityRef");
-	SCNetworkReachabilityFlags flags;
-
-	if (SCNetworkReachabilityGetFlags(_reachabilityRef, &flags))
-	{
-		return (flags & kSCNetworkReachabilityFlagsConnectionRequired);
-	}
-
-    return NO;
-}
-
-
-- (OSSNetworkStatus)currentReachabilityStatus
-{
-	NSAssert(_reachabilityRef != NULL, @"currentOSSNetworkStatus called with NULL SCNetworkReachabilityRef");
-	OSSNetworkStatus returnValue = OSSNotReachable;
-	SCNetworkReachabilityFlags flags;
-    
-	if (SCNetworkReachabilityGetFlags(_reachabilityRef, &flags))
-	{
-        returnValue = [self networkStatusForFlags:flags];
-	}
-    
-	return returnValue;
-}
-
-
-@end

+ 0 - 15
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSGetBucketInfoRequest.h

@@ -1,15 +0,0 @@
-//
-//  OSSGetBucketInfoRequest.h
-//  AliyunOSSSDK
-//
-//  Created by huaixu on 2018/7/10.
-//  Copyright © 2018年 aliyun. All rights reserved.
-//
-
-#import "OSSRequest.h"
-
-@interface OSSGetBucketInfoRequest : OSSRequest
-
-@property (nonatomic, copy) NSString *bucketName;
-
-@end

+ 0 - 17
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSGetBucketInfoRequest.m

@@ -1,17 +0,0 @@
-//
-//  OSSGetBucketInfoRequest.m
-//  AliyunOSSSDK
-//
-//  Created by huaixu on 2018/7/10.
-//  Copyright © 2018年 aliyun. All rights reserved.
-//
-
-#import "OSSGetBucketInfoRequest.h"
-
-@implementation OSSGetBucketInfoRequest
-
-- (NSDictionary *)requestParams {
-    return @{@"bucketInfo": @""};
-}
-
-@end

+ 0 - 57
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSGetBucketInfoResult.h

@@ -1,57 +0,0 @@
-//
-//  OSSGetBucketInfoResult.h
-//  AliyunOSSSDK
-//
-//  Created by huaixu on 2018/7/10.
-//  Copyright © 2018年 aliyun. All rights reserved.
-//
-
-#import "OSSResult.h"
-
-@interface OSSBucketOwner : NSObject
-
-@property (nonatomic, copy) NSString *userName;
-
-@property (nonatomic, copy) NSString *userId;
-
-@end
-
-@interface OSSAccessControlList : NSObject
-
-@property (nonatomic, copy) NSString *grant;
-
-@end
-
-
-
-@interface OSSGetBucketInfoResult : OSSResult
-
-/// Created date.
-@property (nonatomic, copy) NSString *creationDate;
-
-/// Bucket name.
-@property (nonatomic, copy) NSString *bucketName;
-
-/// Bucket location.
-@property (nonatomic, copy) NSString *location;
-
-/// Storage class (Standard, IA, Archive)
-@property (nonatomic, copy) NSString *storageClass;
-
-/**
- Internal endpoint. It could be accessed within AliCloud under the same
- location.
- */
-@property (nonatomic, copy) NSString *intranetEndpoint;
-
-/**
- External endpoint.It could be accessed from anywhere.
- */
-@property (nonatomic, copy) NSString *extranetEndpoint;
-
-/// Bucket owner.
-@property (nonatomic, strong) OSSBucketOwner *owner;
-
-@property (nonatomic, strong) OSSAccessControlList *acl;
-
-@end

+ 0 - 23
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSGetBucketInfoResult.m

@@ -1,23 +0,0 @@
-//
-//  OSSGetBucketInfoResult.m
-//  AliyunOSSSDK
-//
-//  Created by huaixu on 2018/7/10.
-//  Copyright © 2018年 aliyun. All rights reserved.
-//
-
-#import "OSSGetBucketInfoResult.h"
-
-@implementation OSSBucketOwner
-
-@end
-
-@implementation OSSAccessControlList
-
-@end
-
-
-
-@implementation OSSGetBucketInfoResult
-
-@end

+ 0 - 26
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSGetObjectACLRequest.h

@@ -1,26 +0,0 @@
-//
-//  OSSGetObjectACLRequest.h
-//  AliyunOSSSDK
-//
-//  Created by huaixu on 2018/1/26.
-//  Copyright © 2018年 aliyun. All rights reserved.
-//
-
-#import "OSSRequest.h"
-
-NS_ASSUME_NONNULL_BEGIN
-@interface OSSGetObjectACLRequest : OSSRequest
-
-/**
- the bucket's name which object stored
- */
-@property (nonatomic, copy) NSString *bucketName;
-
-/**
- the name of object
- */
-@property (nonatomic, copy) NSString *objectName;
-
-
-@end
-NS_ASSUME_NONNULL_END

+ 0 - 13
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSGetObjectACLRequest.m

@@ -1,13 +0,0 @@
-//
-//  OSSGetObjectACLRequest.m
-//  AliyunOSSSDK
-//
-//  Created by huaixu on 2018/1/26.
-//  Copyright © 2018年 aliyun. All rights reserved.
-//
-
-#import "OSSGetObjectACLRequest.h"
-
-@implementation OSSGetObjectACLRequest
-
-@end

+ 0 - 19
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSGetObjectACLResult.h

@@ -1,19 +0,0 @@
-//
-//  OSSGetObjectACLResult.h
-//  AliyunOSSSDK
-//
-//  Created by huaixu on 2018/1/26.
-//  Copyright © 2018年 aliyun. All rights reserved.
-//
-
-#import "OSSResult.h"
-
-@interface OSSGetObjectACLResult : OSSResult
-
-/**
- the ACL of object,valid values: @"private",@"public-read",@"public-read-write".
- if object's ACL inherit from bucket,it will return @"default".
- */
-@property (nonatomic, copy) NSString *grant;
-
-@end

+ 0 - 13
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSGetObjectACLResult.m

@@ -1,13 +0,0 @@
-//
-//  OSSGetObjectACLResult.m
-//  AliyunOSSSDK
-//
-//  Created by huaixu on 2018/1/26.
-//  Copyright © 2018年 aliyun. All rights reserved.
-//
-
-#import "OSSGetObjectACLResult.h"
-
-@implementation OSSGetObjectACLResult
-
-@end

+ 0 - 17
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSGetSymlinkRequest.h

@@ -1,17 +0,0 @@
-//
-//  OSSGetSymlinkRequest.h
-//  AliyunOSSSDK
-//
-//  Created by huaixu on 2018/8/1.
-//  Copyright © 2018年 aliyun. All rights reserved.
-//
-
-#import "OSSRequest.h"
-
-@interface OSSGetSymlinkRequest : OSSRequest
-
-@property (nonatomic, copy) NSString *bucketName;
-
-@property (nonatomic, copy) NSString *objectKey;
-
-@end

+ 0 - 17
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSGetSymlinkRequest.m

@@ -1,17 +0,0 @@
-//
-//  OSSGetSymlinkRequest.m
-//  AliyunOSSSDK
-//
-//  Created by huaixu on 2018/8/1.
-//  Copyright © 2018年 aliyun. All rights reserved.
-//
-
-#import "OSSGetSymlinkRequest.h"
-
-@implementation OSSGetSymlinkRequest
-
-- (NSDictionary *)requestParams {
-    return @{@"symlink": @""};
-}
-
-@end

+ 0 - 13
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSGetSymlinkResult.h

@@ -1,13 +0,0 @@
-//
-//  OSSGetSymlinkResult.h
-//  AliyunOSSSDK
-//
-//  Created by huaixu on 2018/8/1.
-//  Copyright © 2018年 aliyun. All rights reserved.
-//
-
-#import "OSSResult.h"
-
-@interface OSSGetSymlinkResult : OSSResult
-
-@end

+ 0 - 13
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSGetSymlinkResult.m

@@ -1,13 +0,0 @@
-//
-//  OSSGetSymlinkResult.m
-//  AliyunOSSSDK
-//
-//  Created by huaixu on 2018/8/1.
-//  Copyright © 2018年 aliyun. All rights reserved.
-//
-
-#import "OSSGetSymlinkResult.h"
-
-@implementation OSSGetSymlinkResult
-
-@end

+ 0 - 39
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSHttpResponseParser.h

@@ -1,39 +0,0 @@
-//
-//  OSSHttpResponseParser.h
-//  AliyunOSSSDK
-//
-//  Created by huaixu on 2018/1/22.
-//  Copyright © 2018年 aliyun. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-#import "OSSConstants.h"
-#import "OSSTask.h"
-
-NS_ASSUME_NONNULL_BEGIN
-
-/**
- HTTP response parser
- */
-@interface OSSHttpResponseParser : NSObject
-
-@property (nonatomic, copy) OSSNetworkingOnRecieveDataBlock onRecieveBlock;
-
-@property (nonatomic, strong) NSURL *downloadingFileURL;
-
-/**
- *  A Boolean value that determines whether verfifying crc64.
- When set to YES, it will verify crc64 when transmission is completed normally.
- The default value of this property is NO.
- */
-@property (nonatomic, assign) BOOL crc64Verifiable;
-
-- (instancetype)initForOperationType:(OSSOperationType)operationType;
-- (void)consumeHttpResponse:(NSHTTPURLResponse *)response;
-- (OSSTask *)consumeHttpResponseBody:(NSData *)data;
-- (nullable id)constructResultObject;
-- (void)reset;
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 655
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSHttpResponseParser.m

@@ -1,655 +0,0 @@
-//
-//  OSSHttpResponseParser.m
-//  AliyunOSSSDK
-//
-//  Created by huaixu on 2018/1/22.
-//  Copyright © 2018年 aliyun. All rights reserved.
-//
-
-#import "OSSHttpResponseParser.h"
-
-#import "NSMutableData+OSS_CRC.h"
-#import "OSSXMLDictionary.h"
-#import "OSSDefine.h"
-#import "OSSModel.h"
-#import "OSSUtil.h"
-#import "OSSLog.h"
-#import "OSSGetObjectACLResult.h"
-#import "OSSDeleteMultipleObjectsResult.h"
-#import "OSSGetBucketInfoResult.h"
-#import "OSSRestoreObjectResult.h"
-#import "OSSPutSymlinkResult.h"
-#import "OSSGetSymlinkResult.h"
-
-
-@implementation OSSHttpResponseParser {
-    
-    OSSOperationType _operationTypeForThisParser;
-    
-    NSFileHandle * _fileHandle;
-    NSMutableData * _collectingData;
-    NSHTTPURLResponse * _response;
-    uint64_t _crc64ecma;
-}
-
-- (void)reset {
-    _collectingData = nil;
-    _fileHandle = nil;
-    _response = nil;
-}
-
-- (instancetype)initForOperationType:(OSSOperationType)operationType {
-    if (self = [super init]) {
-        _operationTypeForThisParser = operationType;
-    }
-    return self;
-}
-
-- (void)consumeHttpResponse:(NSHTTPURLResponse *)response {
-    _response = response;
-}
-
-- (OSSTask *)consumeHttpResponseBody:(NSData *)data
-{
-    if (_crc64Verifiable&&(_operationTypeForThisParser == OSSOperationTypeGetObject))
-    {
-        NSMutableData *mutableData = [NSMutableData dataWithData:data];
-        if (_crc64ecma != 0)
-        {
-            _crc64ecma = [OSSUtil crc64ForCombineCRC1:_crc64ecma
-                                                 CRC2:[mutableData oss_crc64]
-                                               length:mutableData.length];
-        }else
-        {
-            _crc64ecma = [mutableData oss_crc64];
-        }
-    }
-    
-    if (self.onRecieveBlock) {
-        self.onRecieveBlock(data);
-        return [OSSTask taskWithResult:nil];
-    }
-    
-    NSError * error;
-    if (self.downloadingFileURL)
-    {
-        if (!_fileHandle)
-        {
-            NSFileManager * fm = [NSFileManager defaultManager];
-            NSString * dirName = [[self.downloadingFileURL path] stringByDeletingLastPathComponent];
-            if (![fm fileExistsAtPath:dirName])
-            {
-                [fm createDirectoryAtPath:dirName withIntermediateDirectories:YES attributes:nil error:&error];
-            }
-            if (![fm fileExistsAtPath:dirName] || error)
-            {
-                return [OSSTask taskWithError:[NSError errorWithDomain:OSSClientErrorDomain
-                                                                  code:OSSClientErrorCodeFileCantWrite
-                                                              userInfo:@{OSSErrorMessageTOKEN: [NSString stringWithFormat:@"Can't create dir at %@", dirName]}]];
-            }
-            [fm createFileAtPath:[self.downloadingFileURL path] contents:nil attributes:nil];
-            if (![fm fileExistsAtPath:[self.downloadingFileURL path]])
-            {
-                return [OSSTask taskWithError:[NSError errorWithDomain:OSSClientErrorDomain
-                                                                  code:OSSClientErrorCodeFileCantWrite
-                                                              userInfo:@{OSSErrorMessageTOKEN: [NSString stringWithFormat:@"Can't create file at %@", [self.downloadingFileURL path]]}]];
-            }
-            _fileHandle = [NSFileHandle fileHandleForWritingToURL:self.downloadingFileURL error:&error];
-            if (error)
-            {
-                return [OSSTask taskWithError:[NSError errorWithDomain:OSSClientErrorDomain
-                                                                  code:OSSClientErrorCodeFileCantWrite
-                                                              userInfo:[error userInfo]]];
-            }
-            [_fileHandle writeData:data];
-        } else
-        {
-            @try {
-                [_fileHandle writeData:data];
-            }
-            @catch (NSException *exception) {
-                return [OSSTask taskWithError:[NSError errorWithDomain:OSSServerErrorDomain
-                                                                  code:OSSClientErrorCodeFileCantWrite
-                                                              userInfo:@{OSSErrorMessageTOKEN: [exception description]}]];
-            }
-        }
-    } else
-    {
-        if (!_collectingData)
-        {
-            _collectingData = [[NSMutableData alloc] initWithData:data];
-        }
-        else
-        {
-            [_collectingData appendData:data];
-        }
-    }
-    return [OSSTask taskWithResult:nil];
-}
-
-- (void)parseResponseHeader:(NSHTTPURLResponse *)response toResultObject:(OSSResult *)result
-{
-    result.httpResponseCode = [_response statusCode];
-    result.httpResponseHeaderFields = [NSDictionary dictionaryWithDictionary:[_response allHeaderFields]];
-    [[_response allHeaderFields] enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
-        NSString * keyString = (NSString *)key;
-        if ([keyString isEqualToString:@"x-oss-request-id"])
-        {
-            result.requestId = obj;
-        }
-        else if ([keyString isEqualToString:@"x-oss-hash-crc64ecma"])
-        {
-            result.remoteCRC64ecma = obj;
-        }
-    }];
-}
-
-- (NSDictionary *)parseResponseHeaderToGetMeta:(NSHTTPURLResponse *)response
-{
-    NSMutableDictionary * meta = [NSMutableDictionary new];
-    
-    /* define a constant array to contain all meta header name */
-    static NSArray * OSSObjectMetaFieldNames = nil;
-    static dispatch_once_t onceToken;
-    dispatch_once(&onceToken, ^{
-        OSSObjectMetaFieldNames = @[@"Content-Type", @"Content-Length", @"Etag", @"Last-Modified", @"x-oss-request-id", @"x-oss-object-type",
-                                    @"If-Modified-Since", @"If-Unmodified-Since", @"If-Match", @"If-None-Match"];
-    });
-    /****************************************************************/
-    
-    [[_response allHeaderFields] enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
-        NSString * keyString = (NSString *)key;
-        if ([OSSObjectMetaFieldNames containsObject:keyString] || [keyString hasPrefix:@"x-oss-meta"]) {
-            [meta setObject:obj forKey:key];
-        }
-    }];
-    return meta;
-}
-
-- (nullable id)constructResultObject
-{
-    if (self.onRecieveBlock)
-    {
-        return nil;
-    }
-    
-    switch (_operationTypeForThisParser)
-    {
-        case OSSOperationTypeGetService:
-        {
-            OSSGetServiceResult * getServiceResult = [OSSGetServiceResult new];
-            if (_response)
-            {
-                [self parseResponseHeader:_response toResultObject:getServiceResult];
-            }
-            if (_collectingData)
-            {
-                NSDictionary * parseDict = [NSDictionary oss_dictionaryWithXMLData:_collectingData];
-                OSSLogVerbose(@"Get service dict: %@", parseDict);
-                if (parseDict)
-                {
-                    getServiceResult.ownerId = [[parseDict objectForKey:OSSOwnerXMLTOKEN] objectForKey:OSSIDXMLTOKEN];
-                    getServiceResult.ownerDispName = [[parseDict objectForKey:OSSOwnerXMLTOKEN] objectForKey:OSSDisplayNameXMLTOKEN];
-                    getServiceResult.prefix = [parseDict objectForKey:OSSPrefixXMLTOKEN];
-                    getServiceResult.marker = [parseDict objectForKey:OSSMarkerXMLTOKEN];
-                    getServiceResult.maxKeys = [[parseDict objectForKey:OSSMaxKeysXMLTOKEN] intValue];
-                    getServiceResult.isTruncated = [[parseDict objectForKey:OSSIsTruncatedXMLTOKEN] boolValue];
-                    
-                    id bucketObject = [[parseDict objectForKey:OSSBucketsXMLTOKEN] objectForKey:OSSBucketXMLTOKEN];
-                    if ([bucketObject isKindOfClass:[NSArray class]]) {
-                        getServiceResult.buckets = bucketObject;
-                    } else if ([bucketObject isKindOfClass:[NSDictionary class]]) {
-                        NSArray * arr = [NSArray arrayWithObject:bucketObject];
-                        getServiceResult.buckets = arr;
-                    } else {
-                        getServiceResult.buckets = nil;
-                    }
-                }
-            }
-            return getServiceResult;
-        }
-            
-        case OSSOperationTypeCreateBucket:
-        {
-            OSSCreateBucketResult * createBucketResult = [OSSCreateBucketResult new];
-            if (_response)
-            {
-                [self parseResponseHeader:_response toResultObject:createBucketResult];
-                [_response.allHeaderFields enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
-                    if ([((NSString *)key) isEqualToString:@"Location"]) {
-                        createBucketResult.location = obj;
-                        *stop = YES;
-                    }
-                }];
-            }
-            return createBucketResult;
-        }
-            
-        case OSSOperationTypeGetBucketACL:
-        {
-            OSSGetBucketACLResult * getBucketACLResult = [OSSGetBucketACLResult new];
-            if (_response)
-            {
-                [self parseResponseHeader:_response toResultObject:getBucketACLResult];
-            }
-            if (_collectingData)
-            {
-                NSDictionary * parseDict = [NSDictionary oss_dictionaryWithXMLData:_collectingData];
-                OSSLogVerbose(@"Get service dict: %@", parseDict);
-                if (parseDict)
-                {
-                    getBucketACLResult.aclGranted = [[parseDict objectForKey:OSSAccessControlListXMLTOKEN] objectForKey:OSSGrantXMLTOKEN];
-                }
-            }
-            return getBucketACLResult;
-        }
-            
-        case OSSOperationTypeDeleteBucket:
-        {
-            OSSDeleteBucketResult * deleteBucketResult = [OSSDeleteBucketResult new];
-            if (_response) {
-                [self parseResponseHeader:_response toResultObject:deleteBucketResult];
-            }
-            return deleteBucketResult;
-        }
-            
-        case OSSOperationTypeGetBucket:
-        {
-            OSSGetBucketResult * getBucketResult = [OSSGetBucketResult new];
-            if (_response) {
-                [self parseResponseHeader:_response toResultObject:getBucketResult];
-            }
-            if (_collectingData) {
-                NSDictionary * parsedDict = [NSDictionary oss_dictionaryWithXMLData:_collectingData];
-                OSSLogVerbose(@"Get bucket dict: %@", parsedDict);
-                
-                if (parsedDict) {
-                    getBucketResult.bucketName = [parsedDict objectForKey:OSSNameXMLTOKEN];
-                    getBucketResult.prefix = [parsedDict objectForKey:OSSPrefixXMLTOKEN];
-                    getBucketResult.marker = [parsedDict objectForKey:OSSMarkerXMLTOKEN];
-                    getBucketResult.nextMarker = [parsedDict objectForKey:OSSNextMarkerXMLTOKEN];
-                    getBucketResult.maxKeys = (int32_t)[[parsedDict objectForKey:OSSMaxKeysXMLTOKEN] integerValue];
-                    getBucketResult.delimiter = [parsedDict objectForKey:OSSDelimiterXMLTOKEN];
-                    getBucketResult.isTruncated = [[parsedDict objectForKey:OSSIsTruncatedXMLTOKEN] boolValue];
-                    
-                    id contentObject = [parsedDict objectForKey:OSSContentsXMLTOKEN];
-                    if ([contentObject isKindOfClass:[NSArray class]]) {
-                        getBucketResult.contents = contentObject;
-                    } else if ([contentObject isKindOfClass:[NSDictionary class]]) {
-                        NSArray * arr = [NSArray arrayWithObject:contentObject];
-                        getBucketResult.contents = arr;
-                    } else {
-                        getBucketResult.contents = nil;
-                    }
-                    
-                    NSMutableArray * commentPrefixesArr = [NSMutableArray new];
-                    id commentPrefixes = [parsedDict objectForKey:OSSCommonPrefixesXMLTOKEN];
-                    if ([commentPrefixes isKindOfClass:[NSArray class]]) {
-                        for (NSDictionary * prefix in commentPrefixes) {
-                            [commentPrefixesArr addObject:[prefix objectForKey:@"Prefix"]];
-                        }
-                    } else if ([commentPrefixes isKindOfClass:[NSDictionary class]]) {
-                        [commentPrefixesArr addObject:[(NSDictionary *)commentPrefixes objectForKey:@"Prefix"]];
-                    } else {
-                        commentPrefixesArr = nil;
-                    }
-                    
-                    getBucketResult.commentPrefixes = commentPrefixesArr;
-                }
-            }
-            return getBucketResult;
-        }
-            
-        case OSSOperationTypeListMultipartUploads:
-        {
-            OSSListMultipartUploadsResult * listMultipartUploadsResult = [OSSListMultipartUploadsResult new];
-            if (_response) {
-                [self parseResponseHeader:_response toResultObject:listMultipartUploadsResult];
-            }
-            if (_collectingData) {
-                NSDictionary * parsedDict = [NSDictionary oss_dictionaryWithXMLData:_collectingData];
-                OSSLogVerbose(@"List multipart uploads dict: %@", parsedDict);
-                
-                if (parsedDict) {
-                    listMultipartUploadsResult.bucketName = [parsedDict objectForKey:OSSBucketXMLTOKEN];
-                    listMultipartUploadsResult.prefix = [parsedDict objectForKey:OSSPrefixXMLTOKEN];
-                    listMultipartUploadsResult.uploadIdMarker = [parsedDict objectForKey:OSSUploadIdMarkerXMLTOKEN];
-                    listMultipartUploadsResult.nextUploadIdMarker = [parsedDict objectForKey:OSSUploadIdMarkerXMLTOKEN];
-                    listMultipartUploadsResult.keyMarker = [parsedDict objectForKey:OSSKeyMarkerXMLTOKEN];
-                    listMultipartUploadsResult.nextKeyMarker = [parsedDict objectForKey:OSSNextKeyMarkerXMLTOKEN];
-                    listMultipartUploadsResult.maxUploads = (int32_t)[[parsedDict objectForKey:OSSMaxUploadsXMLTOKEN] integerValue];
-                    listMultipartUploadsResult.delimiter = [parsedDict objectForKey:OSSDelimiterXMLTOKEN];
-                    listMultipartUploadsResult.isTruncated = [[parsedDict objectForKey:OSSIsTruncatedXMLTOKEN] boolValue];
-                    
-                    id contentObject = [parsedDict objectForKey:OSSUploadXMLTOKEN];
-                    if ([contentObject isKindOfClass:[NSArray class]]) {
-                        listMultipartUploadsResult.uploads = contentObject;
-                    } else if ([contentObject isKindOfClass:[NSDictionary class]]) {
-                        NSArray * arr = [NSArray arrayWithObject:contentObject];
-                        listMultipartUploadsResult.uploads = arr;
-                    } else {
-                        listMultipartUploadsResult.uploads = nil;
-                    }
-                    
-                    NSMutableArray * commentPrefixesArr = [NSMutableArray new];
-                    id commentPrefixes = [parsedDict objectForKey:OSSCommonPrefixesXMLTOKEN];
-                    if ([commentPrefixes isKindOfClass:[NSArray class]]) {
-                        for (NSDictionary * prefix in commentPrefixes) {
-                            [commentPrefixesArr addObject:[prefix objectForKey:@"Prefix"]];
-                        }
-                    } else if ([commentPrefixes isKindOfClass:[NSDictionary class]]) {
-                        [commentPrefixesArr addObject:[(NSDictionary *)commentPrefixes objectForKey:@"Prefix"]];
-                    } else {
-                        commentPrefixesArr = nil;
-                    }
-                    
-                    listMultipartUploadsResult.commonPrefixes = commentPrefixesArr;
-                }
-            }
-            return listMultipartUploadsResult;
-        }
-            
-        case OSSOperationTypeHeadObject:
-        {
-            OSSHeadObjectResult * headObjectResult = [OSSHeadObjectResult new];
-            if (_response)
-            {
-                [self parseResponseHeader:_response toResultObject:headObjectResult];
-                headObjectResult.objectMeta = [self parseResponseHeaderToGetMeta:_response];
-            }
-            return headObjectResult;
-        }
-            
-        case OSSOperationTypeGetObject:
-        {
-            OSSGetObjectResult * getObejctResult = [OSSGetObjectResult new];
-            OSSLogDebug(@"GetObjectResponse: %@", _response);
-            if (_response)
-            {
-                [self parseResponseHeader:_response toResultObject:getObejctResult];
-                getObejctResult.objectMeta = [self parseResponseHeaderToGetMeta:_response];
-                if (_crc64ecma != 0)
-                {
-                    getObejctResult.localCRC64ecma = [NSString stringWithFormat:@"%llu",_crc64ecma];
-                }
-            }
-            if (_fileHandle) {
-                [_fileHandle closeFile];
-            }
-            
-            if (_collectingData) {
-                getObejctResult.downloadedData = _collectingData;
-            }
-            return getObejctResult;
-        }
-        case OSSOperationTypeGetObjectACL:
-        {
-            OSSGetObjectACLResult * getObjectACLResult = [OSSGetObjectACLResult new];
-            OSSLogDebug(@"GetObjectResponse: %@", _response);
-            if (_response)
-            {
-                [self parseResponseHeader:_response toResultObject:getObjectACLResult];
-            }
-            
-            if (_collectingData) {
-                NSDictionary * parseDict = [NSDictionary oss_dictionaryWithXMLData:_collectingData];
-                OSSLogVerbose(@"Get service dict: %@", parseDict);
-                getObjectACLResult.grant = parseDict[@"AccessControlList"][@"Grant"];
-            }
-            
-            
-            return getObjectACLResult;
-        }
-            
-        case OSSOperationTypePutObject:
-        {
-            OSSPutObjectResult * putObjectResult = [OSSPutObjectResult new];
-            if (_response)
-            {
-                [self parseResponseHeader:_response toResultObject:putObjectResult];
-                [_response.allHeaderFields enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
-                    if ([((NSString *)key) isEqualToString:@"Etag"]) {
-                        putObjectResult.eTag = obj;
-                        *stop = YES;
-                    }
-                }];
-            }
-            if (_collectingData) {
-                putObjectResult.serverReturnJsonString = [[NSString alloc] initWithData:_collectingData encoding:NSUTF8StringEncoding];
-            }
-            return putObjectResult;
-        }
-            
-        case OSSOperationTypeAppendObject:
-        {
-            OSSAppendObjectResult * appendObjectResult = [OSSAppendObjectResult new];
-            if (_response) {
-                [self parseResponseHeader:_response toResultObject:appendObjectResult];
-                [_response.allHeaderFields enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
-                    if ([((NSString *)key) isEqualToString:@"Etag"]) {
-                        appendObjectResult.eTag = obj;
-                    }
-                    if ([((NSString *)key) isEqualToString:@"x-oss-next-append-position"]) {
-                        appendObjectResult.xOssNextAppendPosition = [((NSString *)obj) longLongValue];
-                    }
-                }];
-            }
-            return appendObjectResult;
-        }
-            
-        case OSSOperationTypeDeleteObject: {
-            OSSDeleteObjectResult * deleteObjectResult = [OSSDeleteObjectResult new];
-            if (_response) {
-                [self parseResponseHeader:_response toResultObject:deleteObjectResult];
-            }
-            return deleteObjectResult;
-        }
-        case OSSOperationTypeDeleteMultipleObjects: {
-            OSSDeleteMultipleObjectsResult * deleteObjectResult = [OSSDeleteMultipleObjectsResult new];
-            if (_response) {
-                [self parseResponseHeader:_response toResultObject:deleteObjectResult];
-            }
-            
-            if (_collectingData) {
-                NSDictionary *dict = [NSDictionary oss_dictionaryWithXMLData:_collectingData];
-                deleteObjectResult.encodingType = dict[@"EncodingType"];
-                deleteObjectResult.deletedObjects = dict[@"Deleted"];
-            }
-            
-            return deleteObjectResult;
-        }
-        case OSSOperationTypePutObjectACL: {
-            OSSPutObjectACLResult * putObjectACLResult = [OSSPutObjectACLResult new];
-            if (_response) {
-                [self parseResponseHeader:_response toResultObject:putObjectACLResult];
-            }
-            return putObjectACLResult;
-        }
-            
-        case OSSOperationTypeCopyObject: {
-            OSSCopyObjectResult * copyObjectResult = [OSSCopyObjectResult new];
-            if (_response) {
-                [self parseResponseHeader:_response toResultObject:copyObjectResult];
-            }
-            if (_collectingData) {
-                OSSLogVerbose(@"copy object dict: %@", [NSDictionary oss_dictionaryWithXMLData:_collectingData]);
-                NSDictionary * parsedDict = [NSDictionary oss_dictionaryWithXMLData:_collectingData];
-                if (parsedDict) {
-                    copyObjectResult.lastModifed = [parsedDict objectForKey:OSSLastModifiedXMLTOKEN];
-                    copyObjectResult.eTag = [parsedDict objectForKey:OSSETagXMLTOKEN];
-                }
-            }
-            return copyObjectResult;
-        }
-            
-        case OSSOperationTypeInitMultipartUpload: {
-            OSSInitMultipartUploadResult * initMultipartUploadResult = [OSSInitMultipartUploadResult new];
-            if (_response) {
-                [self parseResponseHeader:_response toResultObject:initMultipartUploadResult];
-            }
-            if (_collectingData) {
-                NSDictionary * parsedDict = [NSDictionary oss_dictionaryWithXMLData:_collectingData];
-                OSSLogVerbose(@"init multipart upload result: %@", parsedDict);
-                if (parsedDict) {
-                    initMultipartUploadResult.uploadId = [parsedDict objectForKey:OSSUploadIdXMLTOKEN];
-                }
-            }
-            return initMultipartUploadResult;
-        }
-            
-        case OSSOperationTypeUploadPart: {
-            OSSUploadPartResult * uploadPartResult = [OSSUploadPartResult new];
-            if (_response) {
-                [self parseResponseHeader:_response toResultObject:uploadPartResult];
-                [_response.allHeaderFields enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
-                    if ([((NSString *)key) isEqualToString:@"Etag"]) {
-                        uploadPartResult.eTag = obj;
-                        *stop = YES;
-                    }
-                }];
-            }
-            return uploadPartResult;
-        }
-            
-        case OSSOperationTypeCompleteMultipartUpload: {
-            OSSCompleteMultipartUploadResult * completeMultipartUploadResult = [OSSCompleteMultipartUploadResult new];
-            if (_response) {
-                [self parseResponseHeader:_response toResultObject:completeMultipartUploadResult];
-            }
-            if (_collectingData) {
-                if ([[[_response.allHeaderFields objectForKey:OSSHttpHeaderContentType] description] isEqual:@"application/xml"]) {
-                    OSSLogVerbose(@"complete multipart upload result: %@", [NSDictionary oss_dictionaryWithXMLData:_collectingData]);
-                    NSDictionary * parsedDict = [NSDictionary oss_dictionaryWithXMLData:_collectingData];
-                    if (parsedDict) {
-                        completeMultipartUploadResult.location = [parsedDict objectForKey:OSSLocationXMLTOKEN];
-                        completeMultipartUploadResult.eTag = [parsedDict objectForKey:OSSETagXMLTOKEN];
-                    }
-                } else {
-                    completeMultipartUploadResult.serverReturnJsonString = [[NSString alloc] initWithData:_collectingData encoding:NSUTF8StringEncoding];
-                }
-            }
-            return completeMultipartUploadResult;
-        }
-            
-        case OSSOperationTypeListMultipart: {
-            OSSListPartsResult * listPartsReuslt = [OSSListPartsResult new];
-            if (_response) {
-                [self parseResponseHeader:_response toResultObject:listPartsReuslt];
-            }
-            if (_collectingData) {
-                NSDictionary * parsedDict = [NSDictionary oss_dictionaryWithXMLData:_collectingData];
-                OSSLogVerbose(@"list multipart upload result: %@", parsedDict);
-                if (parsedDict) {
-                    listPartsReuslt.nextPartNumberMarker = [[parsedDict objectForKey:OSSNextPartNumberMarkerXMLTOKEN] intValue];
-                    listPartsReuslt.maxParts = [[parsedDict objectForKey:OSSMaxPartsXMLTOKEN] intValue];
-                    listPartsReuslt.isTruncated = [[parsedDict objectForKey:OSSIsTruncatedXMLTOKEN] boolValue];
-                    
-                    id partsObject = [parsedDict objectForKey:OSSPartXMLTOKEN];
-                    if ([partsObject isKindOfClass:[NSArray class]]) {
-                        listPartsReuslt.parts = partsObject;
-                    } else if ([partsObject isKindOfClass:[NSDictionary class]]) {
-                        NSArray * arr = [NSArray arrayWithObject:partsObject];
-                        listPartsReuslt.parts = arr;
-                    } else {
-                        listPartsReuslt.parts = nil;
-                    }
-                }
-            }
-            return listPartsReuslt;
-        }
-            
-        case OSSOperationTypeAbortMultipartUpload: {
-            OSSAbortMultipartUploadResult * abortMultipartUploadResult = [OSSAbortMultipartUploadResult new];
-            if (_response) {
-                [self parseResponseHeader:_response toResultObject:abortMultipartUploadResult];
-            }
-            return abortMultipartUploadResult;
-        }
-        case OSSOperationTypeTriggerCallBack: {
-            OSSCallBackResult *callbackResult = [OSSCallBackResult new];
-            if (_response) {
-                [self parseResponseHeader:_response toResultObject:callbackResult];
-            }
-            
-            if (_collectingData) {
-                if ([[[_response.allHeaderFields objectForKey:OSSHttpHeaderContentType] description] isEqual:@"application/xml"]) {
-                    NSDictionary * parsedDict = [NSDictionary oss_dictionaryWithXMLData:_collectingData];
-                    OSSLogVerbose(@"callback trigger result<xml>: %@", parsedDict);
-                    callbackResult.serverReturnXML = parsedDict;
-                } else if ([[[_response.allHeaderFields objectForKey:OSSHttpHeaderContentType] description] isEqual:@"application/json"]) {
-                    callbackResult.serverReturnJsonString = [[NSString alloc] initWithData:_collectingData encoding:NSUTF8StringEncoding];
-                    OSSLogVerbose(@"callback trigger result<json>: %@", callbackResult.serverReturnJsonString);
-                }
-            }
-            return callbackResult;
-        }
-        case OSSOperationTypeImagePersist: {
-            OSSImagePersistResult *imagePersistResult = [OSSImagePersistResult new];
-            if (_response) {
-                [self parseResponseHeader:_response toResultObject:imagePersistResult];
-            }
-            return imagePersistResult;
-        }
-        case OSSOperationTypeGetBucketInfo: {
-            OSSGetBucketInfoResult *bucketInfoResult = [[OSSGetBucketInfoResult alloc] init];
-            if (_collectingData)
-            {
-                NSDictionary * parseDict = [NSDictionary oss_dictionaryWithXMLData:_collectingData];
-                if ([parseDict valueForKey:@"Bucket"])
-                {
-                    NSDictionary *result = [parseDict valueForKey:@"Bucket"];
-                    OSSLogVerbose(@"Get bucketInfo dict: %@", parseDict);
-                    bucketInfoResult.bucketName = [result valueForKey:@"Name"];
-                    bucketInfoResult.storageClass = [result valueForKey:@"StorageClass"];
-                    bucketInfoResult.location = [result valueForKey:@"Location"];
-                    bucketInfoResult.intranetEndpoint = [result valueForKey:@"IntranetEndpoint"];
-                    bucketInfoResult.extranetEndpoint = [result valueForKey:@"ExtranetEndpoint"];
-                    bucketInfoResult.creationDate = [result valueForKey:@"CreationDate"];
-                    
-                    if ([result valueForKey:@"Owner"]) {
-                        bucketInfoResult.owner = [[OSSBucketOwner alloc] init];
-                        bucketInfoResult.owner.userName = [[result valueForKey:@"Owner"] valueForKey:@"DisplayName"];
-                        bucketInfoResult.owner.userId = [[result valueForKey:@"Owner"] valueForKey:@"ID"];
-                    }
-                    
-                    if ([result valueForKey:@"AccessControlList"]) {
-                        bucketInfoResult.acl = [OSSAccessControlList new];
-                        bucketInfoResult.acl.grant = [[result valueForKey:@"AccessControlList"] valueForKey:@"Grant"];
-                    }
-                }
-            }
-            if (_response) {
-                [self parseResponseHeader:_response toResultObject:bucketInfoResult];
-            }
-            return bucketInfoResult;
-        }
-        case OSSOperationTypeRestoreObject: {
-            OSSRestoreObjectResult * restoreObjectResult = [OSSRestoreObjectResult new];
-            if (_response) {
-                [self parseResponseHeader:_response toResultObject:restoreObjectResult];
-            }
-            return restoreObjectResult;
-        }
-        case OSSOperationTypePutSymlink: {
-            OSSPutSymlinkResult * putSymlinkResult = [OSSPutSymlinkResult new];
-            if (_response) {
-                [self parseResponseHeader:_response toResultObject:putSymlinkResult];
-            }
-            return putSymlinkResult;
-        }
-        case OSSOperationTypeGetSymlink: {
-            OSSGetSymlinkResult * getSymlinkResult = [OSSGetSymlinkResult new];
-            if (_response) {
-                [self parseResponseHeader:_response toResultObject:getSymlinkResult];
-            }
-            return getSymlinkResult;
-        }
-        default: {
-            OSSLogError(@"unknown operation type");
-            break;
-        }
-    }
-    return nil;
-}
-
-@end

+ 0 - 16
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSHttpdns.h

@@ -1,16 +0,0 @@
-//
-//  OSSHttpdns.h
-//  AliyunOSSiOS
-//
-//  Created by zhouzhuo on 5/1/16.
-//  Copyright © 2016 zhouzhuo. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-
-@interface OSSHttpdns : NSObject
-
-+ (instancetype)sharedInstance;
-
-- (NSString *)asynGetIpByHost:(NSString *)host;
-@end

+ 0 - 147
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSHttpdns.m

@@ -1,147 +0,0 @@
-//
-//  OSSHttpdns.m
-//  AliyunOSSiOS
-//
-//  Created by zhouzhuo on 5/1/16.
-//  Copyright © 2016 zhouzhuo. All rights reserved.
-//
-
-#import "OSSLog.h"
-#import "OSSHttpdns.h"
-#import "OSSIPv6Adapter.h"
-
-NSString * const OSS_HTTPDNS_SERVER_IP = @"203.107.1.1";
-NSString * const OSS_HTTPDNS_SERVER_PORT = @"80";
-
-NSString * const ACCOUNT_ID = @"181345";
-NSTimeInterval const MAX_ENDURABLE_EXPIRED_TIME_IN_SECOND = 60; // The DNS entry's expiration time in seconds. After it expires, the entry is invalid.
-NSTimeInterval const PRERESOLVE_IN_ADVANCE_IN_SECOND = 10; // Once the remaining valid time of an DNS entry is less than this number, issue a DNS request to prefetch the data.
-
-@interface IpObject : NSObject
-
-@property (nonatomic, copy) NSString * ip;
-@property (nonatomic, assign) NSTimeInterval expiredTime;
-
-@end
-
-@implementation IpObject
-@end
-
-
-@implementation OSSHttpdns {
-    NSMutableDictionary * gHostIpMap;
-    NSMutableSet * penddingSet;
-}
-
-+ (instancetype)sharedInstance {
-    static OSSHttpdns * sharedInstance = nil;
-    static dispatch_once_t onceToken;
-    dispatch_once(&onceToken, ^{
-        sharedInstance = [OSSHttpdns new];
-    });
-    return sharedInstance;
-}
-
-- (instancetype)init {
-    if (self = [super init]) {
-        gHostIpMap = [NSMutableDictionary new];
-        penddingSet = [NSMutableSet new];
-    }
-    return self;
-}
-
-/**
- *  OSS SDK specific
- *
- *  @param host it needs strictly follow the domain's format, such as oss-cn-hangzhou.aliyuncs.com
- *
- *  @return an ip in the ip list of the resolved host.
- */
-- (NSString *)asynGetIpByHost:(NSString *)host {
-    IpObject * ipObject = [gHostIpMap objectForKey:host];
-    if (!ipObject) {
-
-        // if the host is not resolved, asynchronously resolve it and return nil
-        [self resolveHost:host];
-        return nil;
-    } else if ([[NSDate date] timeIntervalSince1970] - ipObject.expiredTime > MAX_ENDURABLE_EXPIRED_TIME_IN_SECOND) {
-
-        // If the entry is expired, asynchronously resolve it and return nil.
-        [self resolveHost:host];
-        return nil;
-    } else if (ipObject.expiredTime -[[NSDate date] timeIntervalSince1970] < PRERESOLVE_IN_ADVANCE_IN_SECOND) {
-
-        // If the entry is about to expire, asynchronously resolve it and return the current value.
-        [self resolveHost:host];
-        return ipObject.ip;
-    } else {
-
-        // returns the current result.
-        return ipObject.ip;
-    }
-}
-
-/**
- *  resolve the host asynchronously
-
- *  If the host is being resolved, the call will be skipped.
- *
- *  @param host the host to resolve
- */
-- (void)resolveHost:(NSString *)host {
-
-    @synchronized (self) {
-        if ([penddingSet containsObject:host]) {
-            return;
-        } else {
-            [penddingSet addObject:host];
-        }
-    }
-
-    NSURL * url = [NSURL URLWithString:[NSString stringWithFormat:@"https://%@/%@/d?host=%@", [[OSSIPv6Adapter getInstance] handleIpv4Address:OSS_HTTPDNS_SERVER_IP], ACCOUNT_ID, host]];
-    NSURLSession * session = [NSURLSession sharedSession];
-
-    NSURLSessionDataTask * dataTask = [session dataTaskWithURL:url completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
-
-        IpObject * ipObject = nil;
-        NSUInteger statusCode = ((NSHTTPURLResponse *)response).statusCode;
-        if (statusCode != 200) {
-            OSSLogError(@"Httpdns resolve host: %@ failed, responseCode: %lu", host, (unsigned long)statusCode);
-        } else {
-            NSError *error = nil;
-            NSDictionary *json = nil;
-            if (data != nil){
-                json = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&error];
-            }
-            
-            if (error != nil || json == nil){
-                return;
-            }
-
-            NSTimeInterval expiredTime = [[NSDate new] timeIntervalSince1970] + [[json objectForKey:@"ttl"] longLongValue];
-
-            NSArray *ips = [json objectForKey:@"ips"];
-            if (ips == nil || [ips count] == 0) {
-                OSSLogError(@"Httpdns resolve host: %@ failed, ip list empty.", host);
-            } else {
-                NSString * ip = ips[0];
-                ipObject = [IpObject new];
-                ipObject.expiredTime = expiredTime;
-                ipObject.ip = ip;
-                OSSLogDebug(@"Httpdns resolve host: %@ success, ip: %@, expiredTime: %lf", host, ipObject.ip, ipObject.expiredTime);
-            }
-        }
-
-        @synchronized (self) {
-            if (ipObject) {
-                gHostIpMap[host] = ipObject;
-            }
-
-            [penddingSet removeObject:host];
-        }
-    }];
-
-    [dataTask resume];
-}
-
-@end

+ 0 - 114
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSIPv6/OSSIPv6Adapter.h

@@ -1,114 +0,0 @@
-/*
- * Copyright (c) 2000-2015 Apple Inc. All rights reserved.
- *
- * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
- *
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. The rights granted to you under the License
- * may not be used to create, or enable the creation or redistribution of,
- * unlawful or unlicensed copies of an Apple operating system, or to
- * circumvent, violate, or enable the circumvention or violation of, any
- * terms of an Apple operating system software license agreement.
- *
- * Please obtain a copy of the License at
- * https://www.opensource.apple.com/apsl/ and read it before using this file.
- *
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- *
- * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
- */
-/*
- * Copyright (c) 1980, 1986, 1993
- *	The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *	@(#)route.h	8.3 (Berkeley) 4/19/94
- * $FreeBSD: src/sys/net/route.h,v 1.36.2.1 2000/08/16 06:14:23 jayanth Exp $
- */
-
-
-#ifndef AlicloudIPv6Adapter_h
-#define AlicloudIPv6Adapter_h
-#import <Foundation/Foundation.h>
-
-@interface OSSIPv6Adapter : NSObject
-
-+ (instancetype)getInstance;
-
-/**
- *	@brief	Checks if it's a IPv6-only network. If it's true, it's IPv6-only.
- *
- *	@return return YES for IPv6-only network,otherWise return NO
- */
-- (BOOL)isIPv6OnlyNetwork;
-
-/**
- *	@brief	Refresh the IPV6-only check
- *
- *	@return return YES for IPv6-only network,otherWise return NO
- */
-- (BOOL)reResolveIPv6OnlyStatus;
-
-/**
- *	@brief	Adapts the IPv4 address into IPv6 format under IPv6-only network.
- *          For example:
-                42.156.220.114 -> 64:ff9b::2a9c:dc72
- *	@param 	addr
- *          ip address
- *
- *	@return return an IPv6 address
- */
-- (NSString *)handleIpv4Address:(NSString *)addr;
-
-/**
- *	@brief	Checks if it's an IPv4 address.
- *
- *	@return return YES while addr is an IPv4 address,otherwise return NO
- */
-- (BOOL)isIPv4Address:(NSString *)addr;
-
-/**
- *	@brief	Checks if it's an IPv6 address
- *
- *	@return return YES while addr is an IPv6 address,otherwise return NO
- */
-- (BOOL)isIPv6Address:(NSString *)addr;
-
-@end
-
-#endif /* OSSIPv6Adapter_h */

+ 0 - 197
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSIPv6/OSSIPv6Adapter.m

@@ -1,197 +0,0 @@
-//
-//  OSSIPv6Adapter.m
-//
-//  Created by lingkun on 16/5/16.
-//  Copyright © 2016 Ali. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-#import "OSSIPv6Adapter.h"
-#import "OSSIPv6PrefixResolver.h"
-#import "OSSReachabilityManager.h"
-#import "OSSLog.h"
-
-#include <arpa/inet.h>
-#include <dns.h>
-#include <err.h>
-#include <ifaddrs.h>
-#include <net/if.h>
-#include <netdb.h>
-#include <netinet/in.h>
-#include <resolv.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/socket.h>
-#include <sys/sysctl.h>
-
-#if TARGET_OS_IOS
-#import <UIKit/UIApplication.h>
-#elif TARGET_OS_OSX
-#import <AppKit/NSApplication.h>
-#endif
-
-#define UNKNOWN_STACK         0
-#define SUPPORT_IPV4_STACK    1
-#define SUPPORT_IPV6_STACK    2
-#define ROUNDUP_LEN(a) \
-((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long))
-#define TypeEN    "en0"
-
-#define IOS_9_VERSION     @"9.0"
-
-@implementation OSSIPv6Adapter
-{
-    BOOL isIPv6Only;
-    BOOL isIPv6OnlyResolved;
-}
-
-- (instancetype)init {
-    if (self = [super init]) {
-        isIPv6Only = NO;
-        isIPv6OnlyResolved = NO;
-        
-        NSString *notificationName;
-#if TARGET_OS_IOS
-        notificationName = UIApplicationDidBecomeActiveNotification;
-#elif TARGET_OS_OSX
-        notificationName = NSApplicationDidBecomeActiveNotification;
-#endif
-
-        // When App switches to active status, refresh the IPv6-only check.
-        NSNotificationCenter *defaultCenter = [NSNotificationCenter defaultCenter];
-        [defaultCenter addObserver:self
-                          selector:@selector(appDidBecomeActiveFunc)
-                              name:notificationName
-                            object:nil];
-    }
-    return self;
-}
-
-+ (instancetype)getInstance {
-    static id singletonInstance = nil;
-    static dispatch_once_t once_token;
-    dispatch_once(&once_token, ^{
-        if (!singletonInstance) {
-            singletonInstance = [[super allocWithZone:NULL] init];
-        }
-    });
-    return singletonInstance;
-}
-
-- (BOOL)isIPv6OnlyNetwork {
-    @synchronized(self) {
-        if (isIPv6OnlyResolved) {
-            return isIPv6Only;
-        }
-        
-        OSSLogDebug(@"Start resolved network to see if in IPv6-Only env.");
-        int localStack = 0;
-        
-        localStack = SUPPORT_IPV4_STACK | SUPPORT_IPV6_STACK;
-        localStack &= [self getDNSServersIpStack];
-        
-        if (localStack & SUPPORT_IPV4_STACK) {
-            // support IPv4
-            isIPv6Only = NO;
-        } else if (localStack & SUPPORT_IPV6_STACK) {
-            // IPv6-Only
-            isIPv6Only = YES;
-            [[OSSIPv6PrefixResolver getInstance] updateIPv6Prefix];
-        } else {
-            OSSLogDebug(@"[%s]: Error.", __FUNCTION__);
-            isIPv6Only = NO;
-        }
-        isIPv6OnlyResolved = YES;
-        if (isIPv6Only) {
-            OSSLogDebug(@"[%s]: IPv6-Only network now.", __FUNCTION__);
-        } else {
-            OSSLogDebug(@"[%s]: Not IPv6-Only network now.", __FUNCTION__);
-        }
-        return isIPv6Only;
-    }
-}
-
-- (void)appDidBecomeActiveFunc {
-    OSSLogDebug(@"[%s]: App become active, refresh IPv6-Only status.", __FUNCTION__);
-    [self reResolveIPv6OnlyStatus];
-}
-
-- (BOOL)reResolveIPv6OnlyStatus {
-    isIPv6OnlyResolved = NO;
-    return [self isIPv6OnlyNetwork];
-}
-
-- (NSString *)handleIpv4Address:(NSString *)addr {
-    if (addr == nil || addr.length == 0) {
-        return nil;
-    }
-    
-    if ([self isIPv6Address:addr]) return [NSString stringWithFormat:@"[%@]", addr];
-    
-    NSString *convertedAddr;
-    if ([self isIPv6OnlyNetwork]) {
-        convertedAddr = [[OSSIPv6PrefixResolver getInstance] convertIPv4toIPv6:addr];
-        return [NSString stringWithFormat:@"[%@]", convertedAddr];
-    } else  {
-        convertedAddr = addr;
-    }
-    return convertedAddr;
-}
-
-/**
- *	@brief	Looks up the DNS server stack and returns the flag combinations of SUPPORT_IPV4_STACK and SUPPORT_IPV6_STACK.
- *
- *	@return the flag combinations of SUPPORT_IPV4_STACK and SUPPORT_IPV6_STACK
- */
-- (int)getDNSServersIpStack {
-    int dns_stack = 0;
-    res_state res = malloc(sizeof(struct __res_state));
-    int result = res_ninit(res);
-    if (result == 0) {
-        union res_9_sockaddr_union *addr_union = malloc(res->nscount * sizeof(union res_9_sockaddr_union));
-        res_getservers(res, addr_union, res->nscount);
-        for (int i = 0; i < res->nscount; i++) {
-            if (addr_union[i].sin.sin_family == AF_INET) {
-                char ip[INET_ADDRSTRLEN];
-                if (inet_ntop(AF_INET, &(addr_union[i].sin.sin_addr), ip, INET_ADDRSTRLEN)) {
-                    dns_stack |= SUPPORT_IPV4_STACK;
-                }
-            } else if (addr_union[i].sin6.sin6_family == AF_INET6) {
-                char ip[INET6_ADDRSTRLEN];
-                if (inet_ntop(AF_INET6, &(addr_union[i].sin6.sin6_addr), ip, INET6_ADDRSTRLEN)) {
-                    dns_stack |= SUPPORT_IPV6_STACK;
-                }
-            } else {
-                OSSLogDebug(@"%s: Undefined family.", __FUNCTION__);
-            }
-        }
-        free(addr_union);
-    }
-    res_ndestroy(res);
-    free(res);
-    return dns_stack;
-}
-
-- (BOOL)isIPv4Address:(NSString *)addr {
-    if (addr == nil) {
-        return NO;
-    }
-    const char *utf8 = [addr UTF8String];
-    // Check valid IPv4.
-    struct in_addr dst;
-    int success = inet_pton(AF_INET, utf8, &(dst.s_addr));
-    return success == 1;
-}
-
-- (BOOL)isIPv6Address:(NSString *)addr {
-    if (addr == nil) {
-        return NO;
-    }
-    const char *utf8 = [addr UTF8String];
-    // Check valid IPv6.
-    struct in6_addr dst6;
-    int success = inet_pton(AF_INET6, utf8, &dst6);
-    return (success == 1);
-}
-
-@end

+ 0 - 23
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSIPv6/OSSIPv6PrefixResolver.h

@@ -1,23 +0,0 @@
-//
-//  OSSIPv6PrefixResolver.h
-//
-//  Created by lingkun on 16/5/16.
-//  Edit by zhouzhuo on 16/5/22
-//  Copyright © 2016 Ali. All rights reserved.
-//
-
-#ifndef AlicloudIPv6PrefixResolver_h
-#define AlicloudIPv6PrefixResolver_h
-#import <Foundation/Foundation.h>
-
-@interface OSSIPv6PrefixResolver : NSObject
-
-+ (instancetype)getInstance;
-
-- (void)updateIPv6Prefix;
-
-- (NSString *)convertIPv4toIPv6:(NSString *)ipv4;
-
-@end
-
-#endif /* OSSIPv6PrefixResolver_h */

+ 0 - 205
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSIPv6/OSSIPv6PrefixResolver.m

@@ -1,205 +0,0 @@
-//
-//  OSSIPv6PrefixResolver.m
-//
-//  Created by lingkun on 16/5/16.
-//  Edit by zhouzhuo on 2016/5/22
-//  Copyright © 2016 Ali. All rights reserved.
-
-#import "OSSIPv6PrefixResolver.h"
-#import "OSSLog.h"
-
-#import <Foundation/Foundation.h>
-#include <arpa/inet.h>
-#include <netdb.h>
-#include <netinet/in.h>
-#include <sys/socket.h>
-
-static const __uint8_t NS_PREFIX_32[4] = {0x20, 0x01, 0x0d, 0xb8};
-static const __uint8_t NS_PREFIX_40[5] = {0x20, 0x01, 0x0d, 0xb8, 0x01};
-static const __uint8_t NS_PREFIX_48[6] = {0x20, 0x01, 0x0d, 0xb8, 0x01, 0x22};
-static const __uint8_t NS_PREFIX_56[7] = {0x20, 0x01, 0x0d, 0xb8, 0x01, 0x22, 0x03};
-static const __uint8_t NS_PREFIX_64[8] = {0x20, 0x01, 0x0d, 0xb8, 0x01, 0x22, 0x03, 0x44};
-static const __uint8_t NS_PREFIX_96[12] = {0x20, 0x01, 0x0d, 0xb8, 0x01, 0x22, 0x03, 0x44, 0x00, 0x00, 0x00, 0x00};
-static const __uint8_t WK_PREFIX_96[12] = {0x00, 0x64, 0xff, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
-
-static const __uint8_t* V6_PREFIX_CONTENT_TABLE[7] = {
-    WK_PREFIX_96,
-    NS_PREFIX_32,
-    NS_PREFIX_40,
-    NS_PREFIX_48,
-    NS_PREFIX_56,
-    NS_PREFIX_64,
-    NS_PREFIX_96};
-
-static const __uint8_t V6_PREFIX_SIZE_TABLE[7] = {
-    sizeof(WK_PREFIX_96)/sizeof(__uint8_t),
-    sizeof(NS_PREFIX_32)/sizeof(__uint8_t),
-    sizeof(NS_PREFIX_40)/sizeof(__uint8_t),
-    sizeof(NS_PREFIX_48)/sizeof(__uint8_t),
-    sizeof(NS_PREFIX_56)/sizeof(__uint8_t),
-    sizeof(NS_PREFIX_64)/sizeof(__uint8_t),
-    sizeof(NS_PREFIX_96)/sizeof(__uint8_t)};
-
-static const __uint8_t V6_PREFIX_TABLE_SIZE = 7;
-
-typedef enum {
-    IPv6PrefixUnResolved = 0,
-    IPv6PrefixResolving,
-    IPv6PrefixResolved
-} IPv6PrefixResolveStatus;
-
-@implementation OSSIPv6PrefixResolver {
-    IPv6PrefixResolveStatus ipv6PrefixResolveStatus;
-    __uint8_t *ipv6Prefix;
-    int prefixLen;
-}
-
-- (instancetype)init {
-    if (self = [super init]) {
-        ipv6PrefixResolveStatus = IPv6PrefixUnResolved;
-        ipv6Prefix = (__uint8_t *)V6_PREFIX_CONTENT_TABLE[0];
-        prefixLen = V6_PREFIX_SIZE_TABLE[0];
-    }
-    return self;
-}
-
-+ (instancetype)getInstance {
-    static id singletonInstance = nil;
-    static dispatch_once_t once_token;
-    dispatch_once(&once_token, ^{
-        if (!singletonInstance) {
-            singletonInstance = [[super allocWithZone:NULL] init];
-        }
-    });
-    return singletonInstance;
-}
-
-/**
- *	@brief	Updates IPv6 Prefix
- */
-- (void)updateIPv6Prefix {
-    @synchronized(self) {
-        ipv6PrefixResolveStatus = IPv6PrefixUnResolved;
-        [self resolveIPv6Prefix:ipv6Prefix];
-    }
-}
-
-- (BOOL)isIPv6Prefix:(__uint8_t *)v6Prefix
-       withPrefixLen:(int)pLen
-              withIP:(__uint8_t *)ip
-           withIPLen:(int)ipLen {
-    for (int i = 0; i < pLen && i < ipLen; i++) {
-        if (*(v6Prefix + i) != *(ip + i)) {
-            return NO;
-        }
-    }
-    return YES;
-}
-
-- (__uint8_t)resolveIPv6Prefix:(__uint8_t *)prefix {
-    if ( !prefix ) {
-        return 0;
-    }
-    __uint8_t len = prefixLen;
-    memcpy(prefix, ipv6Prefix, prefixLen);
-    @synchronized(self) {
-        if (ipv6PrefixResolveStatus==IPv6PrefixUnResolved ) {
-            ipv6PrefixResolveStatus = IPv6PrefixResolving;
-            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-                struct addrinfo hints, *addr;
-                memset(&hints, 0, sizeof(hints));
-                hints.ai_family = PF_INET6;
-                hints.ai_socktype = SOCK_STREAM;
-                hints.ai_flags = AI_DEFAULT;
-                
-                if (0 != getaddrinfo("ipv4only.arpa", "http", &hints, &addr)) {
-                    ipv6PrefixResolveStatus = IPv6PrefixUnResolved;
-                    return;
-                }
-                
-                if (addr && AF_INET6 == addr->ai_addr->sa_family) {
-                    struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *)(addr->ai_addr);
-                    if ( !addr6 ) {
-                        ipv6PrefixResolveStatus = IPv6PrefixUnResolved;
-                        return;
-                    }
-                    
-                    __uint8_t* u8 = addr6->sin6_addr.__u6_addr.__u6_addr8;
-                    for (__uint8_t i=0; i < V6_PREFIX_TABLE_SIZE; i++) {
-                        if ([self isIPv6Prefix:(__uint8_t *)V6_PREFIX_CONTENT_TABLE[i]
-                                 withPrefixLen:V6_PREFIX_SIZE_TABLE[i]
-                                        withIP:u8
-                                     withIPLen:16]) {
-                            
-                            ipv6Prefix = (__uint8_t *)V6_PREFIX_CONTENT_TABLE[i];
-                            prefixLen = V6_PREFIX_SIZE_TABLE[i];
-                            ipv6PrefixResolveStatus = IPv6PrefixResolved;
-                            break;
-                        }
-                    }
-                    ipv6PrefixResolveStatus = IPv6PrefixUnResolved;
-                }
-                
-            });
-        }
-    }
-    
-    return len;
-}
-
-- (NSString *)convertIPv4toIPv6:(NSString *)ipv4 {
-    if ([ipv4 length] <= 0) {
-        return nil;
-    }
-    
-    __uint8_t ipv6[16] = {0x00};
-    __uint8_t length = [self resolveIPv6Prefix:ipv6];
-    
-    if (length <= 0) {
-        return nil;
-    }
-    
-    in_addr_t addr_v4 = inet_addr([ipv4 UTF8String]);
-    
-    // 按length的不同情况进行处理
-    if (length==4 || length==12) { //32 bits or 96 bits
-        ipv6[length+0] |= (__uint8_t)(addr_v4>>0 & 0xff);
-        ipv6[length+1] |= (__uint8_t)(addr_v4>>8 & 0xff);
-        ipv6[length+2] |= (__uint8_t)(addr_v4>>16 & 0xff);
-        ipv6[length+3] |= (__uint8_t)(addr_v4>>24 & 0xff);
-    }
-    else if (length == 5) { //40 bits  :a.b.c.0.d
-        ipv6[length+0] |= (__uint8_t)(addr_v4>>0 & 0xff);
-        ipv6[length+1] |= (__uint8_t)(addr_v4>>8 & 0xff);
-        ipv6[length+2] |= (__uint8_t)(addr_v4>>16 & 0xff);
-        ipv6[length+4] |= (__uint8_t)(addr_v4>>24 & 0xff);
-    }
-    else if (length == 6) { //48 bits   :a.b.0.c.d
-        ipv6[length+0] |= (__uint8_t)(addr_v4>>0 & 0xff);
-        ipv6[length+1] |= (__uint8_t)(addr_v4>>8 & 0xff);
-        ipv6[length+3] |= (__uint8_t)(addr_v4>>16 & 0xff);
-        ipv6[length+4] |= (__uint8_t)(addr_v4>>24 & 0xff);
-    }
-    else if (length == 7) { //56 bits   :a.0.b.c.d
-        ipv6[length+0] |= (__uint8_t)(addr_v4>>0 & 0xff);
-        ipv6[length+2] |= (__uint8_t)(addr_v4>>8 & 0xff);
-        ipv6[length+3] |= (__uint8_t)(addr_v4>>16 & 0xff);
-        ipv6[length+4] |= (__uint8_t)(addr_v4>>24 & 0xff);
-    }
-    else if (length == 8) { //64 bits   :0.a.b.c.d
-        ipv6[length+1] |= (__uint8_t)(addr_v4>>0 & 0xff);
-        ipv6[length+2] |= (__uint8_t)(addr_v4>>8 & 0xff);
-        ipv6[length+3] |= (__uint8_t)(addr_v4>>16 & 0xff);
-        ipv6[length+4] |= (__uint8_t)(addr_v4>>24 & 0xff);
-    }
-    
-    // constructs the IPv6 structure
-    char addr_text[ MAX(INET_ADDRSTRLEN, INET6_ADDRSTRLEN) ];
-    if(inet_ntop(AF_INET6, ipv6, addr_text, INET6_ADDRSTRLEN)) {
-        NSString *ret = [NSString stringWithUTF8String:addr_text];
-        return ret;
-    }
-    return nil;
-}
-
-@end

+ 0 - 15
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSIPv6/OSSReachabilityManager.h

@@ -1,15 +0,0 @@
-//
-//  OSSReachabilityManager.h
-//
-//  Created by 亿刀 on 14-1-9.
-//  Edited by junmo on 15-5-16
-//  Copyright (c) 2014 Twitter. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-
-@interface OSSReachabilityManager : NSObject
-
-+ (OSSReachabilityManager *)shareInstance;
-
-@end

+ 0 - 97
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSIPv6/OSSReachabilityManager.m

@@ -1,97 +0,0 @@
-//
-//  OSSReachabilityManager.m
-//
-//  Created by 亿刀 on 14-1-9.
-//  Edited by junmo on 15-5-16
-//  Edited by zhouzhuo on 2016/5/22
-//  Copyright (c) 2014 Twitter. All rights reserved.
-//
-
-#import "OSSReachabilityManager.h"
-#import "OSSIPv6Adapter.h"
-#import "OSSLog.h"
-
-#import <arpa/inet.h>
-#import <CommonCrypto/CommonDigest.h>
-#import <CoreTelephony/CTCarrier.h>
-#import <CoreTelephony/CTTelephonyNetworkInfo.h>
-#import <ifaddrs.h>
-#import <netdb.h>
-#import <netinet/in.h>
-#import <netinet6/in6.h>
-#import <sys/socket.h>
-#import <SystemConfiguration/CaptiveNetwork.h>
-#import <SystemConfiguration/SystemConfiguration.h>
-
-static char *const OSSReachabilityQueueIdentifier = "com.alibaba.oss.network.ReachabilityQueue";
-static dispatch_queue_t reachabilityQueue;
-static NSString *const CHECK_HOSTNAME = @"www.taobao.com";
-
-@implementation OSSReachabilityManager {
-    SCNetworkReachabilityRef            _reachabilityRef;
-}
-
-+ (OSSReachabilityManager *)shareInstance
-{
-    static OSSReachabilityManager *s_SPDYNetworkStatusManager = nil;
-    
-    @synchronized([self class])
-    {
-        if (!s_SPDYNetworkStatusManager)
-        {
-            s_SPDYNetworkStatusManager = [[OSSReachabilityManager alloc] init];
-        }
-    }
-    
-    return s_SPDYNetworkStatusManager;
-}
-
-- (id)init
-{
-    self = [super init];
-    if (self)
-    {
-        _reachabilityRef =  SCNetworkReachabilityCreateWithName(NULL, [CHECK_HOSTNAME UTF8String]);
-
-        // Start network monitor
-        [self _startNotifier];
-    }
-
-    return self;
-}
-
-- (BOOL)_startNotifier
-{
-    if (!_reachabilityRef)
-    {
-        _reachabilityRef =  SCNetworkReachabilityCreateWithName(NULL, [CHECK_HOSTNAME UTF8String]);
-    }
-
-    if (_reachabilityRef)
-    {
-        SCNetworkReachabilityContext context = {0, (__bridge void *)(self), NULL, NULL, NULL};
-        
-        if(SCNetworkReachabilitySetCallback(_reachabilityRef, ReachabilityCallback, &context))
-        {
-            reachabilityQueue = dispatch_queue_create(OSSReachabilityQueueIdentifier, DISPATCH_QUEUE_SERIAL);
-            SCNetworkReachabilitySetDispatchQueue(_reachabilityRef, reachabilityQueue);
-
-            return YES;
-        }
-    }
-    return NO;
-}
-
-// Callback of Network change 
-static void ReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void* info)
-{
-    if ([[OSSIPv6Adapter getInstance] isIPv6OnlyNetwork]) {
-        OSSLogDebug(@"[AlicloudReachabilityManager]: Network changed, Pre network status is IPv6-Only.");
-    } else {
-        OSSLogDebug(@"[AlicloudReachabilityManager]: Network changed, Pre network status is not IPv6-Only.");
-    }
-
-    [[OSSIPv6Adapter getInstance] reResolveIPv6OnlyStatus];
-}
-
-@end

+ 0 - 22
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSInputStreamHelper.h

@@ -1,22 +0,0 @@
-//
-//  OSSInputStreamHelper.h
-//  AliyunOSSSDK
-//
-//  Created by 怀叙 on 2017/12/7.
-//  Copyright © 2017年 阿里云. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-
-NS_ASSUME_NONNULL_BEGIN
-@interface OSSInputStreamHelper : NSObject
-
-@property (nonatomic, assign) uint64_t crc64;
-
-- (instancetype)initWithFileAtPath:(nonnull NSString *)path;
-- (instancetype)initWithURL:(nonnull NSURL *)URL;
-
-- (void)syncReadBuffers;
-
-@end
-NS_ASSUME_NONNULL_END

+ 0 - 80
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSInputStreamHelper.m

@@ -1,80 +0,0 @@
-//
-//  OSSInputStreamHelper.m
-//  AliyunOSSSDK
-//
-//  Created by 怀叙 on 2017/12/7.
-//  Copyright © 2017年 阿里云. All rights reserved.
-//
-
-#import "OSSInputStreamHelper.h"
-#import "OSSLog.h"
-#import "aos_crc64.h"
-
-@interface OSSInputStreamHelper ()
-{
-    NSInputStream *_inputStream;
-    CFAbsoluteTime _startTime;
-    dispatch_semaphore_t _semaphore;
-}
-
-@end
-
-@implementation OSSInputStreamHelper
-
-- (instancetype)initWithFileAtPath:(nonnull NSString *)path
-{
-    self = [super init];
-    if (self) {
-        _crc64 = 0;
-        _inputStream = [NSInputStream inputStreamWithFileAtPath:path];
-        _semaphore = dispatch_semaphore_create(1);
-    }
-    return self;
-}
-
-- (instancetype)initWithURL:(nonnull NSURL *)URL
-{
-    self = [super init];
-    if (self) {
-        _crc64 = 0;
-        _inputStream = [NSInputStream inputStreamWithURL:URL];
-        _semaphore = dispatch_semaphore_create(1);
-    }
-    return self;
-}
-
-- (void)syncReadBuffers
-{
-    dispatch_semaphore_wait(_semaphore, DISPATCH_TIME_FOREVER);
-
-    _startTime = CFAbsoluteTimeGetCurrent();
-    [_inputStream open];
-    NSInteger length = 1;
-    while (length > 0)
-    {
-        @autoreleasepool{
-            uint8_t streamData[1024 * 4];
-            length = [_inputStream read:streamData maxLength:1024 * 4];
-            if (length > 0) {
-                _crc64 = aos_crc64(_crc64, streamData, length);
-            }
-        }
-    }
-    
-    if (length < 0) {
-        OSSLogError(@"there is an error when reading buffer from file!");
-    }
-    [_inputStream close];
-    
-    CFAbsoluteTime duration =  CFAbsoluteTimeGetCurrent() - _startTime;
-    OSSLogDebug(@"read file cost time is :%f",duration);
-    
-    dispatch_semaphore_signal(_semaphore);
-}
-
-- (uint64_t)crc64
-{
-    return _crc64;
-}
-
-@end

+ 0 - 54
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSLog.h

@@ -1,54 +0,0 @@
-//
-//  OSSLog.h
-//  oss_ios_sdk
-//
-//  Created by zhouzhuo on 8/16/15.
-//  Copyright (c) 2015 aliyun.com. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-#import "OSSCocoaLumberjack.h"
-static const OSSDDLogLevel ossLogLevel = OSSDDLogLevelAll;
-
-// colorful log configuration
-// see https://github.com/robbiehanson/XcodeColors
-
-#define XCODE_COLORS_ESCAPE @"\033["
-
-#define XCODE_COLORS_RESET_FG  XCODE_COLORS_ESCAPE @"fg;" // Clear any foreground color
-#define XCODE_COLORS_RESET_BG  XCODE_COLORS_ESCAPE @"bg;" // Clear any background color
-#define XCODE_COLORS_RESET     XCODE_COLORS_ESCAPE @";"   // Clear any foreground or background color
-
-#define OSSLogVerbose(frmt, ...)\
-if ([OSSLog isLogEnable]) {\
-OSSDDLogVerbose(@"[Verbose]: %@", [NSString stringWithFormat:(frmt), ##__VA_ARGS__]);\
-}
-
-#define OSSLogDebug(frmt, ...)\
-if ([OSSLog isLogEnable]) {\
-OSSDDLogDebug(@"[Debug]: %@", [NSString stringWithFormat:(frmt), ##__VA_ARGS__]);\
-}
-
-#define OSSLogDebugNoFile(frmt, ...)\
-if ([OSSLog isLogEnable]) {\
-NSLog(@"[Debug]: %@", [NSString stringWithFormat:(frmt), ##__VA_ARGS__]);\
-}
-
-#define OSSLogError(frmt, ...)\
-if ([OSSLog isLogEnable]) {\
-OSSDDLogError(@"[Error]: %@", [NSString stringWithFormat:(frmt), ##__VA_ARGS__]);\
-}
-
-#define OSSLogWarn(frmt, ...)\
-if ([OSSLog isLogEnable]) {\
-OSSDDLogWarn(@"[Warning]: %@", [NSString stringWithFormat:(frmt), ##__VA_ARGS__]);\
-}
-
-static BOOL isEnable;
-
-@interface OSSLog : NSObject
-
-+ (void)enableLog;
-+ (void)disableLog;
-+ (BOOL)isLogEnable;
-@end

+ 0 - 31
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSLog.m

@@ -1,31 +0,0 @@
-//
-//  OSSLog.m
-//  oss_ios_sdk
-//
-//  Created by zhouzhuo on 8/16/15.
-//  Copyright (c) 2015 aliyun.com. All rights reserved.
-//
-
-#import "OSSLog.h"
-#import "OSSUtil.h"
-
-@implementation OSSLog
-+ (void)enableLog {
-    if([OSSUtil hasPhoneFreeSpace]){
-        isEnable = YES;
-        [OSSDDLog removeAllLoggers];
-        [OSSDDLog addLogger:[OSSNSLogger sharedInstance]];
-        OSSDDFileLogger *fileLogger = [[OSSDDFileLogger alloc] init];
-        [OSSDDLog addLogger:fileLogger];
-    }
-}
-
-+ (void)disableLog {
-    isEnable = NO;
-}
-
-+ (BOOL)isLogEnable {
-    return isEnable;
-}
-
-@end

+ 0 - 1498
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSModel.h

@@ -1,1498 +0,0 @@
-//
-//  OSSModel.h
-//  oss_ios_sdk
-//
-//  Created by zhouzhuo on 8/16/15.
-//  Copyright (c) 2015 aliyun.com. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-#import "OSSRequest.h"
-#import "OSSResult.h"
-
-@class OSSAllRequestNeededMessage;
-@class OSSFederationToken;
-@class OSSTask;
-@class OSSClientConfiguration;
-
-NS_ASSUME_NONNULL_BEGIN
-
-typedef OSSFederationToken * _Nullable (^OSSGetFederationTokenBlock) (void);
-
-/**
- Categories NSDictionary
- */
-@interface NSDictionary (OSS)
-- (NSString *)base64JsonString;
-@end
-
-/**
- A thread-safe dictionary
- */
-@interface OSSSyncMutableDictionary : NSObject
-@property (nonatomic, strong) NSMutableDictionary *dictionary;
-@property (nonatomic, strong) dispatch_queue_t dispatchQueue;
-
-- (id)objectForKey:(id)aKey;
-- (NSArray *)allKeys;
-- (void)setObject:(id)anObject forKey:(id <NSCopying>)aKey;
-- (void)removeObjectForKey:(id)aKey;
-@end
-
-/**
- FederationToken class
- */
-@interface OSSFederationToken : NSObject
-@property (nonatomic, copy) NSString * tAccessKey;
-@property (nonatomic, copy) NSString * tSecretKey;
-@property (nonatomic, copy) NSString * tToken;
-
-/**
- Token's expiration time in milliseconds of the unix time.
- */
-@property (atomic, assign) int64_t expirationTimeInMilliSecond;
-
-/**
- Token's expiration time in GMT format string.
- */
-@property (atomic, strong, nullable) NSString *expirationTimeInGMTFormat;
-@end
-
-/**
- CredentialProvider protocol, needs to implement sign API.
- */
-@protocol OSSCredentialProvider <NSObject>
-@optional
-- (nullable NSString *)sign:(NSString *)content error:(NSError **)error;
-@end
-
-/**
- The plaint text AK/SK credential provider for test purposely.
- */
-
-__attribute__((deprecated("PLEASE DO NOT USE THIS CLASS AGAIN")))
-@interface OSSPlainTextAKSKPairCredentialProvider : NSObject <OSSCredentialProvider>
-@property (nonatomic, copy) NSString * accessKey;
-@property (nonatomic, copy) NSString * secretKey;
-
-- (instancetype)initWithPlainTextAccessKey:(NSString *)accessKey
-                                 secretKey:(NSString *)secretKey __attribute__((deprecated("We recommend the STS authentication mode on mobile")));
-@end
-
-/**
-TODOTODO
- The custom signed credential provider
- */
-@interface OSSCustomSignerCredentialProvider : NSObject <OSSCredentialProvider>
-@property (nonatomic, copy, readonly,) NSString * _Nonnull (^ _Nonnull signContent)( NSString * _Nonnull , NSError * _Nullable *_Nullable);
-
-+ (instancetype _Nullable)new NS_UNAVAILABLE;
-- (instancetype _Nullable)init NS_UNAVAILABLE;
-
-/**
- * During the task execution, this API is called for signing
- * It's executed at the background thread instead of UI thread.
- */
-- (instancetype _Nullable)initWithImplementedSigner:(OSSCustomSignContentBlock)signContent NS_DESIGNATED_INITIALIZER;
-@end
-
-/**
-TODOTODO
- User's custom federation credential provider.
- */
-@interface OSSFederationCredentialProvider : NSObject <OSSCredentialProvider>
-@property (nonatomic, strong) OSSFederationToken * cachedToken;
-@property (nonatomic, copy) OSSFederationToken * (^federationTokenGetter)(void);
-
-/**
- During the task execution, this method is called to get the new STS token.
- It runs in the background thread, not the UI thread.
- */
-- (instancetype)initWithFederationTokenGetter:(OSSGetFederationTokenBlock)federationTokenGetter;
-- (nullable OSSFederationToken *)getToken:(NSError **)error;
-@end
-
-/**
- The STS token's credential provider.
- */
-__attribute__((deprecated("Please use OSSAuthCredentialProvider or its subClass instead!")))
-@interface OSSStsTokenCredentialProvider : NSObject <OSSCredentialProvider>
-@property (nonatomic, copy) NSString * accessKeyId;
-@property (nonatomic, copy) NSString * secretKeyId;
-@property (nonatomic, copy) NSString * securityToken;
-
-- (OSSFederationToken *)getToken;
-- (instancetype)initWithAccessKeyId:(NSString *)accessKeyId
-                        secretKeyId:(NSString *)secretKeyId
-                      securityToken:(NSString *)securityToken;
-@end
-
-/**
- Auth credential provider require a STS INFO Server URL,also you can customize a decoder block which returns json data.
- 
- 
- OSSAuthCredentialProvider *acp = [[OSSAuthCredentialProvider alloc] initWithAuthServerUrl:@"sts_server_url" responseDecoder:^NSData * (NSData * data) {
-        // 1.hanle response from server.
- 
- // 2.initialize json object from step 1. json object require message like {AccessKeyId:@"xxx",AccessKeySecret:@"xxx",SecurityToken:@"xxx",Expiration:@"xxx"}
- 
-        // 3.generate jsonData from step 2 and return it.
- }];
- 
- */
-
-@interface OSSAuthCredentialProvider : OSSFederationCredentialProvider
-@property (nonatomic, copy) NSString * authServerUrl;
-@property (nonatomic, copy) NSData * (^responseDecoder)(NSData *);
-- (instancetype)initWithAuthServerUrl:(NSString *)authServerUrl;
-- (instancetype)initWithAuthServerUrl:(NSString *)authServerUrl responseDecoder:(nullable OSSResponseDecoderBlock)decoder;
-@end
-
-/**
- OSSClient side configuration.
- */
-@interface OSSClientConfiguration : NSObject
-
-/**
- Max retry count
- */
-@property (nonatomic, assign) uint32_t maxRetryCount;
-
-/**
- Max concurrent requests
- */
-@property (nonatomic, assign) uint32_t maxConcurrentRequestCount;
-
-/**
- Flag of enabling background file transmit service.
- Note: it's only applicable for file upload.
- */
-@property (nonatomic, assign) BOOL enableBackgroundTransmitService;
-
-/**
- Flag of using Http request for DNS resolution.
- */
-@property (nonatomic, assign) BOOL isHttpdnsEnable;
-
-/**
-Sets the session Id for background file transmission
- */
-@property (nonatomic, copy) NSString * backgroundSesseionIdentifier;
-
-/**
- Sets request timeout
- */
-@property (nonatomic, assign) NSTimeInterval timeoutIntervalForRequest;
-
-/**
- Sets single object download's max time
- */
-@property (nonatomic, assign) NSTimeInterval timeoutIntervalForResource;
-
-/**
- Sets proxy host and port.
- */
-@property (nonatomic, copy) NSString * proxyHost;
-@property (nonatomic, strong) NSNumber * proxyPort;
-
-/**
- Sets UA
- */
-@property (nonatomic, copy) NSString * userAgentMark;
-
-/**
- Sets CName excluded list.
- */
-@property (nonatomic, strong, setter=setCnameExcludeList:) NSArray * cnameExcludeList;
-
-/**
- 是否开启crc校验(当同时设置了此选项和请求中的checkCRC开关时,以请求中的checkCRC开关为准)
- */
-@property (nonatomic, assign) BOOL crc64Verifiable;
-
-@end
-
-@protocol OSSRequestInterceptor <NSObject>
-- (OSSTask *)interceptRequestMessage:(OSSAllRequestNeededMessage *)request;
-@end
-
-/**
- Signs the request when it's being created.
- */
-@interface OSSSignerInterceptor : NSObject <OSSRequestInterceptor>
-@property (nonatomic, strong) id<OSSCredentialProvider> credentialProvider;
-
-- (instancetype)initWithCredentialProvider:(id<OSSCredentialProvider>)credentialProvider;
-@end
-
-/**
- Updates the UA when creating the request.
- */
-@interface OSSUASettingInterceptor : NSObject <OSSRequestInterceptor>
-@property (nonatomic, weak) OSSClientConfiguration *clientConfiguration;
-- (instancetype)initWithClientConfiguration:(OSSClientConfiguration *) clientConfiguration;
-@end
-
-/**
- Fixes the time skew issue when creating the request.
- */
-@interface OSSTimeSkewedFixingInterceptor : NSObject <OSSRequestInterceptor>
-@end
-
-/**
- The download range of OSS object
- */
-@interface OSSRange : NSObject
-@property (nonatomic, assign) int64_t startPosition;
-@property (nonatomic, assign) int64_t endPosition;
-
-- (instancetype)initWithStart:(int64_t)start
-                      withEnd:(int64_t)end;
-
-/**
- * Converts the header to string: 'bytes=${start}-${end}'
- */
-- (NSString *)toHeaderString;
-@end
-
-#pragma mark RequestAndResultClass
-
-/**
- The request to list all buckets of current user.
- */
-@interface OSSGetServiceRequest : OSSRequest
-
-/**
- The prefix filter for listing buckets---optional.
- */
-@property (nonatomic, copy) NSString * prefix;
-
-/**
- The marker filter for listing buckets----optional.
- The marker filter is to ensure any returned bucket name must be greater than the marker in the lexicographic order.
- */
-@property (nonatomic, copy) NSString * marker;
-
-/**
- The max entries to return. By default it's 100 and max value of this property is 1000.
- */
-@property (nonatomic, assign) int32_t maxKeys;
-
-
-@end
-
-/**
- The result class of listing all buckets
- */
-@interface OSSGetServiceResult : OSSResult
-
-/**
- The owner Id
- */
-@property (nonatomic, copy) NSString * ownerId;
-
-/**
- Bucket owner name---currently it's same as owner Id.
- */
-@property (nonatomic, copy) NSString * ownerDispName;
-
-/**
- The prefix of this query. It's only set when there's remaining buckets to return.
- */
-@property (nonatomic, copy) NSString * prefix;
-
-/**
- The marker of this query. It's only set when there's remaining buckets to return.
- */
-@property (nonatomic, copy) NSString * marker;
-
-/**
- The max buckets to return. It's only set when there's remaining buckets to return.
- */
-@property (nonatomic, assign) int32_t maxKeys;
-
-/**
- Flag of the result is truncated. If it's truncated, it means there's remaining buckets to return.
- */
-@property (nonatomic, assign) BOOL isTruncated;
-
-/**
- The marker for the next ListBucket call. It's only set when there's remaining buckets to return.
- */
-@property (nonatomic, copy) NSString * nextMarker;
-
-/**
- The container of the buckets. It's a dictionary array, in which every element has keys "Name", "CreationDate" and "Location".
- */
-@property (nonatomic, strong, nullable) NSArray * buckets;
-@end
-
-/**
- The request to create bucket
- */
-@interface OSSCreateBucketRequest : OSSRequest
-
-/**
- *  存储空间,命名规范如下:(1)只能包括小写字母、数字和短横线(-);(2)必须以小写字母或者数字开头和结尾;(3)长度必须在3-63字节之间.
- */
-@property (nonatomic, copy) NSString * bucketName;
-
-/**
- The bucket location
- For more information about OSS datacenter and endpoint, please check out <a>https://docs.aliyun.com/#/pub/oss/product-documentation/domain-region</a>
- */
-@property (nonatomic, copy) NSString * location __attribute__ ((deprecated));
-
-/**
- Sets Bucket access permission. For now there're three permissions:public-read-write,public-read and private. if this key is not set, the default value is private
- */
-@property (nonatomic, copy) NSString * xOssACL;
-
-@property (nonatomic, assign) OSSBucketStorageClass storageClass;
-
-
-- (NSString *)storageClassAsString;
-
-@end
-
-/**
- Result class of bucket creation
- */
-@interface OSSCreateBucketResult : OSSResult
-
-/**
- Bucket datacenter
- */
-@property (nonatomic, copy) NSString * location;
-@end
-
-/**
- The request class of deleting bucket
- */
-@interface OSSDeleteBucketRequest : OSSRequest
-
-/**
- Bucket name
- */
-@property (nonatomic, copy) NSString * bucketName;
-@end
-
-/**
- Result class of deleting bucket
- */
-@interface OSSDeleteBucketResult : OSSResult
-@end
-
-/**
- The request class of listing objects under a bucket
- */
-@interface OSSGetBucketRequest : OSSRequest
-
-/**
- Bucket name
- */
-@property (nonatomic, copy) NSString * bucketName;
-
-/**
- The delimiter is very important and it determines the behavior of common prefix.
- For most cases, use the default '/' as the delimiter. 
- For example, if a bucket has folder 'prefix/' and a file 'abc'. And inside the folder it has file '123.txt'
- If the delimiter is '/', then the ListObject will return a common prefix 'prefix/' and a file 'abc'.
- If the delimiter is something else, then ListObject will return three files: prefix/, abc and prefix/123.txt. No common prefix!.
- */
-@property (nonatomic, copy) NSString * delimiter;
-
-/**
- The marker filter for listing objects----optional.
- The marker filter is to ensure any returned object name must be greater than the marker in the lexicographic order.
- */
-@property (nonatomic, copy) NSString * marker;
-
-/**
- The max entries count to return. By default it's 100 and it could be up to 1000.
- */
-@property (nonatomic, assign) int32_t maxKeys;
-
-/**
- The filter prefix of the objects to return----the returned objects' name must have the prefix.
- */
-@property (nonatomic, copy) NSString * prefix;
-
-
-@end
-
-/**
- The result class of listing objects.
- */
-@interface OSSGetBucketResult : OSSResult
-
-/**
- Bucket name
- */
-@property (nonatomic, copy) NSString * bucketName;
-
-/**
- The prefix of the objects returned----the returned objects must have this prefix.
- */
-@property (nonatomic, copy) NSString * prefix;
-
-/**
- The marker filter of the objects returned---all objects returned are greater than this marker in lexicographic order.
- */
-@property (nonatomic, copy) NSString * marker;
-
-/**
- The max entries to return. By default it's 100 and it could be up to 1000.
- */
-@property (nonatomic, assign) int32_t maxKeys;
-
-/**
- The delimiter to differentiate the folder object and file object.
- For object whose name ends with the delimiter, then it's treated as folder or common prefixes.
- */
-@property (nonatomic, copy) NSString * delimiter;
-
-/**
- The maker for the next call. If no more entries to return, it's null.
- */
-@property (nonatomic, copy) NSString * nextMarker;
-
-/**
- Flag of truncated result. If it's truncated, it means there's more entries to return.
- */
-@property (nonatomic, assign) BOOL isTruncated;
-
-/**
- The dictionary arrary, in which each dictionary has keys of "Key", "LastModified", "ETag", "Type", "Size", "StorageClass" and "Owner".
- */
-@property (nonatomic, strong, nullable) NSArray * contents;
-
-/**
- The arrary of common prefixes. Each element is one common prefix.
- */
-@property (nonatomic, strong) NSArray * commentPrefixes;
-@end
-
-/**
- The request class to get the bucket ACL.
- */
-@interface OSSGetBucketACLRequest : OSSRequest
-
-/**
- Bucket name
- */
-@property (nonatomic, copy) NSString * bucketName;
-@end
-
-/**
- The result class to get the bucket ACL.
- */
-@interface OSSGetBucketACLResult : OSSResult
-
-/**
- The bucket ACL. It could be one of the three values: private/public-read/public-read-write.
- */
-@property (nonatomic, copy) NSString * aclGranted;
-@end
-
-/**
- The request class to get object metadata
- */
-@interface OSSHeadObjectRequest : OSSRequest
-
-/**
- Bucket name
- */
-@property (nonatomic, copy) NSString * bucketName;
-
-/**
- Object name
- */
-@property (nonatomic, copy) NSString * objectKey;
-@end
-
-/**
- The result class of getting object metadata.
- */
-@interface OSSHeadObjectResult : OSSResult
-
-/**
- Object metadata
- */
-@property (nonatomic, copy) NSDictionary * objectMeta;
-@end
-
-/**
- The request class to get object
- */
-@interface OSSGetObjectRequest : OSSRequest
-
-/**
- Bucket name
- */
-@property (nonatomic, copy) NSString * bucketName;
-
-/**
- Object name
- */
-@property (nonatomic, copy) NSString * objectKey;
-
-/**
- OSS Download Range: For example, bytes=0-9 means uploading the first to the tenth's character.
- */
-@property (nonatomic, strong) OSSRange * range;
-
-/**
- The local file path to download to.
- */
-@property (nonatomic, strong) NSURL * downloadToFileURL;
-
-/**
- Image processing configuration.
- */
-@property (nonatomic, copy) NSString * xOssProcess;
-
-/**
- Download progress callback.
- It runs at background thread.
- */
-@property (nonatomic, copy) OSSNetworkingDownloadProgressBlock downloadProgress;
-
-/**
- During the object download, the callback is called upon response is received.
- It runs under background thread (not UI thread)
- */
-@property (nonatomic, copy) OSSNetworkingOnRecieveDataBlock onRecieveData;
-
-/**
- * set request headers
- */
-@property (nonatomic, copy) NSDictionary *headerFields;
-
-@end
-
-/**
- Result class of downloading an object.
- */
-@interface OSSGetObjectResult : OSSResult
-
-/**
- The in-memory content of the downloaded object, if the local file path is not specified.
- */
-@property (nonatomic, strong) NSData * downloadedData;
-
-/**
- The object metadata dictionary
- */
-@property (nonatomic, copy) NSDictionary * objectMeta;
-@end
-
-
-/**
- The response class to update the object ACL.
- */
-@interface OSSPutObjectACLResult : OSSResult
-@end
-
-/**
- The request class to upload an object.
- */
-@interface OSSPutObjectRequest : OSSRequest
-
-/**
- Bucket name
- */
-@property (nonatomic, copy) NSString * bucketName;
-
-/**
- Object name
- */
-@property (nonatomic, copy) NSString * objectKey;
-
-/**
- The in-memory data to upload.
- */
-@property (nonatomic, strong) NSData * uploadingData;
-
-/**
- The local file path to upload.
- */
-@property (nonatomic, strong) NSURL * uploadingFileURL;
-
-/**
- The callback parameters.
- */
-@property (nonatomic, copy) NSDictionary * callbackParam;
-
-/**
- The callback variables.
- */
-@property (nonatomic, copy) NSDictionary * callbackVar;
-
-/**
- The content type.
- */
-@property (nonatomic, copy) NSString * contentType;
-
-/**
- The content's MD5 digest. 
- It's calculated on the request body (not headers) according to RFC 1864 to get the 128 bit digest data.
- Then use base64 encoding on the 128bit result to get this MD5 value.
- This header is for integrity check on the data. And it's recommended to turn on for every body.
- */
-@property (nonatomic, copy) NSString * contentMd5;
-
-/**
- Specifies the download name of the object. Checks out RFC2616 for more details.
- */
-@property (nonatomic, copy) NSString * contentDisposition;
-
-/**
- Specifies the content encoding during the download. Checks out RFC2616 for more details.
- */
-@property (nonatomic, copy) NSString * contentEncoding;
-
-/**
- Specifies the cache behavior during the download. Checks out RFC2616 for more details.
- */
-@property (nonatomic, copy) NSString * cacheControl;
-
-/**
- Expiration time in milliseconds. Checks out RFC2616 for more details.
- */
-@property (nonatomic, copy) NSString * expires;
-
-/**
- The object's metadata.
- When the object is being uploaded, it could be specified with http headers prefixed with x-oss-meta for user metadata.
- The total size of all user metadata cannot be more than 8K. 
- It also could include standard HTTP headers in this object.
- */
-@property (nonatomic, copy) NSDictionary * objectMeta;
-
-/**
- The upload progress callback.
- It runs in background thread (not UI thread).
- */
-@property (nonatomic, copy) OSSNetworkingUploadProgressBlock uploadProgress;
-
-/**
- The upload retry callback.
- It runs in background thread (not UI thread).
- */
-@property (nonatomic, copy) OSSNetworkingRetryBlock uploadRetryCallback;
-
-/**
- * the sha1 of content
- */
-@property (nonatomic, copy) NSString *contentSHA1;
- 
-@end
-
-/**
- The request class to update the object ACL.
- */
-@interface OSSPutObjectACLRequest : OSSPutObjectRequest
-
-/**
- *@brief:指定oss创建object时的访问权限,合法值:public-read、private、public-read-write
- */
-@property (nonatomic, copy, nullable) NSString *acl;
-
-@end
-
-/**
- The result class to put an object
- */
-@interface OSSPutObjectResult : OSSResult
-
-/**
-ETag (entity tag) is the tag during the object creation in OSS server side.
-It's the MD5 value for put object request. If the object is created by other APIs, the ETag is the UUID of the content.
- ETag could be used to check if the object has been updated.
- */
-@property (nonatomic, copy) NSString * eTag;
-
-/**
- If the callback is specified, this is the callback response result.
- */
-@property (nonatomic, copy) NSString * serverReturnJsonString;
-@end
-
-/**
- * append object request
- */
-@interface OSSAppendObjectRequest : OSSRequest
-
-/**
- Bucket name
- */
-@property (nonatomic, copy) NSString * bucketName;
-
-/**
- Object name
- */
-@property (nonatomic, copy) NSString * objectKey;
-
-/**
- Specifies which position to append. For a new file, the first append should start from 0. And the subsequential calls will start from the current length of the object.
- For example, if the first append's size is 65536, then the appendPosition value in the next call will be 65536.
- In its response, the header x-oss-next-append-position is included for next call.
- */
-@property (nonatomic, assign) int64_t appendPosition;
-
-/**
- The in-memory data to upload from.
- */
-@property (nonatomic, strong) NSData * uploadingData;
-
-/**
- The local file path to upload from.
- */
-@property (nonatomic, strong) NSURL * uploadingFileURL;
-
-/**
- Sets the content type
- */
-@property (nonatomic, copy) NSString * contentType;
-
-/**
- The content's MD5 digest value.
- It's calculated from the MD5 value of the request body according to RFC 1864 and then encoded by base64.
- */
-@property (nonatomic, copy) NSString *contentMd5;
-
-/**
- The object's name during the download according to RFC 2616.
- */
-@property (nonatomic, copy) NSString * contentDisposition;
-
-/**
- The content encoding during the object upload. Checks out RFC2616 for more detail.
- */
-@property (nonatomic, copy) NSString * contentEncoding;
-
-/**
- Specifies the cache control behavior when it's being downloaded.Checks out RFC 2616 for more details.
- */
-@property (nonatomic, copy) NSString * cacheControl;
-
-/**
- Expiration time. Checks out RFC2616 for more information.
- */
-@property (nonatomic, copy) NSString * expires;
-
-/**
- The object's metadata, which start with x-oss-meta-, such as x-oss-meta-location.
- Each request can have multiple metadata as long as the total size of all metadata is no bigger than 8KB.
- It could include standard headers as well.
- */
-@property (nonatomic, copy) NSDictionary * objectMeta;
-
-/**
- Upload progress callback.
- It's called on the background thread.
- */
-@property (nonatomic, copy) OSSNetworkingUploadProgressBlock uploadProgress;
-
-/**
- * the sha1 of content
- */
-@property (nonatomic, copy) NSString *contentSHA1;
-
-
-@end
-
-/**
- * append object result
- */
-@interface OSSAppendObjectResult : OSSResult
-
-/**
- TODOTODO
- ETag (entity tag). It's created for every object when it's created.
- For Objects created by PUT, ETag is the MD5 value of the content data. For others, ETag is the UUID of the content.
- ETag is used for checking data integrity.
- */
-@property (nonatomic, copy) NSString * eTag;
-
-/**
- Specifies the next starting position. It's essentially the current object size.
- This header is included in the successful response or the error response when the start position does not match the object size.
- */
-@property (nonatomic, assign, readwrite) int64_t xOssNextAppendPosition;
-@end
-
-/**
- The request of deleting an object.
- */
-@interface OSSDeleteObjectRequest : OSSRequest
-
-/**
- Bucket name
- */
-@property (nonatomic, copy) NSString * bucketName;
-
-/**
- Object object
- */
-@property (nonatomic, copy) NSString * objectKey;
-@end
-
-/**
- Result class of deleting an object
- */
-@interface OSSDeleteObjectResult : OSSResult
-@end
-
-/**
- Request class of copying an object in OSS.
- */
-@interface OSSCopyObjectRequest : OSSRequest
-
-/**
- Bucket name
- */
-@property (nonatomic, copy) NSString * bucketName;
-
-/**
- Object name
- */
-@property (nonatomic, copy) NSString * objectKey;
-
-/**
- * Source object's address (the caller needs the read permission on this object)
- */
-@property (nonatomic, copy) NSString * sourceCopyFrom DEPRECATED_MSG_ATTRIBUTE("please use sourceBucketName & sourceObjectKey instead!it will be removed in next version.");
-
-@property (nonatomic, copy) NSString * sourceBucketName;
-
-@property (nonatomic, copy) NSString * sourceObjectKey;
-
-/**
- The content type
- */
-@property (nonatomic, copy) NSString * contentType;
-
-/**
- The content's MD5 digest.
- It's calculated according to RFC 1864 and encoded in base64.
- Though it's optional, it's recommended to turn it on for integrity check.
- */
-@property (nonatomic, copy) NSString * contentMd5;
-
-/**
- The user metadata dictionary, which starts with x-oss-meta-. 
- The total size of user metadata can be no more than 8KB.
- It could include standard http headers as well.
- */
-@property (nonatomic, copy) NSDictionary * objectMeta;
-
-/**
- * the sha1 of content
- */
-@property (nonatomic, copy) NSString *contentSHA1;
-
-
-@end
-
-/**
- The result class of copying an object
- */
-@interface OSSCopyObjectResult : OSSResult
-
-/**
- The last modified time
- */
-@property (nonatomic, copy) NSString * lastModifed;
-
-/**
- The ETag of the new object.
- */
-@property (nonatomic, copy) NSString * eTag;
-@end
-
-/**
- Request class of initiating a multipart upload.
- */
-@interface OSSInitMultipartUploadRequest : OSSRequest
-
-/**
- Bucket name
- */
-@property (nonatomic, copy) NSString * bucketName;
-
-/**
- Object name
- */
-@property (nonatomic, copy) NSString * objectKey;
-
-/**
- Content type
- */
-@property (nonatomic, copy) NSString * contentType;
-
-/**
- The object's download name. Checks out RFC 2616 for more details.
- */
-@property (nonatomic, copy) NSString * contentDisposition;
-
-/**
- The content encoding. Checks out RFC 2616.
- */
-@property (nonatomic, copy) NSString * contentEncoding;
-
-/**
- Specifies the cache control behavior when it's downloaded. Checks out RFC 2616 for more details.
- */
-@property (nonatomic, copy) NSString * cacheControl;
-
-/**
- Expiration time in milliseconds. Checks out RFC 2616 for more details.
- */
-@property (nonatomic, copy) NSString * expires;
-
-/**
- The dictionary of object's custom metadata, which starts with x-oss-meta-. 
- The total size of user metadata is no more than 8KB.
- It could include other standard http headers.
- */
-@property (nonatomic, copy) NSDictionary * objectMeta;
-
-/**
- * When Setting this value to YES , parts will be uploaded in order. Default value is NO.
- */
-@property (nonatomic, assign) BOOL sequential;
-
-@end
-
-/**
- The resutl class of initiating a multipart upload.
- */
-@interface OSSInitMultipartUploadResult : OSSResult
-
-/**
- The upload Id of the multipart upload
- */
-@property (nonatomic, copy) NSString * uploadId;
-@end
-
-/**
- The request class of uploading one part.
- */
-@interface OSSUploadPartRequest : OSSRequest
-
-/**
- Bucket name
- */
-@property (nonatomic, copy) NSString * bucketName;
-
-/**
- Object name
- */
-@property (nonatomic, copy) NSString * objectkey;
-
-/**
- Multipart Upload id.
- */
-@property (nonatomic, copy) NSString * uploadId;
-
-/**
- The part number of this part.
- */
-@property (nonatomic, assign) int partNumber;
-
-/**
- The content MD5 value.
- It's calculated according to RFC 1864 and encoded in base64.
- Though it's optional, it's recommended to turn it on for integrity check.
- */
-@property (nonatomic, copy) NSString * contentMd5;
-
-/**
- The in-memory data to upload from.
- */
-@property (nonatomic, strong) NSData * uploadPartData;
-
-/**
- The local file path to upload from
- */
-@property (nonatomic, strong) NSURL * uploadPartFileURL;
-
-/**
- The upload progress callback.
- It runs in background thread (not UI thread);
- */
-@property (nonatomic, copy) OSSNetworkingUploadProgressBlock uploadPartProgress;
-
-/**
- * the sha1 of content
- */
-@property (nonatomic, copy) NSString *contentSHA1;
-
-@end
-
-/**
- The result class of uploading one part.
- */
-@interface OSSUploadPartResult : OSSResult
-@property (nonatomic, copy) NSString * eTag;
-@end
-
-/**
- The Part information. It's called by CompleteMultipartUpload().
- */
-@interface OSSPartInfo : NSObject<NSCopying>
-
-/**
- The part number in this part upload.
- */
-@property (nonatomic, assign) int32_t partNum;
-
-/**
- ETag value of this part returned by OSS.
- */
-@property (nonatomic, copy) NSString * eTag;
-
-/**
- The part size.
- */
-@property (nonatomic, assign) int64_t size;
-
-@property (nonatomic, assign) uint64_t crc64;
-
-+ (instancetype)partInfoWithPartNum:(int32_t)partNum eTag:(NSString *)eTag size:(int64_t)size __attribute__((deprecated("Use partInfoWithPartNum:eTag:size:crc64: to instead!")));
-+ (instancetype)partInfoWithPartNum:(int32_t)partNum eTag:(NSString *)eTag size:(int64_t)size crc64:(uint64_t)crc64;
-
-- (NSDictionary *)entityToDictionary;
-
-@end
-
-/**
- The request class of completing a multipart upload.
- */
-@interface OSSCompleteMultipartUploadRequest : OSSRequest
-
-/**
- Bucket name
- */
-@property (nonatomic, copy) NSString * bucketName;
-
-/**
- Object name
- */
-@property (nonatomic, copy) NSString * objectKey;
-
-/**
- Multipart upload Id
- */
-@property (nonatomic, copy) NSString * uploadId;
-
-/**
- The content MD5 value.
- It's calculated according to RFC 1864 and encoded in base64.
- Though it's optional, it's recommended to turn it on for integrity check. 
- */
-@property (nonatomic, copy) NSString * contentMd5;
-
-/**
- All parts' information.
- */
-@property (nonatomic, strong) NSArray * partInfos;
-
-/**
- Server side callback parameter
- */
-@property (nonatomic, copy) NSDictionary * callbackParam;
-
-/**
- Callback variables 
- */
-@property (nonatomic, copy) NSDictionary * callbackVar;
-
-/**
- The metadata header
- */
-@property (nonatomic, copy) NSDictionary * completeMetaHeader;
-
-/**
- * the sha1 of content
- */
-@property (nonatomic, copy) NSString *contentSHA1;
-
-@end
-
-/**
- The resutl class of completing a multipart upload.
- */
-@interface OSSCompleteMultipartUploadResult : OSSResult
-
-/**
- The object's URL
- */
-@property (nonatomic, copy) NSString * location;
-
-/**
- ETag (entity tag).
- It's generated when the object is created. 
- */
-@property (nonatomic, copy) NSString * eTag;
-
-/**
- The callback response if the callback is specified.
- The resutl class of initiating a multipart upload.
- */
-@property (nonatomic, copy) NSString * serverReturnJsonString;
-@end
-
-/**
- The request class of listing all parts that have been uploaded.
- */
-@interface OSSListPartsRequest : OSSRequest
-
-/**
- Bucket name
- The request class of uploading one part.*/
-@property (nonatomic, copy) NSString * bucketName;
-
-/**
- Object name
- */
-@property (nonatomic, copy) NSString * objectKey;
-
-/**
- The multipart upload Id.
- */
-@property (nonatomic, copy) NSString * uploadId;
-
-/**
- The max part count to return
- */
-@property (nonatomic, assign) int maxParts;
-
-/**
- The part number marker filter---only parts whose part number is greater than this value will be returned.
- */
-@property (nonatomic, assign) int partNumberMarker;
-@end
-
-/**
-The result class of listing uploaded parts.
-*/
-@interface OSSListPartsResult : OSSResult
-
-/**
- The next part number marker. If the response does not include all data, this header specifies what's the start point for the next list call.
- */
-@property (nonatomic, assign) int nextPartNumberMarker;
-
-/**
- The max parts count to return.
- */
-@property (nonatomic, assign) int maxParts;
-
-/**
- Flag of truncated data in the response. If it's true, it means there're more data to come.
- If it's false, it means all data have been returned.
- */
-@property (nonatomic, assign) BOOL isTruncated;
-
-/**
- The array of the part information.
- */
-@property (nonatomic, strong, nullable) NSArray * parts;
-@end
-
-/**
- The request class of listing all multipart uploads.
- */
-@interface OSSListMultipartUploadsRequest : OSSRequest
-/**
- Bucket name.
- */
-@property (nonatomic, copy) NSString * bucketName;
-
-/**
- The delimiter.
- */
-@property (nonatomic, copy) NSString * delimiter;
-
-/**
- The prefix.
- */
-@property (nonatomic, copy) NSString * prefix;
-
-/**
- The max number of uploads.
- */
-@property (nonatomic, assign) int32_t maxUploads;
-
-/**
- The key marker filter.
- */
-@property (nonatomic, copy) NSString * keyMarker;
-
-/**
- The upload Id marker.
- */
-@property (nonatomic, copy) NSString * uploadIdMarker;
-
-/**
- The encoding type of the object in the response body.
- */
-@property (nonatomic, copy) NSString * encodingType;
-
-@end
-
-/**
- The result class of listing multipart uploads.
- */
-@interface OSSListMultipartUploadsResult : OSSResult
-/**
- Bucket name
- */
-@property (nonatomic, copy) NSString * bucketName;
-
-/**
- The marker filter of the objects returned---all objects returned are greater than this marker in lexicographic order.
- */
-@property (nonatomic, copy) NSString * keyMarker;
-
-/**
- The delimiter to differentiate the folder object and file object.
- For object whose name ends with the delimiter, then it's treated as folder or common prefixes.
- */
-@property (nonatomic, copy) NSString * delimiter;
-
-/**
- The prefix of the objects returned----the returned objects must have this prefix.
- */
-@property (nonatomic, copy) NSString * prefix;
-
-/**
- The upload Id marker.
- */
-@property (nonatomic, copy) NSString * uploadIdMarker;
-
-/**
- The max entries to return. By default it's 100 and it could be up to 1000.
- */
-@property (nonatomic, assign) int32_t maxUploads;
-
-/**
- If not all results are returned this time, the response request includes the NextKeyMarker element to indicate the value of KeyMarker in the next request.
- */
-@property (nonatomic, copy) NSString * nextKeyMarker;
-
-/**
- If not all results are returned this time, the response request includes the NextUploadMarker element to indicate the value of UploadMarker in the next request.
- */
-@property (nonatomic, copy) NSString * nextUploadIdMarker;
-
-/**
- Flag of truncated result. If it's truncated, it means there's more entries to return.
- */
-@property (nonatomic, assign) BOOL isTruncated;
-
-@property (nonatomic, strong, nullable) NSArray * uploads;
-
-/**
- The arrary of common prefixes. Each element is one common prefix.
- */
-@property (nonatomic, strong) NSArray * commonPrefixes;
-@end
-
-/**
- Request to abort a multipart upload
- */
-@interface OSSAbortMultipartUploadRequest : OSSRequest
-
-/**
- Bucket name
- */
-@property (nonatomic, copy) NSString * bucketName;
-
-/**
- Object name
- */
-@property (nonatomic, copy) NSString * objectKey;
-
-/**
- The multipart upload Id.
- */
-@property (nonatomic, copy) NSString * uploadId;
-@end
-
-/**
- The result class of aborting a multipart upload
- */
-@interface OSSAbortMultipartUploadResult : OSSResult
-@end
-
-/**
- The request class of multipart upload.
- */
-@interface OSSMultipartUploadRequest : OSSRequest
-
-/**
- The upload Id
- */
-@property (nonatomic, copy) NSString * uploadId;
-
-/**
- Bucket name
- */
-@property (nonatomic, copy) NSString * bucketName;
-
-/**
- Object object
- */
-@property (nonatomic, copy) NSString * objectKey;
-
-/**
- The local file path to upload from.
- */
-@property (nonatomic, strong) NSURL * uploadingFileURL;
-
-/**
- The part size, minimal value is 100KB.
- */
-@property (nonatomic, assign) NSUInteger partSize;
-
-/**
- Upload progress callback.
- It runs at the background thread (not UI thread).
- */
-@property (nonatomic, copy) OSSNetworkingUploadProgressBlock uploadProgress;
-
-/**
- The callback parmeters
- */
-@property (nonatomic, copy) NSDictionary * callbackParam;
-
-/**
- The callback variables
- */
-@property (nonatomic, copy) NSDictionary * callbackVar;
-
-/**
- Content type
- */
-@property (nonatomic, copy) NSString * contentType;
-
-/**
- The metadata header
- */
-@property (nonatomic, copy) NSDictionary * completeMetaHeader;
-
-/**
- * the sha1 of content
- */
-@property (nonatomic, copy) NSString *contentSHA1;
-
-/**
- * the md5 of content
- */
-@property (nonatomic, copy) NSString *md5String;
-
-
-- (void)cancel;
-@end
-
-/**
- The request class of resumable upload.
- */
-@interface OSSResumableUploadRequest : OSSMultipartUploadRequest
-
-
-/**
- directory path about create record uploadId file 
- */
-@property (nonatomic, copy) NSString * recordDirectoryPath;
-
-
-/**
- need or not delete uploadId with cancel
- */
-@property (nonatomic, assign) BOOL deleteUploadIdOnCancelling;
-
-/**
- All running children requests
- */
-@property (atomic, weak) OSSRequest * runningChildrenRequest;
-
-@end
-
-
-/**
- The result class of resumable uploading
- */
-@interface OSSResumableUploadResult : OSSResult
-
-/**
- The callback response, if the callback is specified.
- */
-@property (nonatomic, copy) NSString * serverReturnJsonString;
-
-@end
-
-
-/**
- for more information,Please refer to the link https://help.aliyun.com/document_detail/31989.html
- */
-@interface OSSCallBackRequest : OSSRequest
-
-@property (nonatomic, copy) NSString *bucketName;
-
-@property (nonatomic, copy) NSString *objectName;
-/**
- The callback parameters.when you set this value,there are required params as below:
- {
-    "callbackUrl": xxx
-    "callbackBody": xxx
- }
- */
-@property (nonatomic, copy) NSDictionary *callbackParam;
-/**
- The callback variables.
- */
-@property (nonatomic, copy) NSDictionary *callbackVar;
-
-@end
-
-
-
-@interface OSSCallBackResult : OSSResult
-
-@property (nonatomic, copy) NSDictionary *serverReturnXML;
-
-/**
- If the callback is specified, this is the callback response result.
- */
-@property (nonatomic, copy) NSString *serverReturnJsonString;
-
-@end
-
-
-/**
- for more information,Please refer to the link https://help.aliyun.com/document_detail/55811.html
- */
-@interface OSSImagePersistRequest : OSSRequest
-
-@property (nonatomic, copy) NSString *fromBucket;
-
-@property (nonatomic, copy) NSString *fromObject;
-
-@property (nonatomic, copy) NSString *toBucket;
-
-@property (nonatomic, copy) NSString *toObject;
-
-@property (nonatomic, copy) NSString *action;
-
-@end
-
-@interface OSSImagePersistResult : OSSResult
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 856
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSModel.m

@@ -1,856 +0,0 @@
-//
-//  OSSModel.m
-//  oss_ios_sdk
-//
-//  Created by zhouzhuo on 8/16/15.
-//  Copyright (c) 2015 aliyun.com. All rights reserved.
-//
-#import "OSSDefine.h"
-#import "OSSModel.h"
-#import "OSSBolts.h"
-#import "OSSUtil.h"
-#import "OSSNetworking.h"
-#import "OSSLog.h"
-#import "OSSXMLDictionary.h"
-#if TARGET_OS_IOS
-#import <UIKit/UIDevice.h>
-#endif
-
-#import "OSSAllRequestNeededMessage.h"
-
-@implementation NSDictionary (OSS)
-
-- (NSString *)base64JsonString {
-    NSError * error;
-    NSData * jsonData = [NSJSONSerialization dataWithJSONObject:self
-                                                        options:0
-                                                          error:&error];
-
-    if (!jsonData) {
-        return @"e30="; // base64("{}");
-    } else {
-        NSString * jsonStr = [[[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding] stringByReplacingOccurrencesOfString:@"\\/" withString:@"/"];
-        NSLog(@"callback json - %@", jsonStr);
-        return [[jsonStr dataUsingEncoding:NSUTF8StringEncoding] base64EncodedStringWithOptions:0];
-    }
-}
-
-@end
-
-@implementation OSSSyncMutableDictionary
-
-- (instancetype)init {
-    if (self = [super init]) {
-        _dictionary = [NSMutableDictionary dictionary];
-        _dispatchQueue = dispatch_queue_create("com.aliyun.aliyunsycmutabledictionary", DISPATCH_QUEUE_SERIAL);
-    }
-
-    return self;
-}
-
-- (NSArray *)allKeys {
-    __block NSArray *allKeys = nil;
-    dispatch_sync(self.dispatchQueue, ^{
-        allKeys = [self.dictionary allKeys];
-    });
-    return allKeys;
-}
-
-- (id)objectForKey:(id)aKey {
-    __block id returnObject = nil;
-
-    dispatch_sync(self.dispatchQueue, ^{
-        returnObject = [self.dictionary objectForKey:aKey];
-    });
-
-    return returnObject;
-}
-
-- (void)setObject:(id)anObject forKey:(id <NSCopying>)aKey {
-    dispatch_sync(self.dispatchQueue, ^{
-        [self.dictionary oss_setObject:anObject forKey:aKey];
-    });
-}
-
-- (void)removeObjectForKey:(id)aKey {
-    dispatch_sync(self.dispatchQueue, ^{
-        [self.dictionary removeObjectForKey:aKey];
-    });
-}
-
-@end
-
-@implementation OSSFederationToken
-
-- (NSString *)description
-{
-    return [NSString stringWithFormat:@"OSSFederationToken<%p>:{AccessKeyId: %@\nAccessKeySecret: %@\nSecurityToken: %@\nExpiration: %@}", self, _tAccessKey, _tSecretKey, _tToken, _expirationTimeInGMTFormat];
-}
-
-@end
-
-@implementation OSSPlainTextAKSKPairCredentialProvider
-
-- (instancetype)initWithPlainTextAccessKey:(nonnull NSString *)accessKey secretKey:(nonnull NSString *)secretKey {
-    if (self = [super init]) {
-        self.accessKey = [accessKey oss_trim];
-        self.secretKey = [secretKey oss_trim];
-    }
-    return self;
-}
-
-- (nullable NSString *)sign:(NSString *)content error:(NSError **)error {
-    if (![self.accessKey oss_isNotEmpty] || ![self.secretKey oss_isNotEmpty])
-    {
-        if (error != nil)
-        {
-            *error = [NSError errorWithDomain:OSSClientErrorDomain
-                                         code:OSSClientErrorCodeSignFailed
-                                     userInfo:@{OSSErrorMessageTOKEN: @"accessKey or secretKey can't be null"}];
-        }
-        
-        return nil;
-    }
-    NSString * sign = [OSSUtil calBase64Sha1WithData:content withSecret:self.secretKey];
-    return [NSString stringWithFormat:@"OSS %@:%@", self.accessKey, sign];
-}
-
-@end
-
-@implementation OSSCustomSignerCredentialProvider
-
-- (instancetype)initWithImplementedSigner:(OSSCustomSignContentBlock)signContent
-{
-    NSParameterAssert(signContent);
-    if (self = [super init])
-    {
-        _signContent = signContent;
-    }
-    return self;
-}
-
-- (NSString *)sign:(NSString *)content error:(NSError **)error
-{
-    NSString * signature = @"";
-    @synchronized(self) {
-        signature = self.signContent(content, error);
-    }
-    if (*error) {
-        *error = [NSError errorWithDomain:OSSClientErrorDomain
-                                     code:OSSClientErrorCodeSignFailed
-                                 userInfo:[[NSDictionary alloc] initWithDictionary:[*error userInfo]]];
-        return nil;
-    }
-    return signature;
-}
-
-@end
-
-@implementation OSSFederationCredentialProvider
-
-- (instancetype)initWithFederationTokenGetter:(OSSGetFederationTokenBlock)federationTokenGetter {
-    if (self = [super init]) {
-        self.federationTokenGetter = federationTokenGetter;
-    }
-    return self;
-}
-
-- (nullable OSSFederationToken *)getToken:(NSError **)error {
-    OSSFederationToken * validToken = nil;
-    @synchronized(self) {
-        if (self.cachedToken == nil) {
-
-            self.cachedToken = self.federationTokenGetter();
-        } else {
-            if (self.cachedToken.expirationTimeInGMTFormat) {
-                NSDateFormatter * fm = [NSDateFormatter new];
-                [fm setDateFormat:@"yyyy-MM-dd'T'HH:mm:ssZ"];
-                self.cachedToken.expirationTimeInMilliSecond = [[fm dateFromString:self.cachedToken.expirationTimeInGMTFormat] timeIntervalSince1970] * 1000;
-                self.cachedToken.expirationTimeInGMTFormat = nil;
-                OSSLogVerbose(@"Transform GMT date to expirationTimeInMilliSecond: %lld", self.cachedToken.expirationTimeInMilliSecond);
-            }
-
-            NSDate * expirationDate = [NSDate dateWithTimeIntervalSince1970:(NSTimeInterval)(self.cachedToken.expirationTimeInMilliSecond / 1000)];
-            NSTimeInterval interval = [expirationDate timeIntervalSinceDate:[NSDate oss_clockSkewFixedDate]];
-            /* if this token will be expired after less than 2min, we abort it in case of when request arrived oss server,
-               it's expired already. */
-            if (interval < 5 * 60) {
-                OSSLogDebug(@"get federation token, but after %lf second it would be expired", interval);
-                self.cachedToken = self.federationTokenGetter();
-            }
-        }
-
-        validToken = self.cachedToken;
-    }
-    if (!validToken)
-    {
-        if (error != nil)
-        {
-            *error = [NSError errorWithDomain:OSSClientErrorDomain
-                                         code:OSSClientErrorCodeSignFailed
-                                     userInfo:@{OSSErrorMessageTOKEN: @"Can't get a federation token"}];
-        }
-        
-        return nil;
-    }
-    return validToken;
-}
-
-@end
-
-@implementation OSSStsTokenCredentialProvider
-
-- (OSSFederationToken *)getToken {
-    OSSFederationToken * token = [OSSFederationToken new];
-    token.tAccessKey = self.accessKeyId;
-    token.tSecretKey = self.secretKeyId;
-    token.tToken = self.securityToken;
-    token.expirationTimeInMilliSecond = NSIntegerMax;
-    return token;
-}
-
-- (instancetype)initWithAccessKeyId:(NSString *)accessKeyId secretKeyId:(NSString *)secretKeyId securityToken:(NSString *)securityToken {
-    if (self = [super init]) {
-        self.accessKeyId = [accessKeyId oss_trim];
-        self.secretKeyId = [secretKeyId oss_trim];
-        self.securityToken = [securityToken oss_trim];
-    }
-    return self;
-}
-
-- (NSString *)sign:(NSString *)content error:(NSError **)error {
-    NSString * sign = [OSSUtil calBase64Sha1WithData:content withSecret:self.secretKeyId];
-    return [NSString stringWithFormat:@"OSS %@:%@", self.accessKeyId, sign];
-}
-
-@end
-
-@implementation OSSAuthCredentialProvider
-
-- (instancetype)initWithAuthServerUrl:(NSString *)authServerUrl
-{
-    return [self initWithAuthServerUrl:authServerUrl responseDecoder:nil];
-}
-
-- (instancetype)initWithAuthServerUrl:(NSString *)authServerUrl responseDecoder:(nullable OSSResponseDecoderBlock)decoder
-{
-    self = [super initWithFederationTokenGetter:^OSSFederationToken * {
-        NSURL * url = [NSURL URLWithString:self.authServerUrl];
-        NSURLRequest * request = [NSURLRequest requestWithURL:url];
-        OSSTaskCompletionSource * tcs = [OSSTaskCompletionSource taskCompletionSource];
-        NSURLSession * session = [NSURLSession sharedSession];
-        NSURLSessionTask * sessionTask = [session dataTaskWithRequest:request
-                                                    completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
-                                                        if (error) {
-                                                            [tcs setError:error];
-                                                            return;
-                                                        }
-                                                        [tcs setResult:data];
-                                                    }];
-        [sessionTask resume];
-        [tcs.task waitUntilFinished];
-        if (tcs.task.error) {
-            return nil;
-        } else {
-            NSData* data = tcs.task.result;
-            if(decoder){
-                data = decoder(data);
-            }
-            NSDictionary * object = [NSJSONSerialization JSONObjectWithData:data
-                                                                    options:kNilOptions
-                                                                      error:nil];
-            int statusCode = [[object objectForKey:@"StatusCode"] intValue];
-            if (statusCode == 200) {
-                OSSFederationToken * token = [OSSFederationToken new];
-                // All the entries below are mandatory.
-                token.tAccessKey = [object objectForKey:@"AccessKeyId"];
-                token.tSecretKey = [object objectForKey:@"AccessKeySecret"];
-                token.tToken = [object objectForKey:@"SecurityToken"];
-                token.expirationTimeInGMTFormat = [object objectForKey:@"Expiration"];
-                OSSLogDebug(@"token: %@ %@ %@ %@", token.tAccessKey, token.tSecretKey, token.tToken, [object objectForKey:@"Expiration"]);
-                return token;
-            }else{
-                return nil;
-            }
-            
-        }
-    }];
-    if(self){
-        self.authServerUrl = authServerUrl;
-    }
-    return self;
-}
-
-@end
-
-NSString * const BACKGROUND_SESSION_IDENTIFIER = @"com.aliyun.oss.backgroundsession";
-
-@implementation OSSClientConfiguration
-
-- (instancetype)init {
-    if (self = [super init]) {
-        self.maxRetryCount = OSSDefaultRetryCount;
-        self.maxConcurrentRequestCount = OSSDefaultMaxConcurrentNum;
-        self.enableBackgroundTransmitService = NO;
-        self.isHttpdnsEnable = YES;
-        self.backgroundSesseionIdentifier = BACKGROUND_SESSION_IDENTIFIER;
-        self.timeoutIntervalForRequest = OSSDefaultTimeoutForRequestInSecond;
-        self.timeoutIntervalForResource = OSSDefaultTimeoutForResourceInSecond;
-    }
-    return self;
-}
-
-- (void)setCnameExcludeList:(NSArray *)cnameExcludeList {
-    NSMutableArray * array = [NSMutableArray new];
-    [cnameExcludeList enumerateObjectsUsingBlock:^(id  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
-        NSString * host = [(NSString *)obj lowercaseString];
-        if ([host containsString:@"://"]) {
-            NSString * trimHost = [host substringFromIndex:[host rangeOfString:@"://"].location + 3];
-            [array addObject:trimHost];
-        } else {
-            [array addObject:host];
-        }
-    }];
-    _cnameExcludeList = array.copy;
-}
-
-@end
-
-@implementation OSSSignerInterceptor
-
-- (instancetype)initWithCredentialProvider:(id<OSSCredentialProvider>)credentialProvider {
-    if (self = [super init]) {
-        self.credentialProvider = credentialProvider;
-    }
-    return self;
-}
-
-- (OSSTask *)interceptRequestMessage:(OSSAllRequestNeededMessage *)requestMessage {
-    OSSLogVerbose(@"signing intercepting - ");
-    NSError * error = nil;
-
-    /****************************************************************
-    * define a constant array to contain all specified subresource */
-    static NSArray * OSSSubResourceARRAY = nil;
-    static dispatch_once_t onceToken;
-    dispatch_once(&onceToken, ^{
-        OSSSubResourceARRAY = @[@"acl", @"uploadId", @"partNumber", @"uploads", @"logging", @"website", @"location",
-                                @"lifecycle", @"referer", @"cors", @"delete", @"append", @"position", @"security-token", @"x-oss-process", @"sequential",@"bucketInfo",@"symlink", @"restore"];
-    });
-    /****************************************************************/
-
-    /* initial each part of content to sign */
-    NSString * method = requestMessage.httpMethod;
-    NSString * contentType = @"";
-    NSString * contentMd5 = @"";
-    NSString * date = requestMessage.date;
-    NSString * xossHeader = @"";
-    NSString * resource = @"";
-
-    OSSFederationToken * federationToken = nil;
-
-    if (requestMessage.contentType) {
-        contentType = requestMessage.contentType;
-    }
-    if (requestMessage.contentMd5) {
-        contentMd5 = requestMessage.contentMd5;
-    }
-
-    /* if credential provider is a federation token provider, it need to specially handle */
-    if ([self.credentialProvider isKindOfClass:[OSSFederationCredentialProvider class]]) {
-        federationToken = [(OSSFederationCredentialProvider *)self.credentialProvider getToken:&error];
-        if (error) {
-            return [OSSTask taskWithError:error];
-        }
-        [requestMessage.headerParams oss_setObject:federationToken.tToken forKey:@"x-oss-security-token"];
-    } else if ([self.credentialProvider isKindOfClass:[OSSStsTokenCredentialProvider class]]) {
-        federationToken = [(OSSStsTokenCredentialProvider *)self.credentialProvider getToken];
-        [requestMessage.headerParams oss_setObject:federationToken.tToken forKey:@"x-oss-security-token"];
-    }
-    
-    [requestMessage.headerParams oss_setObject:requestMessage.contentSHA1 forKey:OSSHttpHeaderHashSHA1];
-        
-    /* construct CanonicalizedOSSHeaders */
-    if (requestMessage.headerParams) {
-        NSMutableArray * params = [[NSMutableArray alloc] init];
-        NSArray * sortedKey = [[requestMessage.headerParams allKeys] sortedArrayUsingComparator:^NSComparisonResult(id obj1, id obj2) {
-            return [obj1 compare:obj2];
-        }];
-        for (NSString * key in sortedKey) {
-            if ([key hasPrefix:@"x-oss-"]) {
-                [params addObject:[NSString stringWithFormat:@"%@:%@", key, [requestMessage.headerParams objectForKey:key]]];
-            }
-        }
-        if ([params count]) {
-            xossHeader = [NSString stringWithFormat:@"%@\n", [params componentsJoinedByString:@"\n"]];
-        }
-    }
-
-    /* construct CanonicalizedResource */
-    resource = @"/";
-    if (requestMessage.bucketName) {
-        resource = [NSString stringWithFormat:@"/%@/", requestMessage.bucketName];
-    }
-    if (requestMessage.objectKey) {
-        resource = [resource oss_stringByAppendingPathComponentForURL:requestMessage.objectKey];
-    }
-    if (requestMessage.params) {
-        NSMutableArray * querys = [[NSMutableArray alloc] init];
-        NSArray * sortedKey = [[requestMessage.params allKeys] sortedArrayUsingComparator:^NSComparisonResult(id obj1, id obj2) {
-            return [obj1 compare:obj2];
-        }];
-        for (NSString * key in sortedKey) {
-            NSString * value = [requestMessage.params objectForKey:key];
-
-            if (![OSSSubResourceARRAY containsObject:key]) { // notice it's based on content compare
-                continue;
-            }
-
-            if ([value isEqualToString:@""]) {
-                [querys addObject:[NSString stringWithFormat:@"%@", key]];
-            } else {
-                [querys addObject:[NSString stringWithFormat:@"%@=%@", key, value]];
-            }
-        }
-        if ([querys count]) {
-            resource = [resource stringByAppendingString:[NSString stringWithFormat:@"?%@",[querys componentsJoinedByString:@"&"]]];
-        }
-    }
-
-    /* now, join every part of content and sign */
-    NSString * stringToSign = [NSString stringWithFormat:@"%@\n%@\n%@\n%@\n%@%@", method, contentMd5, contentType, date, xossHeader, resource];
-    OSSLogDebug(@"string to sign: %@", stringToSign);
-    if ([self.credentialProvider isKindOfClass:[OSSFederationCredentialProvider class]]
-        || [self.credentialProvider isKindOfClass:[OSSStsTokenCredentialProvider class]])
-    {
-        NSString * signature = [OSSUtil sign:stringToSign withToken:federationToken];
-        [requestMessage.headerParams oss_setObject:signature forKey:@"Authorization"];
-    }else if ([self.credentialProvider isKindOfClass:[OSSCustomSignerCredentialProvider class]])
-    {
-        OSSCustomSignerCredentialProvider *provider = (OSSCustomSignerCredentialProvider *)self.credentialProvider;
-        
-        NSError *customSignError;
-        NSString * signature = [provider sign:stringToSign error:&customSignError];
-        if (customSignError) {
-            OSSLogError(@"OSSCustomSignerError: %@", customSignError)
-            return [OSSTask taskWithError: customSignError];
-        }
-        [requestMessage.headerParams oss_setObject:signature forKey:@"Authorization"];
-    }else
-    {
-        NSString * signature = [self.credentialProvider sign:stringToSign error:&error];
-        if (error) {
-            return [OSSTask taskWithError:error];
-        }
-        [requestMessage.headerParams oss_setObject:signature forKey:@"Authorization"];
-    }
-    return [OSSTask taskWithResult:nil];
-}
-
-@end
-
-@implementation OSSUASettingInterceptor
-
-- (instancetype)initWithClientConfiguration:(OSSClientConfiguration *)clientConfiguration{
-    if (self = [super init]) {
-        self.clientConfiguration = clientConfiguration;
-    }
-    return self;
-}
-
-- (OSSTask *)interceptRequestMessage:(OSSAllRequestNeededMessage *)request {
-    NSString * userAgent = [self getUserAgent:self.clientConfiguration.userAgentMark];
-    [request.headerParams oss_setObject:userAgent forKey:@"User-Agent"];
-    return [OSSTask taskWithResult:nil];
-}
-
-
-- (NSString *)getUserAgent:(NSString *)customUserAgent {
-    static NSString * userAgent = nil;
-    static dispatch_once_t once;
-    NSString * tempUserAgent = nil;
-    dispatch_once(&once, ^{
-        NSString *localeIdentifier = [[NSLocale currentLocale] localeIdentifier];
-#if TARGET_OS_IOS
-        NSString *systemName = [[[UIDevice currentDevice] systemName] stringByReplacingOccurrencesOfString:@" " withString:@"-"];
-        NSString *systemVersion = [[UIDevice currentDevice] systemVersion];
-        userAgent = [NSString stringWithFormat:@"%@/%@(/%@/%@/%@)", OSSUAPrefix, OSSSDKVersion, systemName, systemVersion, localeIdentifier];
-#elif TARGET_OS_OSX
-        userAgent = [NSString stringWithFormat:@"%@/%@(/%@/%@/%@)", OSSUAPrefix, OSSSDKVersion, @"OSX", [NSProcessInfo processInfo].operatingSystemVersionString, localeIdentifier];
-#endif
-    });
-    if(customUserAgent){
-        if(userAgent){
-            tempUserAgent = [[userAgent stringByAppendingString:@"/"] stringByAppendingString:customUserAgent];
-        }else{
-            tempUserAgent = customUserAgent;
-        }
-    }else{
-        tempUserAgent = userAgent;
-    }
-    return tempUserAgent;
-}
-
-@end
-
-@implementation OSSTimeSkewedFixingInterceptor
-
-- (OSSTask *)interceptRequestMessage:(OSSAllRequestNeededMessage *)request {
-    request.date = [[NSDate oss_clockSkewFixedDate] oss_asStringValue];
-    return [OSSTask taskWithResult:nil];
-}
-
-@end
-
-@implementation OSSRange
-
-- (instancetype)initWithStart:(int64_t)start withEnd:(int64_t)end {
-    if (self = [super init]) {
-        self.startPosition = start;
-        self.endPosition = end;
-    }
-    return self;
-}
-
-- (NSString *)toHeaderString {
-
-    NSString * rangeString = nil;
-
-    if (self.startPosition < 0 && self.endPosition < 0) {
-        rangeString = [NSString stringWithFormat:@"bytes=%lld-%lld", self.startPosition, self.endPosition];
-    } else if (self.startPosition < 0) {
-        rangeString = [NSString stringWithFormat:@"bytes=-%lld", self.endPosition];
-    } else if (self.endPosition < 0) {
-        rangeString = [NSString stringWithFormat:@"bytes=%lld-", self.startPosition];
-    } else {
-        rangeString = [NSString stringWithFormat:@"bytes=%lld-%lld", self.startPosition, self.endPosition];
-    }
-
-    return rangeString;
-}
-
-@end
-
-#pragma mark request and result objects
-
-@implementation OSSGetServiceRequest
-
-- (NSDictionary *)requestParams {
-    NSMutableDictionary * params = [NSMutableDictionary dictionary];
-    [params oss_setObject:self.prefix forKey:@"prefix"];
-    [params oss_setObject:self.marker forKey:@"marker"];
-    if (self.maxKeys > 0) {
-        [params oss_setObject:[@(self.maxKeys) stringValue] forKey:@"max-keys"];
-    }
-    return [params copy];
-}
-
-@end
-
-@implementation OSSGetServiceResult
-@end
-
-@implementation OSSCreateBucketRequest
-
-- (instancetype)init
-{
-    self = [super init];
-    if (self) {
-        _storageClass = OSSBucketStorageClassStandard;
-    }
-    return self;
-}
-
-- (NSString *)storageClassAsString {
-    NSString *storageClassString = nil;
-    switch (_storageClass) {
-        case OSSBucketStorageClassStandard:
-            storageClassString = @"Standard";
-            break;
-        case OSSBucketStorageClassIA:
-            storageClassString = @"IA";
-            break;
-        case OSSBucketStorageClassArchive:
-            storageClassString = @"Archive";
-            break;
-        default:
-            storageClassString = @"Unknown";
-            break;
-    }
-    return storageClassString;
-}
-
-@end
-
-@implementation OSSCreateBucketResult
-@end
-
-@implementation OSSDeleteBucketRequest
-@end
-
-@implementation OSSDeleteBucketResult
-@end
-
-@implementation OSSGetBucketRequest
-
-- (NSDictionary *)requestParams {
-    NSMutableDictionary * params = [NSMutableDictionary dictionary];
-    [params oss_setObject:self.delimiter forKey:@"delimiter"];
-    [params oss_setObject:self.prefix forKey:@"prefix"];
-    [params oss_setObject:self.marker forKey:@"marker"];
-    if (self.maxKeys > 0) {
-        [params oss_setObject:[@(self.maxKeys) stringValue] forKey:@"max-keys"];
-    }
-    return [params copy];
-}
-
-@end
-
-@implementation OSSListMultipartUploadsRequest
-- (NSDictionary *)requestParams {
-    NSMutableDictionary * params = [NSMutableDictionary dictionary];
-    [params oss_setObject:self.delimiter forKey:@"delimiter"];
-    [params oss_setObject:self.prefix forKey:@"prefix"];
-    [params oss_setObject:self.keyMarker forKey:@"key-marker"];
-    [params oss_setObject:self.uploadIdMarker forKey:@"upload-id-marker"];
-    [params oss_setObject:self.encodingType forKey:@"encoding-type"];
-    
-    if (self.maxUploads > 0) {
-        [params oss_setObject:[@(self.maxUploads) stringValue] forKey:@"max-uploads"];
-    }
-    
-    return [params copy];
-}
-@end
-
-@implementation OSSListMultipartUploadsResult
-@end
-
-@implementation OSSGetBucketResult
-@end
-
-@implementation OSSGetBucketACLRequest
-
-- (NSDictionary *)requestParams {
-    return @{@"acl": @""};
-}
-
-@end
-
-@implementation OSSGetBucketACLResult
-@end
-
-@implementation OSSHeadObjectRequest
-@end
-
-@implementation OSSHeadObjectResult
-@end
-
-@implementation OSSGetObjectRequest
-@end
-
-@implementation OSSGetObjectResult
-@end
-
-@implementation OSSPutObjectACLRequest
-
-- (instancetype)init
-{
-    self = [super init];
-    if (self) {
-        _acl = @"default";
-    }
-    return self;
-}
-
-@end
-
-@implementation OSSPutObjectACLResult
-@end
-
-@implementation OSSPutObjectRequest
-
-- (instancetype)init {
-    if (self = [super init]) {
-        self.objectMeta = [NSDictionary new];
-    }
-    return self;
-}
-
-@end
-
-@implementation OSSPutObjectResult
-@end
-
-@implementation OSSAppendObjectRequest
-
-- (instancetype)init {
-    if (self = [super init]) {
-        self.objectMeta = [NSDictionary new];
-    }
-    return self;
-}
-
-@end
-
-@implementation OSSAppendObjectResult
-@end
-
-@implementation OSSDeleteObjectRequest
-@end
-
-@implementation OSSDeleteObjectResult
-@end
-
-@implementation OSSCopyObjectRequest
-
-- (instancetype)init {
-    if (self = [super init]) {
-        self.objectMeta = [NSDictionary new];
-    }
-    return self;
-}
-
-@end
-
-@implementation OSSCopyObjectResult
-@end
-
-@implementation OSSInitMultipartUploadRequest
-
-- (instancetype)init {
-    if (self = [super init]) {
-        self.objectMeta = [NSDictionary new];
-    }
-    return self;
-}
-
-@end
-
-@implementation OSSInitMultipartUploadResult
-@end
-
-@implementation OSSUploadPartRequest
-@end
-
-@implementation OSSUploadPartResult
-@end
-
-@implementation OSSPartInfo
-
-+ (instancetype)partInfoWithPartNum:(int32_t)partNum
-                               eTag:(NSString *)eTag
-                               size:(int64_t)size {
-    return [self partInfoWithPartNum:partNum
-                                eTag:eTag
-                                size:size
-                               crc64:0];
-}
-
-+ (instancetype)partInfoWithPartNum:(int32_t)partNum eTag:(NSString *)eTag size:(int64_t)size crc64:(uint64_t)crc64
-{
-    OSSPartInfo *parInfo = [OSSPartInfo new];
-    parInfo.partNum = partNum;
-    parInfo.eTag = eTag;
-    parInfo.size = size;
-    parInfo.crc64 = crc64;
-    return parInfo;
-}
-
-- (nonnull NSDictionary *)entityToDictionary
-{
-    NSMutableDictionary *dict = [NSMutableDictionary dictionary];
-    [dict setValue:@(_partNum) forKey:@"partNum"];
-    if (_eTag)
-    {
-        [dict setValue:_eTag forKey:@"eTag"];
-    }
-    [dict setValue:@(_size) forKey:@"size"];
-    [dict setValue:@(_crc64) forKey:@"crc64"];
-    return [dict copy];
-}
-
-- (NSString *)description
-{
-    return [NSString stringWithFormat:@"OSSPartInfo<%p>:{partNum: %d,eTag: %@,partSize: %lld,crc64: %llu}",self,self.partNum,self.eTag,self.size,self.crc64];
-}
-
-#pragma marks - Protocol Methods
-- (id)copyWithZone:(nullable NSZone *)zone
-{
-    OSSPartInfo *instance = [[[self class] allocWithZone:zone] init];
-    instance.partNum = self.partNum;
-    instance.eTag = self.eTag;
-    instance.size = self.size;
-    instance.crc64 = self.crc64;
-    return instance;
-}
-
-@end
-
-@implementation OSSCompleteMultipartUploadRequest
-@end
-
-@implementation OSSCompleteMultipartUploadResult
-@end
-
-@implementation OSSAbortMultipartUploadRequest
-@end
-
-@implementation OSSAbortMultipartUploadResult
-@end
-
-@implementation OSSListPartsRequest
-@end
-
-@implementation OSSListPartsResult
-@end
-
-@implementation OSSMultipartUploadRequest
-
-- (instancetype)init {
-    if (self = [super init]) {
-        self.partSize = 256 * 1024;
-    }
-    return self;
-}
-
-- (void)cancel {
-    [super cancel];
-}
-
-@end
-
-@implementation OSSResumableUploadRequest
-
-- (instancetype)init {
-    if (self = [super init]) {
-        self.deleteUploadIdOnCancelling = YES;
-        self.partSize = 256 * 1024;
-    }
-    return self;
-}
-
-- (void)cancel {
-    [super cancel];
-    if(_runningChildrenRequest){
-        [_runningChildrenRequest cancel];
-    }
-}
-
-@end
-
-@implementation OSSResumableUploadResult
-@end
-
-@implementation OSSCallBackRequest
-@end
-
-@implementation OSSCallBackResult
-@end
-
-@implementation OSSImagePersistRequest
-@end
-
-@implementation OSSImagePersistResult
-@end

+ 0 - 45
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSNetworking.h

@@ -1,45 +0,0 @@
-//
-//  OSSNetworking.h
-//  oss_ios_sdk
-//
-//  Created by zhouzhuo on 8/16/15.
-//  Copyright (c) 2015 aliyun.com. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-#import "OSSModel.h"
-
-@class OSSSyncMutableDictionary;
-@class OSSNetworkingRequestDelegate;
-@class OSSExecutor;
-
-
-
-/**
- Network parameters
- */
-@interface OSSNetworkingConfiguration : NSObject
-@property (nonatomic, assign) uint32_t maxRetryCount;
-@property (nonatomic, assign) uint32_t maxConcurrentRequestCount;
-@property (nonatomic, assign) BOOL enableBackgroundTransmitService;
-@property (nonatomic, strong) NSString * backgroundSessionIdentifier;
-@property (nonatomic, assign) NSTimeInterval timeoutIntervalForRequest;
-@property (nonatomic, assign) NSTimeInterval timeoutIntervalForResource;
-@property (nonatomic, strong) NSString * proxyHost;
-@property (nonatomic, strong) NSNumber * proxyPort;
-@end
-
-
-/**
- The network interface which OSSClient uses for network read and write operations.
- */
-@interface OSSNetworking : NSObject <NSURLSessionDelegate, NSURLSessionDataDelegate>
-@property (nonatomic, strong) NSURLSession * session;
-@property (nonatomic, assign) BOOL isUsingBackgroundSession;
-@property (nonatomic, strong) OSSSyncMutableDictionary * sessionDelagateManager;
-@property (nonatomic, strong) OSSNetworkingConfiguration * configuration;
-@property (nonatomic, strong) OSSExecutor * taskExecutor;
-
-- (instancetype)initWithConfiguration:(OSSNetworkingConfiguration *)configuration;
-- (OSSTask *)sendRequest:(OSSNetworkingRequestDelegate *)request;
-@end

+ 0 - 526
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSNetworking.m

@@ -1,526 +0,0 @@
-//
-//  OSSNetworking.m
-//  oss_ios_sdk
-//
-//  Created by zhouzhuo on 8/16/15.
-//  Copyright (c) 2015 aliyun.com. All rights reserved.
-//
-
-#import "OSSDefine.h"
-#import "OSSNetworking.h"
-#import "OSSBolts.h"
-#import "OSSModel.h"
-#import "OSSUtil.h"
-#import "OSSLog.h"
-#import "OSSXMLDictionary.h"
-#import "OSSInputStreamHelper.h"
-#import "OSSNetworkingRequestDelegate.h"
-#import "OSSURLRequestRetryHandler.h"
-#import "OSSHttpResponseParser.h"
-
-@implementation OSSNetworkingConfiguration
-@end
-
-
-@implementation OSSNetworking
-
-- (instancetype)initWithConfiguration:(OSSNetworkingConfiguration *)configuration {
-    if (self = [super init]) {
-        self.configuration = configuration;
-        NSURLSessionConfiguration * conf = nil;
-        NSOperationQueue *delegateQueue = [NSOperationQueue new];
-
-        if (configuration.enableBackgroundTransmitService) {
-            conf = [NSURLSessionConfiguration backgroundSessionConfigurationWithIdentifier:self.configuration.backgroundSessionIdentifier];
-        } else {
-            conf = [NSURLSessionConfiguration defaultSessionConfiguration];
-        }
-        conf.URLCache = nil;
-
-        if (configuration.timeoutIntervalForRequest > 0) {
-            conf.timeoutIntervalForRequest = configuration.timeoutIntervalForRequest;
-        }
-        if (configuration.timeoutIntervalForResource > 0) {
-            conf.timeoutIntervalForResource = configuration.timeoutIntervalForResource;
-        }
-        
-        if (configuration.proxyHost && configuration.proxyPort) {
-            // Create an NSURLSessionConfiguration that uses the proxy
-            NSDictionary *proxyDict = @{
-                                        @"HTTPEnable"  : [NSNumber numberWithInt:1],
-                                        (NSString *)kCFStreamPropertyHTTPProxyHost  : configuration.proxyHost,
-                                        (NSString *)kCFStreamPropertyHTTPProxyPort  : configuration.proxyPort,
-
-                                        @"HTTPSEnable" : [NSNumber numberWithInt:1],
-                                        (NSString *)kCFStreamPropertyHTTPSProxyHost : configuration.proxyHost,
-                                        (NSString *)kCFStreamPropertyHTTPSProxyPort : configuration.proxyPort,
-                                        };
-            conf.connectionProxyDictionary = proxyDict;
-        }
-
-        _session = [NSURLSession sessionWithConfiguration:conf
-                                                 delegate:self
-                                            delegateQueue:delegateQueue];
-
-        self.isUsingBackgroundSession = configuration.enableBackgroundTransmitService;
-        _sessionDelagateManager = [OSSSyncMutableDictionary new];
-
-        NSOperationQueue * operationQueue = [NSOperationQueue new];
-        if (configuration.maxConcurrentRequestCount > 0) {
-            operationQueue.maxConcurrentOperationCount = configuration.maxConcurrentRequestCount;
-        }
-        self.taskExecutor = [OSSExecutor executorWithOperationQueue: operationQueue];
-    }
-    return self;
-}
-
-- (OSSTask *)sendRequest:(OSSNetworkingRequestDelegate *)request {
-    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{
-        OSSLogVerbose(@"NetWorkConnectedMsg : %@",[OSSUtil buildNetWorkConnectedMsg]);
-        NSString *operator = [OSSUtil buildOperatorMsg];
-        if(operator) OSSLogVerbose(@"Operator : %@",[OSSUtil buildOperatorMsg]);
-    });
-    OSSLogVerbose(@"send request --------");
-    if (self.configuration.proxyHost && self.configuration.proxyPort) {
-        request.isAccessViaProxy = YES;
-    }
-
-    /* set maximum retry */
-    request.retryHandler.maxRetryCount = self.configuration.maxRetryCount;
-
-    OSSTaskCompletionSource * taskCompletionSource = [OSSTaskCompletionSource taskCompletionSource];
-
-    __weak OSSNetworkingRequestDelegate *weakRequest= request;
-    request.completionHandler = ^(id responseObject, NSError * error) {
-        [weakRequest reset];
-        
-        // 1.判断是否出错,如果出错的话,直接设置错误信息
-        if (error)
-        {
-            [taskCompletionSource setError:error];
-        }else
-        {
-            [self checkForCrc64WithResult:responseObject
-                          requestDelegate:weakRequest
-                     taskCompletionSource:taskCompletionSource];
-        }
-    };
-    [self dataTaskWithDelegate:request];
-    return taskCompletionSource.task;
-}
-
-- (void)checkForCrc64WithResult:(nonnull id)response requestDelegate:(OSSNetworkingRequestDelegate *)delegate taskCompletionSource:(OSSTaskCompletionSource *)source
-{
-    OSSResult *result = (OSSResult *)response;
-    BOOL hasRange = [delegate.internalRequest valueForHTTPHeaderField:@"Range"] != nil;
-    NSURLComponents *urlComponents = [NSURLComponents componentsWithURL:delegate.internalRequest.URL resolvingAgainstBaseURL:YES];
-    BOOL hasXOSSProcess = [urlComponents.query containsString:@"x-oss-process"];
-    BOOL enableCRC = delegate.crc64Verifiable;
-    // 3.判断如果未开启crc校验,或者headerFields里面有Range字段或者参数表中存在
-    //   x-oss-process字段,都将不进行crc校验
-    if (!enableCRC || hasRange || hasXOSSProcess)
-    {
-        [source setResult:response];
-    }
-    else
-    {
-        OSSLogVerbose(@"--- checkForCrc64WithResult --- ");
-        // 如果服务端未返回crc信息,默认是成功的
-        OSSLogVerbose(@"result.remoteCRC64ecma : %@",result.remoteCRC64ecma);
-        OSSLogVerbose(@"if result.localCRC64ecma : %@",result.localCRC64ecma);
-        if (!result.remoteCRC64ecma.oss_isNotEmpty)
-        {
-            [source setResult:response];
-            return;
-        }
-        // getObject 操作的crc数值会在delegate.responseParser consumeHttpResponseBody 进行计算。
-        // upload & put 操作在上传成功后再计算。
-        // 如果用户设置onReceiveData block。无法计算localCRC64ecma
-        if (!result.localCRC64ecma.oss_isNotEmpty)
-        {
-            OSSLogVerbose(@"delegate.uploadingFileURL : %@",delegate.uploadingFileURL);
-            if (delegate.uploadingFileURL)
-            {
-                OSSInputStreamHelper *helper = [[OSSInputStreamHelper alloc] initWithURL:delegate.uploadingFileURL];
-                [helper syncReadBuffers];
-                if (helper.crc64 != 0) {
-                    result.localCRC64ecma = [NSString stringWithFormat:@"%llu",helper.crc64];
-                }
-            }
-            else
-            {
-                result.localCRC64ecma = delegate.contentCRC;
-            }
-            OSSLogVerbose(@"finally result.localCRC64ecma : %@",result.localCRC64ecma);
-        }
-
-        
-        // 针对append接口,需要多次计算crc值
-        if ([delegate.lastCRC oss_isNotEmpty] && [result.localCRC64ecma oss_isNotEmpty])
-        {
-            uint64_t last_crc64,local_crc64;
-            NSScanner *scanner = [NSScanner scannerWithString:delegate.lastCRC];
-            [scanner scanUnsignedLongLong:&last_crc64];
-            
-            scanner = [NSScanner scannerWithString:result.localCRC64ecma];
-            [scanner scanUnsignedLongLong:&local_crc64];
-            
-            NSURLComponents *urlComponents = [NSURLComponents componentsWithURL:delegate.internalRequest.URL resolvingAgainstBaseURL:YES];
-            NSArray<NSString *> *params = [urlComponents.query componentsSeparatedByString:@"&"];
-            
-            __block NSString *positionValue;
-            [params enumerateObjectsUsingBlock:^(NSString *obj, NSUInteger idx, BOOL * _Nonnull stop) {
-                if ([obj rangeOfString:@"position="].location == 0)
-                {
-                    *stop = YES;
-                    positionValue = [obj substringFromIndex:9];
-                }
-            }];
-            
-            uint64_t position = [positionValue longLongValue];
-            NSString *next_append_position = [result.httpResponseHeaderFields objectForKey:@"x-oss-next-append-position"];
-            uint64_t length = [next_append_position longLongValue] - position;
-            
-            uint64_t crc_local = [OSSUtil crc64ForCombineCRC1:last_crc64 CRC2:local_crc64 length:(size_t)length];
-            result.localCRC64ecma = [NSString stringWithFormat:@"%llu",crc_local];
-            OSSLogVerbose(@"crc_local: %llu, crc_remote: %@,last_position: %llu,nextAppendPosition: %llu,length:  %llu",crc_local,result.remoteCRC64ecma,position,[next_append_position longLongValue],length);
-        }
-        //如果服务器和本机计算的crc值不一致,则报crc校验失败;否则,认为上传任务执行成功
-        if (result.remoteCRC64ecma.oss_isNotEmpty && result.localCRC64ecma.oss_isNotEmpty)
-        {
-            if ([result.remoteCRC64ecma isEqualToString:result.localCRC64ecma])
-            {
-                [source setResult:response];
-            }else
-            {
-                NSString *errorMessage = [NSString stringWithFormat:@"crc validation fails(local_crc64ecma: %@,remote_crc64ecma: %@)",result.localCRC64ecma,result.remoteCRC64ecma];
-                
-                NSError *crcError = [NSError errorWithDomain:OSSClientErrorDomain
-                                                        code:OSSClientErrorCodeInvalidCRC
-                                                    userInfo:@{OSSErrorMessageTOKEN:errorMessage}];
-                [source setError:crcError];
-            }
-        }
-        else
-        {
-            [source setResult:response];
-        }
-    }
-}
-
-- (void)dataTaskWithDelegate:(OSSNetworkingRequestDelegate *)requestDelegate {
-
-    [[[[[OSSTask taskWithResult:nil] continueWithExecutor:self.taskExecutor withSuccessBlock:^id(OSSTask *task) {
-        OSSLogVerbose(@"start to intercept request");
-        for (id<OSSRequestInterceptor> interceptor in requestDelegate.interceptors) {
-            task = [interceptor interceptRequestMessage:requestDelegate.allNeededMessage];
-            if (task.error) {
-                return task;
-            }
-        }
-        return task;
-    }] continueWithSuccessBlock:^id(OSSTask *task) {
-        return [requestDelegate buildInternalHttpRequest];
-    }] continueWithSuccessBlock:^id(OSSTask *task) {
-        NSURLSessionDataTask * sessionTask = nil;
-        if (self.configuration.timeoutIntervalForRequest > 0) {
-            requestDelegate.internalRequest.timeoutInterval = self.configuration.timeoutIntervalForRequest;
-        }
-
-        if (requestDelegate.uploadingData) {
-            [requestDelegate.internalRequest setHTTPBody:requestDelegate.uploadingData];
-            sessionTask = [_session dataTaskWithRequest:requestDelegate.internalRequest];
-        } else if (requestDelegate.uploadingFileURL) {
-            sessionTask = [_session uploadTaskWithRequest:requestDelegate.internalRequest fromFile:requestDelegate.uploadingFileURL];
-
-                requestDelegate.isBackgroundUploadFileTask = self.isUsingBackgroundSession;
-        } else { // not upload request
-            sessionTask = [_session dataTaskWithRequest:requestDelegate.internalRequest];
-        }
-
-        requestDelegate.currentSessionTask = sessionTask;
-        requestDelegate.httpRequestNotSuccessResponseBody = [NSMutableData new];
-        [self.sessionDelagateManager setObject:requestDelegate forKey:@(sessionTask.taskIdentifier)];
-        if (requestDelegate.isRequestCancelled) {
-            return [OSSTask taskWithError:[NSError errorWithDomain:OSSClientErrorDomain
-                                                              code:OSSClientErrorCodeTaskCancelled
-                                                          userInfo:nil]];
-        }
-        [sessionTask resume];
-      
-        return task;
-    }] continueWithBlock:^id(OSSTask *task) {
-
-        // if error occurs before created sessionTask
-        if (task.error) {
-            requestDelegate.completionHandler(nil, task.error);
-        } else if (task.isFaulted) {
-            requestDelegate.completionHandler(nil, [NSError errorWithDomain:OSSClientErrorDomain
-                                                                       code:OSSClientErrorCodeExcpetionCatched
-                                                                   userInfo:@{OSSErrorMessageTOKEN: [NSString stringWithFormat:@"Catch exception - %@", task.exception]}]);
-        }
-        return nil;
-    }];
-}
-
-#pragma mark - NSURLSessionTaskDelegate Methods
-
-- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)sessionTask didCompleteWithError:(NSError *)error
-{
-    if (error) {
-        OSSLogError(@"%@,error: %@", NSStringFromSelector(_cmd), error);
-    }
-    
-    OSSNetworkingRequestDelegate * delegate = [self.sessionDelagateManager objectForKey:@(sessionTask.taskIdentifier)];
-    [self.sessionDelagateManager removeObjectForKey:@(sessionTask.taskIdentifier)];
-
-    NSHTTPURLResponse * httpResponse = (NSHTTPURLResponse *)sessionTask.response;
-    if (delegate == nil) {
-        OSSLogVerbose(@"delegate: %@", delegate);
-        /* if the background transfer service is enable, may recieve the previous task complete callback */
-        /* for now, we ignore it */
-        return ;
-    }
-
-    /* background upload task will not call back didRecieveResponse */
-    if (delegate.isBackgroundUploadFileTask) {
-        OSSLogVerbose(@"backgroud upload task did recieve response: %@", httpResponse);
-        if (httpResponse.statusCode >= 200 && httpResponse.statusCode < 300 && httpResponse.statusCode != 203) {
-            [delegate.responseParser consumeHttpResponse:httpResponse];
-        } else {
-            delegate.isHttpRequestNotSuccessResponse = YES;
-        }
-    }
-
-    [[[[OSSTask taskWithResult:nil] continueWithSuccessBlock:^id(OSSTask * task) {
-        if (!delegate.error) {
-            delegate.error = error;
-        }
-        if (delegate.error) {
-            OSSLogDebug(@"networking request completed with error: %@", error);
-            if ([delegate.error.domain isEqualToString:NSURLErrorDomain] && delegate.error.code == NSURLErrorCancelled) {
-                return [OSSTask taskWithError:[NSError errorWithDomain:OSSClientErrorDomain
-                                                                 code:OSSClientErrorCodeTaskCancelled
-                                                             userInfo:[error userInfo]]];
-            } else {
-                NSMutableDictionary * userInfo = [NSMutableDictionary dictionaryWithDictionary:[error userInfo]];
-                [userInfo setObject:[NSString stringWithFormat:@"%ld", (long)error.code] forKey:@"OriginErrorCode"];
-                return [OSSTask taskWithError:[NSError errorWithDomain:OSSClientErrorDomain
-                                                                 code:OSSClientErrorCodeNetworkError
-                                                             userInfo:userInfo]];
-            }
-        }
-        return task;
-    }] continueWithSuccessBlock:^id(OSSTask *task) {
-        if (delegate.isHttpRequestNotSuccessResponse) {
-            if (httpResponse.statusCode == 0) {
-                return [OSSTask taskWithError:[NSError errorWithDomain:OSSClientErrorDomain
-                                                                 code:OSSClientErrorCodeNetworkingFailWithResponseCode0
-                                                             userInfo:@{OSSErrorMessageTOKEN: @"Request failed, response code 0"}]];
-            }
-            NSString * notSuccessResponseBody = [[NSString alloc] initWithData:delegate.httpRequestNotSuccessResponseBody encoding:NSUTF8StringEncoding];
-            OSSLogError(@"http error response: %@", notSuccessResponseBody);
-            NSDictionary * dict = [NSDictionary oss_dictionaryWithXMLString:notSuccessResponseBody];
-
-            return [OSSTask taskWithError:[NSError errorWithDomain:OSSServerErrorDomain
-                                                             code:(-1 * httpResponse.statusCode)
-                                                         userInfo:dict]];
-        }
-        return task;
-    }] continueWithBlock:^id(OSSTask *task) {
-        if (task.error) {
-            
-            
-            OSSNetworkingRetryType retryType = [delegate.retryHandler shouldRetry:delegate.currentRetryCount
-                                                                  requestDelegate:delegate
-                                                                         response:httpResponse
-                                                                            error:task.error];
-            OSSLogVerbose(@"current retry count: %u, retry type: %d", delegate.currentRetryCount, (int)retryType);
-
-            switch (retryType) {
-
-                case OSSNetworkingRetryTypeShouldNotRetry: {
-                    delegate.completionHandler(nil, task.error);
-                    return nil;
-                }
-
-                case OSSNetworkingRetryTypeShouldCorrectClockSkewAndRetry: {
-                    /* correct clock skew */
-                    NSString * dateStr = [[httpResponse allHeaderFields] objectForKey:@"Date"];
-                    if ([dateStr length] > 0) {
-                        NSDate * serverTime = [NSDate oss_dateFromString:dateStr];
-                        NSDate * deviceTime = [NSDate date];
-                        NSTimeInterval skewTime = [deviceTime timeIntervalSinceDate:serverTime];
-                        [NSDate oss_setClockSkew:skewTime];
-                    } else if (!error) {
-                        // The response header does not have the 'Date' field.
-                        // This should not happen.
-                        OSSLogError(@"Date header does not exist, unable to fix the clock skew");
-                    }
-                    
-                    [delegate.interceptors insertObject:[OSSTimeSkewedFixingInterceptor new] atIndex:0];
-                    break;
-                }
-
-                default:
-                    break;
-            }
-
-            /* now, should retry */
-            NSTimeInterval suspendTime = [delegate.retryHandler timeIntervalForRetry:delegate.currentRetryCount retryType:retryType];
-            delegate.currentRetryCount++;
-            [NSThread sleepForTimeInterval:suspendTime];
-            
-            if(delegate.retryCallback){
-                delegate.retryCallback();
-            }
-            
-
-            /* retry recursively */
-            [delegate reset];
-            
-            [self dataTaskWithDelegate:delegate];
-        } else {
-            delegate.completionHandler([delegate.responseParser constructResultObject], nil);
-        }
-        return nil;
-    }];
-}
-
-- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didSendBodyData:(int64_t)bytesSent totalBytesSent:(int64_t)totalBytesSent totalBytesExpectedToSend:(int64_t)totalBytesExpectedToSend
-{
-    OSSNetworkingRequestDelegate * delegate = [self.sessionDelagateManager objectForKey:@(task.taskIdentifier)];
-    if (delegate.uploadProgress)
-    {
-        delegate.uploadProgress(bytesSent, totalBytesSent, totalBytesExpectedToSend);
-    }
-}
-
-- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential * __nullable credential))completionHandler
-{
-    if (!challenge) {
-        return;
-    }
-    
-    NSURLSessionAuthChallengeDisposition disposition = NSURLSessionAuthChallengePerformDefaultHandling;
-    NSURLCredential *credential = nil;
-    
-    /*
-     * Gets the host name
-     */
-    
-    NSString * host = [[task.currentRequest allHTTPHeaderFields] objectForKey:@"Host"];
-    if (!host) {
-        host = task.currentRequest.URL.host;
-    }
-    
-    if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) {
-        if ([self evaluateServerTrust:challenge.protectionSpace.serverTrust forDomain:host]) {
-            disposition = NSURLSessionAuthChallengeUseCredential;
-            credential = [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust];
-        }
-    } else {
-        disposition = NSURLSessionAuthChallengePerformDefaultHandling;
-    }
-    // Uses the default evaluation for other challenges.
-    completionHandler(disposition,credential);
-}
-
-- (void)URLSessionDidFinishEventsForBackgroundURLSession:(NSURLSession *)session
-{
-    
-}
-
-#pragma mark - NSURLSessionDataDelegate Methods
-
-- (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask didReceiveResponse:(NSURLResponse *)response completionHandler:(void (^)(NSURLSessionResponseDisposition))completionHandler
-{
-    /* background upload task will not call back didRecieveResponse */
-    OSSLogVerbose(@"%@,response: %@", NSStringFromSelector(_cmd), response);
-    
-    OSSNetworkingRequestDelegate * delegate = [self.sessionDelagateManager objectForKey:@(dataTask.taskIdentifier)];
-    NSHTTPURLResponse * httpResponse = (NSHTTPURLResponse *)response;
-    if (httpResponse.statusCode >= 200 && httpResponse.statusCode < 300 && httpResponse.statusCode != 203) {
-        [delegate.responseParser consumeHttpResponse:httpResponse];
-    } else {
-        delegate.isHttpRequestNotSuccessResponse = YES;
-    }
-    completionHandler(NSURLSessionResponseAllow);
-}
-
-- (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask didReceiveData:(NSData *)data
-{
-    OSSNetworkingRequestDelegate * delegate = [self.sessionDelagateManager objectForKey:@(dataTask.taskIdentifier)];
-
-    /* background upload task will not call back didRecieveResponse.
-       so if we recieve response data after background uploading file,
-       we consider it as error response message since a successful uploading request will not response any data */
-    if (delegate.isBackgroundUploadFileTask)
-    {
-        //判断当前的statuscode是否成功
-        NSHTTPURLResponse * httpResponse = (NSHTTPURLResponse *)dataTask.response;
-        if (httpResponse.statusCode >= 200 && httpResponse.statusCode < 300 && httpResponse.statusCode != 203) {
-            [delegate.responseParser consumeHttpResponse:httpResponse];
-            delegate.isHttpRequestNotSuccessResponse = NO;
-        }else
-        {
-            delegate.isHttpRequestNotSuccessResponse = YES;
-        }
-    }
-    
-    if (delegate.isHttpRequestNotSuccessResponse) {
-        [delegate.httpRequestNotSuccessResponseBody appendData:data];
-    }
-    else {
-        if (delegate.onRecieveData) {
-            delegate.onRecieveData(data);
-        } else {
-            OSSTask * consumeTask = [delegate.responseParser consumeHttpResponseBody:data];
-            if (consumeTask.error) {
-                OSSLogError(@"consume data error: %@", consumeTask.error);
-                delegate.error = consumeTask.error;
-                [dataTask cancel];
-            }
-        }
-    }
-
-    if (!delegate.isHttpRequestNotSuccessResponse && delegate.downloadProgress) {
-        int64_t bytesWritten = [data length];
-        delegate.payloadTotalBytesWritten += bytesWritten;
-        int64_t totalBytesExpectedToWrite = dataTask.response.expectedContentLength;
-        delegate.downloadProgress(bytesWritten, delegate.payloadTotalBytesWritten, totalBytesExpectedToWrite);
-    }
-}
-
-#pragma mark - Private Methods
-
-- (BOOL)evaluateServerTrust:(SecTrustRef)serverTrust forDomain:(NSString *)domain {
-    /*
-     * Creates the policies for certificate verification.
-     */
-    NSMutableArray *policies = [NSMutableArray array];
-    if (domain) {
-        [policies addObject:(__bridge_transfer id)SecPolicyCreateSSL(true, (__bridge CFStringRef)domain)];
-    } else {
-        [policies addObject:(__bridge_transfer id)SecPolicyCreateBasicX509()];
-    }
-    
-    /*
-     * Sets the policies to server's certificate
-     */
-    SecTrustSetPolicies(serverTrust, (__bridge CFArrayRef)policies);
-    
-    
-    /*
-     * Evaulates if the current serverTrust is trustable.
-     * It's officially suggested that the serverTrust could be passed when result = kSecTrustResultUnspecified or kSecTrustResultProceed.
-     * For more information checks out https://developer.apple.com/library/ios/technotes/tn2232/_index.html
-     * For detail information about SecTrustResultType, checks out SecTrust.h
-     */
-    SecTrustResultType result;
-    SecTrustEvaluate(serverTrust, &result);
-    
-    return (result == kSecTrustResultUnspecified || result == kSecTrustResultProceed);
-}
-
-@end

+ 0 - 76
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSNetworkingRequestDelegate.h

@@ -1,76 +0,0 @@
-//
-//  OSSNetworkingRequestDelegate.h
-//  AliyunOSSSDK
-//
-//  Created by huaixu on 2018/1/22.
-//  Copyright © 2018年 aliyun. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-#import "OSSConstants.h"
-#import "OSSTask.h"
-
-@class OSSAllRequestNeededMessage;
-@class OSSURLRequestRetryHandler;
-@class OSSHttpResponseParser;
-
-/**
- The proxy object class for each OSS request.
- */
-@interface OSSNetworkingRequestDelegate : NSObject
-
-@property (nonatomic, strong) NSMutableArray * interceptors;
-
-@property (nonatomic, strong) NSMutableURLRequest *internalRequest;
-@property (nonatomic, assign) OSSOperationType operType;
-@property (nonatomic, assign) BOOL isAccessViaProxy;
-
-@property (nonatomic, assign) BOOL isRequestCancelled;
-
-@property (nonatomic, strong) OSSAllRequestNeededMessage *allNeededMessage;
-@property (nonatomic, strong) OSSURLRequestRetryHandler *retryHandler;
-@property (nonatomic, strong) OSSHttpResponseParser *responseParser;
-
-@property (nonatomic, strong) NSData * uploadingData;
-@property (nonatomic, strong) NSURL * uploadingFileURL;
-
-@property (nonatomic, assign) int64_t payloadTotalBytesWritten;
-
-@property (nonatomic, assign) BOOL isBackgroundUploadFileTask;
-@property (nonatomic, assign) BOOL isHttpdnsEnable;
-
-
-@property (nonatomic, assign) uint32_t currentRetryCount;
-@property (nonatomic, strong) NSError * error;
-@property (nonatomic, assign) BOOL isHttpRequestNotSuccessResponse;
-@property (nonatomic, strong) NSMutableData *httpRequestNotSuccessResponseBody;
-
-@property (atomic, strong) NSURLSessionDataTask *currentSessionTask;
-
-@property (nonatomic, copy) OSSNetworkingUploadProgressBlock uploadProgress;
-@property (nonatomic, copy) OSSNetworkingDownloadProgressBlock downloadProgress;
-@property (nonatomic, copy) OSSNetworkingRetryBlock retryCallback;
-@property (nonatomic, copy) OSSNetworkingCompletionHandlerBlock completionHandler;
-@property (nonatomic, copy) OSSNetworkingOnRecieveDataBlock onRecieveData;
-
-/**
- * when put object to server,client caculate crc64 code and assigns it to
- * this property.
- */
-@property (nonatomic, copy) NSString *contentCRC;
-
-/** last crc64 code */
-@property (nonatomic, copy) NSString *lastCRC;
-
-/**
- * determine whether to verify crc64 code
- */
-@property (nonatomic, assign) BOOL crc64Verifiable;
-
-
-
-- (OSSTask *)buildInternalHttpRequest;
-- (void)reset;
-- (void)cancel;
-
-@end

+ 0 - 169
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSNetworkingRequestDelegate.m

@@ -1,169 +0,0 @@
-//
-//  OSSNetworkingRequestDelegate.m
-//  AliyunOSSSDK
-//
-//  Created by huaixu on 2018/1/22.
-//  Copyright © 2018年 aliyun. All rights reserved.
-//
-
-#import "OSSNetworkingRequestDelegate.h"
-
-#import "OSSAllRequestNeededMessage.h"
-#import "OSSURLRequestRetryHandler.h"
-#import "OSSHttpResponseParser.h"
-#import "OSSDefine.h"
-#import "OSSUtil.h"
-#import "OSSLog.h"
-#import "OSSIPv6Adapter.h"
-
-@implementation OSSNetworkingRequestDelegate
-
-- (instancetype)init {
-    if (self = [super init]) {
-        self.retryHandler = [OSSURLRequestRetryHandler defaultRetryHandler];
-        self.interceptors = [[NSMutableArray alloc] init];
-        self.isHttpdnsEnable = YES;
-    }
-    return self;
-}
-
-- (void)reset {
-    self.isHttpRequestNotSuccessResponse = NO;
-    self.error = nil;
-    self.payloadTotalBytesWritten = 0;
-    self.isRequestCancelled = NO;
-    [self.responseParser reset];
-}
-
-- (void)cancel {
-    self.isRequestCancelled = YES;
-    if (self.currentSessionTask) {
-        OSSLogDebug(@"this task is cancelled now!");
-        [self.currentSessionTask cancel];
-    }
-}
-
-- (OSSTask *)validateRequestParams {
-    NSString * errorMessage = nil;
-    
-    if ((self.operType == OSSOperationTypeAppendObject || self.operType == OSSOperationTypePutObject || self.operType == OSSOperationTypeUploadPart)
-        && !self.uploadingData && !self.uploadingFileURL) {
-        errorMessage = @"This operation need data or file to upload but none is set";
-    }
-    
-    if (self.uploadingFileURL && ![[NSFileManager defaultManager] fileExistsAtPath:[self.uploadingFileURL path]]) {
-        errorMessage = @"File doesn't exist";
-    }
-    
-    if (errorMessage) {
-        return [OSSTask taskWithError:[NSError errorWithDomain:OSSClientErrorDomain
-                                                          code:OSSClientErrorCodeInvalidArgument
-                                                      userInfo:@{OSSErrorMessageTOKEN: errorMessage}]];
-    } else {
-        return [self.allNeededMessage validateRequestParamsInOperationType:self.operType];
-    }
-}
-
-- (OSSTask *)buildInternalHttpRequest {
-    
-    OSSTask * validateParam = [self validateRequestParams];
-    if (validateParam.error) {
-        return validateParam;
-    }
-    
-#define URLENCODE(a) [OSSUtil encodeURL:(a)]
-    OSSLogDebug(@"start to build request")
-    // build base url string
-    NSString *urlString = self.allNeededMessage.endpoint;
-    NSURLComponents *urlComponents = [[NSURLComponents alloc] initWithString:urlString];
-    NSString *headerHost = nil;
-    
-    NSURLComponents *temComs = [NSURLComponents new];
-    temComs.scheme = urlComponents.scheme;
-    temComs.host = urlComponents.host;
-    temComs.port = urlComponents.port;
-    
-    if ([self.allNeededMessage.bucketName oss_isNotEmpty]) {
-           OSSIPv6Adapter *ipAdapter = [OSSIPv6Adapter getInstance];
-           if ([OSSUtil isOssOriginBucketHost:temComs.host]) {
-               // eg. insert bucket to the begining of host.
-               temComs.host = [NSString stringWithFormat:@"%@.%@", self.allNeededMessage.bucketName, temComs.host];
-               headerHost = temComs.host;
-               if ([temComs.scheme.lowercaseString isEqualToString:@"http"] && self.isHttpdnsEnable) {
-                   NSString *dnsResult = [OSSUtil getIpByHost: temComs.host];
-                   temComs.host = dnsResult;
-               }
-           } else if ([ipAdapter isIPv4Address:temComs.host] || [ipAdapter isIPv6Address:temComs.host]) {
-               temComs.path = [NSString stringWithFormat:@"/%@",self.allNeededMessage.bucketName];
-           }
-       }
-       
-       urlString = temComs.string;
-    
-    // join object name
-    if ([self.allNeededMessage.objectKey oss_isNotEmpty]) {
-        urlString = [urlString oss_stringByAppendingPathComponentForURL:URLENCODE(self.allNeededMessage.objectKey)];
-    }
-    
-    // join query string
-    if (self.allNeededMessage.params) {
-        NSMutableArray * querys = [[NSMutableArray alloc] init];
-        for (NSString * key in [self.allNeededMessage.params allKeys]) {
-            NSString * value = [self.allNeededMessage.params objectForKey:key];
-            if (value) {
-                if ([value isEqualToString:@""]) {
-                    [querys addObject:URLENCODE(key)];
-                } else {
-                    [querys addObject:[NSString stringWithFormat:@"%@=%@", URLENCODE(key), URLENCODE(value)]];
-                }
-            }
-        }
-        if (querys && [querys count]) {
-            NSString * queryString = [querys componentsJoinedByString:@"&"];
-            urlString = [NSString stringWithFormat:@"%@?%@", urlString, queryString];
-        }
-    }
-    OSSLogDebug(@"built full url: %@", urlString)
-    
-    // generate internal request For NSURLSession
-    self.internalRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:urlString]];
-    
-    // set http method of request
-    if (self.allNeededMessage.httpMethod) {
-        [self.internalRequest setHTTPMethod:self.allNeededMessage.httpMethod];
-    }
-    
-    // set host of header fields
-    if ([headerHost oss_isNotEmpty]) {
-        [self.internalRequest setValue:headerHost forHTTPHeaderField:@"Host"];
-    }
-    
-    if (self.allNeededMessage.contentType) {
-        [self.internalRequest setValue:self.allNeededMessage.contentType forHTTPHeaderField:@"Content-Type"];
-    }
-    if (self.allNeededMessage.contentMd5) {
-        [self.internalRequest setValue:self.allNeededMessage.contentMd5 forHTTPHeaderField:@"Content-MD5"];
-    }
-    if (self.allNeededMessage.date) {
-        [self.internalRequest setValue:self.allNeededMessage.date forHTTPHeaderField:@"Date"];
-    }
-    if (self.allNeededMessage.range) {
-        [self.internalRequest setValue:self.allNeededMessage.range forHTTPHeaderField:@"Range"];
-    }
-    if (self.allNeededMessage.contentSHA1) {
-        [self.internalRequest setValue:_allNeededMessage.contentSHA1 forHTTPHeaderField:@"x-oss-hash-sha1"];
-    }
-    if (self.allNeededMessage.headerParams) {
-        for (NSString * key in [self.allNeededMessage.headerParams allKeys]) {
-            [self.internalRequest setValue:[self.allNeededMessage.headerParams objectForKey:key] forHTTPHeaderField:key];
-        }
-    }
-    
-    
-    OSSLogVerbose(@"buidlInternalHttpRequest -\nmethod: %@\nurl: %@\nheader: %@", self.internalRequest.HTTPMethod,
-                  self.internalRequest.URL, self.internalRequest.allHTTPHeaderFields)
-    
-#undef URLENCODE//(a)
-    return [OSSTask taskWithResult:nil];
-}
-@end

+ 0 - 25
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSPutSymlinkRequest.h

@@ -1,25 +0,0 @@
-//
-//  OSSPutSymlinkRequest.h
-//  AliyunOSSSDK
-//
-//  Created by huaixu on 2018/8/1.
-//  Copyright © 2018年 aliyun. All rights reserved.
-//
-
-#import "OSSRequest.h"
-
-@interface OSSPutSymlinkRequest : OSSRequest
-
-/* bucket name */
-@property (nonatomic, copy) NSString *bucketName;
-
-/* object name */
-@property (nonatomic, copy) NSString *objectKey;
-
-/* target object name */
-@property (nonatomic, copy) NSString *targetObjectName;
-
-/* meta info in request header fields */
-@property (nonatomic, copy) NSDictionary *objectMeta;
-
-@end

+ 0 - 17
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSPutSymlinkRequest.m

@@ -1,17 +0,0 @@
-//
-//  OSSPutSymlinkRequest.m
-//  AliyunOSSSDK
-//
-//  Created by huaixu on 2018/8/1.
-//  Copyright © 2018年 aliyun. All rights reserved.
-//
-
-#import "OSSPutSymlinkRequest.h"
-
-@implementation OSSPutSymlinkRequest
-
-- (NSDictionary *)requestParams {
-    return @{@"symlink": @""};
-}
-
-@end

+ 0 - 13
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSPutSymlinkResult.h

@@ -1,13 +0,0 @@
-//
-//  OSSPutSymlinkResult.h
-//  AliyunOSSSDK
-//
-//  Created by huaixu on 2018/8/1.
-//  Copyright © 2018年 aliyun. All rights reserved.
-//
-
-#import "OSSResult.h"
-
-@interface OSSPutSymlinkResult : OSSResult
-
-@end

+ 0 - 13
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSPutSymlinkResult.m

@@ -1,13 +0,0 @@
-//
-//  OSSPutSymlinkResult.m
-//  AliyunOSSSDK
-//
-//  Created by huaixu on 2018/8/1.
-//  Copyright © 2018年 aliyun. All rights reserved.
-//
-
-#import "OSSPutSymlinkResult.h"
-
-@implementation OSSPutSymlinkResult
-
-@end

+ 0 - 41
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSRequest.h

@@ -1,41 +0,0 @@
-//
-//  OSSRequest.h
-//  AliyunOSSSDK
-//
-//  Created by huaixu on 2018/1/22.
-//  Copyright © 2018年 aliyun. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-#import "OSSConstants.h"
-
-/**
- The base class of request to OSS.
- */
-@interface OSSRequest : NSObject
-/**
- Flag of requiring authentication. It's per each request.
- */
-@property (nonatomic, assign) BOOL isAuthenticationRequired;
-
-/**
- the flag of request canceled.
- */
-@property (atomic, assign) BOOL isCancelled;
-
-/**
- the flag of verification about crc64
- */
-@property (nonatomic, assign) OSSRequestCRCFlag crcFlag;
-
-/**
- Cancels the request
- */
-- (void)cancel;
-
-/**
- Gets the query parameters' dictionary according to the properties.
- */
-- (NSDictionary *)requestParams;
-
-@end

+ 0 - 41
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSRequest.m

@@ -1,41 +0,0 @@
-//
-//  OSSRequest.m
-//  AliyunOSSSDK
-//
-//  Created by huaixu on 2018/1/22.
-//  Copyright © 2018年 aliyun. All rights reserved.
-//
-
-#import "OSSRequest.h"
-#import "OSSNetworkingRequestDelegate.h"
-
-@interface OSSRequest ()
-
-@property (nonatomic, strong) OSSNetworkingRequestDelegate *requestDelegate;
-
-@end
-
-
-@implementation OSSRequest
-
-- (instancetype)init {
-    if (self = [super init]) {
-        self.requestDelegate = [OSSNetworkingRequestDelegate new];
-        self.isAuthenticationRequired = YES;
-    }
-    return self;
-}
-
-- (void)cancel {
-    self.isCancelled = YES;
-    
-    if (self.requestDelegate) {
-        [self.requestDelegate cancel];
-    }
-}
-
-- (NSDictionary *)requestParams {
-    return nil;
-}
-
-@end

+ 0 - 17
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSRestoreObjectRequest.h

@@ -1,17 +0,0 @@
-//
-//  OSSRestoreObjectRequest.h
-//  AliyunOSSSDK
-//
-//  Created by huaixu on 2018/8/1.
-//  Copyright © 2018年 aliyun. All rights reserved.
-//
-
-#import "OSSRequest.h"
-
-@interface OSSRestoreObjectRequest : OSSRequest
-
-@property (nonatomic, copy) NSString *bucketName;
-
-@property (nonatomic, copy) NSString *objectKey;
-
-@end

+ 0 - 17
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSRestoreObjectRequest.m

@@ -1,17 +0,0 @@
-//
-//  OSSRestoreObjectRequest.m
-//  AliyunOSSSDK
-//
-//  Created by huaixu on 2018/8/1.
-//  Copyright © 2018年 aliyun. All rights reserved.
-//
-
-#import "OSSRestoreObjectRequest.h"
-
-@implementation OSSRestoreObjectRequest
-
-- (NSDictionary *)requestParams {
-    return @{@"restore": @""};
-}
-
-@end

+ 0 - 13
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSRestoreObjectResult.h

@@ -1,13 +0,0 @@
-//
-//  OSSRestoreObjectResult.h
-//  AliyunOSSSDK
-//
-//  Created by huaixu on 2018/8/1.
-//  Copyright © 2018年 aliyun. All rights reserved.
-//
-
-#import "OSSResult.h"
-
-@interface OSSRestoreObjectResult : OSSResult
-
-@end

+ 0 - 13
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSRestoreObjectResult.m

@@ -1,13 +0,0 @@
-//
-//  OSSRestoreObjectResult.m
-//  AliyunOSSSDK
-//
-//  Created by huaixu on 2018/8/1.
-//  Copyright © 2018年 aliyun. All rights reserved.
-//
-
-#import "OSSRestoreObjectResult.h"
-
-@implementation OSSRestoreObjectResult
-
-@end

+ 0 - 42
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSResult.h

@@ -1,42 +0,0 @@
-//
-//  OSSResult.h
-//  AliyunOSSSDK
-//
-//  Created by huaixu on 2018/1/26.
-//  Copyright © 2018年 aliyun. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-
-/**
- The base class of result from OSS.
- */
-@interface OSSResult : NSObject
-
-/**
- The http response code.
- */
-@property (nonatomic, assign) NSInteger httpResponseCode;
-
-/**
- The http headers, in the form of key value dictionary.
- */
-@property (nonatomic, strong) NSDictionary * httpResponseHeaderFields;
-
-/**
- The request Id. It's the value of header x-oss-request-id, which is created from OSS server.
- It's a unique Id represents this request. This is used for troubleshooting when you contact OSS support.
- */
-@property (nonatomic, strong) NSString * requestId;
-
-/**
- It's the value of header x-oss-hash-crc64ecma, which is created from OSS server.
- */
-@property (nonatomic, copy) NSString *remoteCRC64ecma;
-
-/**
- It's the value of local Data.
- */
-@property (nonatomic, copy) NSString *localCRC64ecma;
-
-@end

+ 0 - 18
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSResult.m

@@ -1,18 +0,0 @@
-//
-//  OSSResult.m
-//  AliyunOSSSDK
-//
-//  Created by huaixu on 2018/1/26.
-//  Copyright © 2018年 aliyun. All rights reserved.
-//
-
-#import "OSSResult.h"
-
-@implementation OSSResult
-
-- (NSString *)description
-{
-    return [NSString stringWithFormat:@"OSSResult<%p> : {httpResponseCode: %ld, requestId: %@, httpResponseHeaderFields: %@, local_crc64ecma: %@}",self,(long)self.httpResponseCode,self.requestId,self.httpResponseHeaderFields,self.localCRC64ecma];
-}
-
-@end

+ 0 - 40
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSService.h

@@ -1,40 +0,0 @@
-//
-//  OSSService.h
-//  oss_ios_sdk
-//
-//  Created by zhouzhuo on 8/20/15.
-//  Copyright (c) 2015 aliyun.com. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-
-#define OSS_IOS_SDK_VERSION OSSSDKVersion
-
-#import "OSSDefine.h"
-#import "OSSConstants.h"
-
-#import "OSSNetworking.h"
-#import "OSSNetworkingRequestDelegate.h"
-#import "OSSAllRequestNeededMessage.h"
-#import "OSSURLRequestRetryHandler.h"
-#import "OSSHttpResponseParser.h"
-#import "OSSRequest.h"
-#import "OSSGetObjectACLRequest.h"
-#import "OSSGetObjectACLResult.h"
-#import "OSSDeleteMultipleObjectsRequest.h"
-#import "OSSDeleteMultipleObjectsResult.h"
-#import "OSSGetBucketInfoRequest.h"
-#import "OSSGetBucketInfoResult.h"
-#import "OSSPutSymlinkRequest.h"
-#import "OSSPutSymlinkResult.h"
-#import "OSSGetSymlinkRequest.h"
-#import "OSSGetSymlinkResult.h"
-#import "OSSRestoreObjectRequest.h"
-#import "OSSRestoreObjectResult.h"
-
-#import "OSSClient.h"
-#import "OSSModel.h"
-#import "OSSUtil.h"
-#import "OSSLog.h"
-
-#import "OSSBolts.h"

+ 0 - 26
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSTask/OSSBolts.h

@@ -1,26 +0,0 @@
-/*
- *  Copyright (c) 2014, Facebook, Inc.
- *  All rights reserved.
- *
- *  This source code is licensed under the BSD-style license found in the
- *  LICENSE file in the root directory of this source tree. An additional grant
- *  of patent rights can be found in the PATENTS file in the same directory.
- *
- */
-
-#import "OSSCancellationToken.h"
-#import "OSSCancellationTokenRegistration.h"
-#import "OSSCancellationTokenSource.h"
-#import "OSSExecutor.h"
-#import "OSSTask.h"
-#import "OSSTaskCompletionSource.h"
-
-
-NS_ASSUME_NONNULL_BEGIN
-
-/**
- A string containing the version of the Bolts Framework used by the current application.
- */
-extern NSString *const OSSBoltsFrameworkVersionString;
-
-NS_ASSUME_NONNULL_END

+ 0 - 17
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSTask/OSSBolts.m

@@ -1,17 +0,0 @@
-/*
- *  Copyright (c) 2014, Facebook, Inc.
- *  All rights reserved.
- *
- *  This source code is licensed under the BSD-style license found in the
- *  LICENSE file in the root directory of this source tree. An additional grant
- *  of patent rights can be found in the PATENTS file in the same directory.
- *
- */
-
-#import "OSSBolts.h"
-
-NS_ASSUME_NONNULL_BEGIN
-
-NSString *const OSSBoltsFrameworkVersionString = @"1.7.0";
-
-NS_ASSUME_NONNULL_END

+ 0 - 42
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSTask/OSSCancellationToken.h

@@ -1,42 +0,0 @@
-/*
- *  Copyright (c) 2014, Facebook, Inc.
- *  All rights reserved.
- *
- *  This source code is licensed under the BSD-style license found in the
- *  LICENSE file in the root directory of this source tree. An additional grant
- *  of patent rights can be found in the PATENTS file in the same directory.
- *
- */
-
-#import <Foundation/Foundation.h>
-
-#import "OSSCancellationTokenRegistration.h"
-
-NS_ASSUME_NONNULL_BEGIN
-
-/*!
- A block that will be called when a token is cancelled.
- */
-typedef void(^OSSCancellationBlock)(void);
-
-/*!
- The consumer view of a CancellationToken.
- Propagates notification that operations should be canceled.
- A OSSCancellationToken has methods to inspect whether the token has been cancelled.
- */
-@interface OSSCancellationToken : NSObject
-
-/*!
- Whether cancellation has been requested for this token source.
- */
-@property (nonatomic, assign, readonly, getter=isCancellationRequested) BOOL cancellationRequested;
-
-/*!
- Register a block to be notified when the token is cancelled.
- If the token is already cancelled the delegate will be notified immediately.
- */
-- (OSSCancellationTokenRegistration *)registerCancellationObserverWithBlock:(OSSCancellationBlock)block;
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 144
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSTask/OSSCancellationToken.m

@@ -1,144 +0,0 @@
-/*
- *  Copyright (c) 2014, Facebook, Inc.
- *  All rights reserved.
- *
- *  This source code is licensed under the BSD-style license found in the
- *  LICENSE file in the root directory of this source tree. An additional grant
- *  of patent rights can be found in the PATENTS file in the same directory.
- *
- */
-
-#import "OSSCancellationToken.h"
-#import "OSSCancellationTokenRegistration.h"
-
-NS_ASSUME_NONNULL_BEGIN
-
-@interface OSSCancellationToken ()
-
-@property (nullable, nonatomic, strong) NSMutableArray *registrations;
-@property (nonatomic, strong) NSObject *lock;
-@property (nonatomic) BOOL disposed;
-
-@end
-
-@interface OSSCancellationTokenRegistration (OSSCancellationToken)
-
-+ (instancetype)registrationWithToken:(OSSCancellationToken *)token delegate:(OSSCancellationBlock)delegate;
-
-- (void)notifyDelegate;
-
-@end
-
-@implementation OSSCancellationToken
-
-@synthesize cancellationRequested = _cancellationRequested;
-
-#pragma mark - Initializer
-
-- (instancetype)init {
-    self = [super init];
-    if (!self) return self;
-
-    _registrations = [NSMutableArray array];
-    _lock = [NSObject new];
-
-    return self;
-}
-
-#pragma mark - Custom Setters/Getters
-
-- (BOOL)isCancellationRequested {
-    @synchronized(self.lock) {
-        [self throwIfDisposed];
-        return _cancellationRequested;
-    }
-}
-
-- (void)cancel {
-    NSArray *registrations;
-    @synchronized(self.lock) {
-        [self throwIfDisposed];
-        if (_cancellationRequested) {
-            return;
-        }
-        [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(cancelPrivate) object:nil];
-        _cancellationRequested = YES;
-        registrations = [self.registrations copy];
-    }
-
-    [self notifyCancellation:registrations];
-}
-
-- (void)notifyCancellation:(NSArray *)registrations {
-    for (OSSCancellationTokenRegistration *registration in registrations) {
-        [registration notifyDelegate];
-    }
-}
-
-- (OSSCancellationTokenRegistration *)registerCancellationObserverWithBlock:(OSSCancellationBlock)block {
-    @synchronized(self.lock) {
-        OSSCancellationTokenRegistration *registration = [OSSCancellationTokenRegistration registrationWithToken:self delegate:[block copy]];
-        [self.registrations addObject:registration];
-
-        return registration;
-    }
-}
-
-- (void)unregisterRegistration:(OSSCancellationTokenRegistration *)registration {
-    @synchronized(self.lock) {
-        [self throwIfDisposed];
-        [self.registrations removeObject:registration];
-    }
-}
-
-// Delay on a non-public method to prevent interference with a user calling performSelector or
-// cancelPreviousPerformRequestsWithTarget on the public method
-- (void)cancelPrivate {
-    [self cancel];
-}
-
-- (void)cancelAfterDelay:(int)millis {
-    [self throwIfDisposed];
-    if (millis < -1) {
-        [NSException raise:NSInvalidArgumentException format:@"Delay must be >= -1"];
-    }
-
-    if (millis == 0) {
-        [self cancel];
-        return;
-    }
-
-    @synchronized(self.lock) {
-        [self throwIfDisposed];
-        [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(cancelPrivate) object:nil];
-        if (self.cancellationRequested) {
-            return;
-        }
-
-        if (millis != -1) {
-            double delay = (double)millis / 1000;
-            [self performSelector:@selector(cancelPrivate) withObject:nil afterDelay:delay];
-        }
-    }
-}
-
-- (void)dispose {
-    @synchronized(self.lock) {
-        if (self.disposed) {
-            return;
-        }
-        [self.registrations makeObjectsPerformSelector:@selector(dispose)];
-        self.registrations = nil;
-        self.disposed = YES;
-    }
-}
-
-- (void)throwIfDisposed {
-    if (self.disposed) {
-        [NSException raise:NSInternalInconsistencyException format:@"Object already disposed"];
-    }
-}
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 29
Example/Pods/AliyunOSSiOS/AliyunOSSSDK/OSSTask/OSSCancellationTokenRegistration.h

@@ -1,29 +0,0 @@
-/*
- *  Copyright (c) 2014, Facebook, Inc.
- *  All rights reserved.
- *
- *  This source code is licensed under the BSD-style license found in the
- *  LICENSE file in the root directory of this source tree. An additional grant
- *  of patent rights can be found in the PATENTS file in the same directory.
- *
- */
-
-#import <Foundation/Foundation.h>
-
-NS_ASSUME_NONNULL_BEGIN
-
-/*!
- Represents the registration of a cancellation observer with a cancellation token.
- Can be used to unregister the observer at a later time.
- */
-@interface OSSCancellationTokenRegistration : NSObject
-
-/*!
- Removes the cancellation observer registered with the token
- and releases all resources associated with this registration.
- */
-- (void)dispose;
-
-@end
-
-NS_ASSUME_NONNULL_END

部分文件因为文件数量过多而无法显示