Commit 7958c42594e2392a8f449ecf94ee09cec0f58541

Authored by yinqiaojuan
1 parent 3719cbae

Revert "提交"

This reverts commit 60feb4c9.
Showing 34 changed files with 0 additions and 4847 deletions

Too many changes to show.

To preserve performance only 34 of 107 files are displayed.

.gitignore deleted 100644 → 0
1   -*~
2   -.DS_Store
3   -*.xcuserstate
4   -*.xcworkspace
5   -xcuserdata
6   -*.lock
7   -Pods
CNPublishContent/CNPublishContent.podspec deleted 100644 → 0
1   -#
2   -# Be sure to run `pod lib lint CNPublishContent.podspec' to ensure this is a
3   -# valid spec before submitting.
4   -#
5   -# Any lines starting with a # are optional, but their use is encouraged
6   -# To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html
7   -#
8   -
9   -Pod::Spec.new do |s|
10   - s.name = 'CNPublishContent'
11   - s.version = '0.1.1'
12   - s.summary = '测试发布页面pod打包'
13   -
14   -# This description is used to generate tags and improve search results.
15   -# * Think: What does it do? Why did you write it? What is the focus?
16   -# * Try to keep it short, snappy and to the point.
17   -# * Write the description between the DESC delimiters below.
18   -# * Finally, don't worry about the indent, CocoaPods strips it!
19   -
20   - s.description = <<-DESC
21   -TODO: Add long description of the pod here.
22   - DESC
23   -
24   - s.homepage = 'http://bj.gitlab.cnlive.com/ios-team/CNLivePublishContents'
25   - # s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
26   - s.license = { :type => 'MIT', :file => 'LICENSE' }
27   - s.author = { '殷巧娟' => '1427945373@qq.com' }
28   - s.source = { :git => 'http://bj.gitlab.cnlive.com/ios-team/CNLivePublishContents.git', :tag => s.version.to_s }
29   - # s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'
30   -
31   - s.ios.deployment_target = '9.0'
32   -
33   - s.source_files = 'CNPublishContent/Classes/**/*'
34   -
35   - # s.resource_bundles = {
36   - # 'CNPublishContent' => ['CNPublishContent/Assets/*.png']
37   - # }
38   -
39   - # s.public_header_files = 'Pod/Classes/**/*.h'
40   - # s.frameworks = 'UIKit', 'MapKit'
41   - s.dependency 'AFNetworking'
42   -
43   -end
CNPublishContent/CNPublishContent/Assets/.gitkeep deleted 100644 → 0
CNPublishContent/CNPublishContent/Classes/YQJTest.h deleted 100644 → 0
1   -//
2   -// YQJTest.h
3   -// CNPublishContent
4   -//
5   -// Created by 殷巧娟 on 2018/12/4.
6   -//
7   -
8   -#import <Foundation/Foundation.h>
9   -
10   -NS_ASSUME_NONNULL_BEGIN
11   -
12   -@interface YQJTest : NSObject
13   -+(void)test;
14   -@end
15   -
16   -NS_ASSUME_NONNULL_END
CNPublishContent/CNPublishContent/Classes/YQJTest.m deleted 100644 → 0
1   -//
2   -// YQJTest.m
3   -// CNPublishContent
4   -//
5   -// Created by 殷巧娟 on 2018/12/4.
6   -//
7   -
8   -#import "YQJTest.h"
9   -
10   -@implementation YQJTest
11   -+ (void)test {
12   - NSLog(@"测试一下组件化成功没");
13   -}
14   -@end
CNPublishContent/Example/CNPublishContent.xcodeproj/project.pbxproj deleted 100644 → 0
1   -// !$*UTF8*$!
2   -{
3   - archiveVersion = 1;
4   - classes = {
5   - };
6   - objectVersion = 46;
7   - objects = {
8   -
9   -/* Begin PBXBuildFile section */
10   - 6003F58E195388D20070C39A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58D195388D20070C39A /* Foundation.framework */; };
11   - 6003F590195388D20070C39A /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58F195388D20070C39A /* CoreGraphics.framework */; };
12   - 6003F592195388D20070C39A /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F591195388D20070C39A /* UIKit.framework */; };
13   - 6003F598195388D20070C39A /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 6003F596195388D20070C39A /* InfoPlist.strings */; };
14   - 6003F59A195388D20070C39A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F599195388D20070C39A /* main.m */; };
15   - 6003F59E195388D20070C39A /* CNLiveAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F59D195388D20070C39A /* CNLiveAppDelegate.m */; };
16   - 6003F5A7195388D20070C39A /* CNLiveViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F5A6195388D20070C39A /* CNLiveViewController.m */; };
17   - 6003F5A9195388D20070C39A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6003F5A8195388D20070C39A /* Images.xcassets */; };
18   - 6003F5B0195388D20070C39A /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F5AF195388D20070C39A /* XCTest.framework */; };
19   - 6003F5B1195388D20070C39A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58D195388D20070C39A /* Foundation.framework */; };
20   - 6003F5B2195388D20070C39A /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F591195388D20070C39A /* UIKit.framework */; };
21   - 6003F5BA195388D20070C39A /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 6003F5B8195388D20070C39A /* InfoPlist.strings */; };
22   - 6003F5BC195388D20070C39A /* Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F5BB195388D20070C39A /* Tests.m */; };
23   - 6769D25C9BEC8C1CC77CB4C2 /* Pods_CNPublishContent_Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5FFED97E9A0FA50ED18FE238 /* Pods_CNPublishContent_Tests.framework */; };
24   - 6AE4174B26206F6F55BCF9FF /* Pods_CNPublishContent_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 60F6ABECB052AA611DD3C6C2 /* Pods_CNPublishContent_Example.framework */; };
25   - 71719F9F1E33DC2100824A3D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 71719F9D1E33DC2100824A3D /* LaunchScreen.storyboard */; };
26   - 873B8AEB1B1F5CCA007FD442 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 873B8AEA1B1F5CCA007FD442 /* Main.storyboard */; };
27   -/* End PBXBuildFile section */
28   -
29   -/* Begin PBXContainerItemProxy section */
30   - 6003F5B3195388D20070C39A /* PBXContainerItemProxy */ = {
31   - isa = PBXContainerItemProxy;
32   - containerPortal = 6003F582195388D10070C39A /* Project object */;
33   - proxyType = 1;
34   - remoteGlobalIDString = 6003F589195388D20070C39A;
35   - remoteInfo = CNPublishContent;
36   - };
37   -/* End PBXContainerItemProxy section */
38   -
39   -/* Begin PBXFileReference section */
40   - 2B32347423906BB3B11FA851 /* Pods-CNPublishContent_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CNPublishContent_Example.debug.xcconfig"; path = "Pods/Target Support Files/Pods-CNPublishContent_Example/Pods-CNPublishContent_Example.debug.xcconfig"; sourceTree = "<group>"; };
41   - 346EAA9CF3B660C291BA2CE8 /* Pods-CNPublishContent_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CNPublishContent_Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-CNPublishContent_Tests/Pods-CNPublishContent_Tests.release.xcconfig"; sourceTree = "<group>"; };
42   - 5FFED97E9A0FA50ED18FE238 /* Pods_CNPublishContent_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_CNPublishContent_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
43   - 6003F58A195388D20070C39A /* CNPublishContent_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CNPublishContent_Example.app; sourceTree = BUILT_PRODUCTS_DIR; };
44   - 6003F58D195388D20070C39A /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
45   - 6003F58F195388D20070C39A /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
46   - 6003F591195388D20070C39A /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
47   - 6003F595195388D20070C39A /* CNPublishContent-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "CNPublishContent-Info.plist"; sourceTree = "<group>"; };
48   - 6003F597195388D20070C39A /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
49   - 6003F599195388D20070C39A /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
50   - 6003F59B195388D20070C39A /* CNPublishContent-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "CNPublishContent-Prefix.pch"; sourceTree = "<group>"; };
51   - 6003F59C195388D20070C39A /* CNLiveAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CNLiveAppDelegate.h; sourceTree = "<group>"; };
52   - 6003F59D195388D20070C39A /* CNLiveAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CNLiveAppDelegate.m; sourceTree = "<group>"; };
53   - 6003F5A5195388D20070C39A /* CNLiveViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CNLiveViewController.h; sourceTree = "<group>"; };
54   - 6003F5A6195388D20070C39A /* CNLiveViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CNLiveViewController.m; sourceTree = "<group>"; };
55   - 6003F5A8195388D20070C39A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
56   - 6003F5AE195388D20070C39A /* CNPublishContent_Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CNPublishContent_Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
57   - 6003F5AF195388D20070C39A /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; };
58   - 6003F5B7195388D20070C39A /* Tests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Tests-Info.plist"; sourceTree = "<group>"; };
59   - 6003F5B9195388D20070C39A /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
60   - 6003F5BB195388D20070C39A /* Tests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Tests.m; sourceTree = "<group>"; };
61   - 606FC2411953D9B200FFA9A0 /* Tests-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Tests-Prefix.pch"; sourceTree = "<group>"; };
62   - 60F6ABECB052AA611DD3C6C2 /* Pods_CNPublishContent_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_CNPublishContent_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; };
63   - 71719F9E1E33DC2100824A3D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
64   - 75CD1D46D75DACAE352F31AC /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = "<group>"; };
65   - 86DA0A0D02892BE15A717447 /* Pods-CNPublishContent_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CNPublishContent_Tests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-CNPublishContent_Tests/Pods-CNPublishContent_Tests.debug.xcconfig"; sourceTree = "<group>"; };
66   - 873B8AEA1B1F5CCA007FD442 /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = Main.storyboard; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
67   - A21BA8A1208D47A4DB60E045 /* Pods-CNPublishContent_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CNPublishContent_Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-CNPublishContent_Example/Pods-CNPublishContent_Example.release.xcconfig"; sourceTree = "<group>"; };
68   - B2C2DA96FC16AB2BD1099505 /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = "<group>"; };
69   - FEC60CF35EABAF20BB7DC7FE /* CNPublishContent.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = CNPublishContent.podspec; path = ../CNPublishContent.podspec; sourceTree = "<group>"; };
70   -/* End PBXFileReference section */
71   -
72   -/* Begin PBXFrameworksBuildPhase section */
73   - 6003F587195388D20070C39A /* Frameworks */ = {
74   - isa = PBXFrameworksBuildPhase;
75   - buildActionMask = 2147483647;
76   - files = (
77   - 6003F590195388D20070C39A /* CoreGraphics.framework in Frameworks */,
78   - 6003F592195388D20070C39A /* UIKit.framework in Frameworks */,
79   - 6003F58E195388D20070C39A /* Foundation.framework in Frameworks */,
80   - 6AE4174B26206F6F55BCF9FF /* Pods_CNPublishContent_Example.framework in Frameworks */,
81   - );
82   - runOnlyForDeploymentPostprocessing = 0;
83   - };
84   - 6003F5AB195388D20070C39A /* Frameworks */ = {
85   - isa = PBXFrameworksBuildPhase;
86   - buildActionMask = 2147483647;
87   - files = (
88   - 6003F5B0195388D20070C39A /* XCTest.framework in Frameworks */,
89   - 6003F5B2195388D20070C39A /* UIKit.framework in Frameworks */,
90   - 6003F5B1195388D20070C39A /* Foundation.framework in Frameworks */,
91   - 6769D25C9BEC8C1CC77CB4C2 /* Pods_CNPublishContent_Tests.framework in Frameworks */,
92   - );
93   - runOnlyForDeploymentPostprocessing = 0;
94   - };
95   -/* End PBXFrameworksBuildPhase section */
96   -
97   -/* Begin PBXGroup section */
98   - 6003F581195388D10070C39A = {
99   - isa = PBXGroup;
100   - children = (
101   - 60FF7A9C1954A5C5007DD14C /* Podspec Metadata */,
102   - 6003F593195388D20070C39A /* Example for CNPublishContent */,
103   - 6003F5B5195388D20070C39A /* Tests */,
104   - 6003F58C195388D20070C39A /* Frameworks */,
105   - 6003F58B195388D20070C39A /* Products */,
106   - 6C55C5CBB6E2C1DCD2BF5E28 /* Pods */,
107   - );
108   - sourceTree = "<group>";
109   - };
110   - 6003F58B195388D20070C39A /* Products */ = {
111   - isa = PBXGroup;
112   - children = (
113   - 6003F58A195388D20070C39A /* CNPublishContent_Example.app */,
114   - 6003F5AE195388D20070C39A /* CNPublishContent_Tests.xctest */,
115   - );
116   - name = Products;
117   - sourceTree = "<group>";
118   - };
119   - 6003F58C195388D20070C39A /* Frameworks */ = {
120   - isa = PBXGroup;
121   - children = (
122   - 6003F58D195388D20070C39A /* Foundation.framework */,
123   - 6003F58F195388D20070C39A /* CoreGraphics.framework */,
124   - 6003F591195388D20070C39A /* UIKit.framework */,
125   - 6003F5AF195388D20070C39A /* XCTest.framework */,
126   - 60F6ABECB052AA611DD3C6C2 /* Pods_CNPublishContent_Example.framework */,
127   - 5FFED97E9A0FA50ED18FE238 /* Pods_CNPublishContent_Tests.framework */,
128   - );
129   - name = Frameworks;
130   - sourceTree = "<group>";
131   - };
132   - 6003F593195388D20070C39A /* Example for CNPublishContent */ = {
133   - isa = PBXGroup;
134   - children = (
135   - 6003F59C195388D20070C39A /* CNLiveAppDelegate.h */,
136   - 6003F59D195388D20070C39A /* CNLiveAppDelegate.m */,
137   - 873B8AEA1B1F5CCA007FD442 /* Main.storyboard */,
138   - 6003F5A5195388D20070C39A /* CNLiveViewController.h */,
139   - 6003F5A6195388D20070C39A /* CNLiveViewController.m */,
140   - 71719F9D1E33DC2100824A3D /* LaunchScreen.storyboard */,
141   - 6003F5A8195388D20070C39A /* Images.xcassets */,
142   - 6003F594195388D20070C39A /* Supporting Files */,
143   - );
144   - name = "Example for CNPublishContent";
145   - path = CNPublishContent;
146   - sourceTree = "<group>";
147   - };
148   - 6003F594195388D20070C39A /* Supporting Files */ = {
149   - isa = PBXGroup;
150   - children = (
151   - 6003F595195388D20070C39A /* CNPublishContent-Info.plist */,
152   - 6003F596195388D20070C39A /* InfoPlist.strings */,
153   - 6003F599195388D20070C39A /* main.m */,
154   - 6003F59B195388D20070C39A /* CNPublishContent-Prefix.pch */,
155   - );
156   - name = "Supporting Files";
157   - sourceTree = "<group>";
158   - };
159   - 6003F5B5195388D20070C39A /* Tests */ = {
160   - isa = PBXGroup;
161   - children = (
162   - 6003F5BB195388D20070C39A /* Tests.m */,
163   - 6003F5B6195388D20070C39A /* Supporting Files */,
164   - );
165   - path = Tests;
166   - sourceTree = "<group>";
167   - };
168   - 6003F5B6195388D20070C39A /* Supporting Files */ = {
169   - isa = PBXGroup;
170   - children = (
171   - 6003F5B7195388D20070C39A /* Tests-Info.plist */,
172   - 6003F5B8195388D20070C39A /* InfoPlist.strings */,
173   - 606FC2411953D9B200FFA9A0 /* Tests-Prefix.pch */,
174   - );
175   - name = "Supporting Files";
176   - sourceTree = "<group>";
177   - };
178   - 60FF7A9C1954A5C5007DD14C /* Podspec Metadata */ = {
179   - isa = PBXGroup;
180   - children = (
181   - FEC60CF35EABAF20BB7DC7FE /* CNPublishContent.podspec */,
182   - 75CD1D46D75DACAE352F31AC /* README.md */,
183   - B2C2DA96FC16AB2BD1099505 /* LICENSE */,
184   - );
185   - name = "Podspec Metadata";
186   - sourceTree = "<group>";
187   - };
188   - 6C55C5CBB6E2C1DCD2BF5E28 /* Pods */ = {
189   - isa = PBXGroup;
190   - children = (
191   - 2B32347423906BB3B11FA851 /* Pods-CNPublishContent_Example.debug.xcconfig */,
192   - A21BA8A1208D47A4DB60E045 /* Pods-CNPublishContent_Example.release.xcconfig */,
193   - 86DA0A0D02892BE15A717447 /* Pods-CNPublishContent_Tests.debug.xcconfig */,
194   - 346EAA9CF3B660C291BA2CE8 /* Pods-CNPublishContent_Tests.release.xcconfig */,
195   - );
196   - name = Pods;
197   - sourceTree = "<group>";
198   - };
199   -/* End PBXGroup section */
200   -
201   -/* Begin PBXNativeTarget section */
202   - 6003F589195388D20070C39A /* CNPublishContent_Example */ = {
203   - isa = PBXNativeTarget;
204   - buildConfigurationList = 6003F5BF195388D20070C39A /* Build configuration list for PBXNativeTarget "CNPublishContent_Example" */;
205   - buildPhases = (
206   - B9218DA9FB0D5EE62E120743 /* [CP] Check Pods Manifest.lock */,
207   - 6003F586195388D20070C39A /* Sources */,
208   - 6003F587195388D20070C39A /* Frameworks */,
209   - 6003F588195388D20070C39A /* Resources */,
210   - 1C9681202A9E56DC46389E05 /* [CP] Embed Pods Frameworks */,
211   - );
212   - buildRules = (
213   - );
214   - dependencies = (
215   - );
216   - name = CNPublishContent_Example;
217   - productName = CNPublishContent;
218   - productReference = 6003F58A195388D20070C39A /* CNPublishContent_Example.app */;
219   - productType = "com.apple.product-type.application";
220   - };
221   - 6003F5AD195388D20070C39A /* CNPublishContent_Tests */ = {
222   - isa = PBXNativeTarget;
223   - buildConfigurationList = 6003F5C2195388D20070C39A /* Build configuration list for PBXNativeTarget "CNPublishContent_Tests" */;
224   - buildPhases = (
225   - 07B13B6B4FE7BECDB58D7D82 /* [CP] Check Pods Manifest.lock */,
226   - 6003F5AA195388D20070C39A /* Sources */,
227   - 6003F5AB195388D20070C39A /* Frameworks */,
228   - 6003F5AC195388D20070C39A /* Resources */,
229   - 4F18F65C502CF943DD78DE0E /* [CP] Embed Pods Frameworks */,
230   - );
231   - buildRules = (
232   - );
233   - dependencies = (
234   - 6003F5B4195388D20070C39A /* PBXTargetDependency */,
235   - );
236   - name = CNPublishContent_Tests;
237   - productName = CNPublishContentTests;
238   - productReference = 6003F5AE195388D20070C39A /* CNPublishContent_Tests.xctest */;
239   - productType = "com.apple.product-type.bundle.unit-test";
240   - };
241   -/* End PBXNativeTarget section */
242   -
243   -/* Begin PBXProject section */
244   - 6003F582195388D10070C39A /* Project object */ = {
245   - isa = PBXProject;
246   - attributes = {
247   - CLASSPREFIX = CNLive;
248   - LastUpgradeCheck = 0720;
249   - ORGANIZATIONNAME = "殷巧娟";
250   - TargetAttributes = {
251   - 6003F589195388D20070C39A = {
252   - DevelopmentTeam = 59PD8HK2YG;
253   - };
254   - 6003F5AD195388D20070C39A = {
255   - TestTargetID = 6003F589195388D20070C39A;
256   - };
257   - };
258   - };
259   - buildConfigurationList = 6003F585195388D10070C39A /* Build configuration list for PBXProject "CNPublishContent" */;
260   - compatibilityVersion = "Xcode 3.2";
261   - developmentRegion = English;
262   - hasScannedForEncodings = 0;
263   - knownRegions = (
264   - en,
265   - Base,
266   - );
267   - mainGroup = 6003F581195388D10070C39A;
268   - productRefGroup = 6003F58B195388D20070C39A /* Products */;
269   - projectDirPath = "";
270   - projectRoot = "";
271   - targets = (
272   - 6003F589195388D20070C39A /* CNPublishContent_Example */,
273   - 6003F5AD195388D20070C39A /* CNPublishContent_Tests */,
274   - );
275   - };
276   -/* End PBXProject section */
277   -
278   -/* Begin PBXResourcesBuildPhase section */
279   - 6003F588195388D20070C39A /* Resources */ = {
280   - isa = PBXResourcesBuildPhase;
281   - buildActionMask = 2147483647;
282   - files = (
283   - 873B8AEB1B1F5CCA007FD442 /* Main.storyboard in Resources */,
284   - 71719F9F1E33DC2100824A3D /* LaunchScreen.storyboard in Resources */,
285   - 6003F5A9195388D20070C39A /* Images.xcassets in Resources */,
286   - 6003F598195388D20070C39A /* InfoPlist.strings in Resources */,
287   - );
288   - runOnlyForDeploymentPostprocessing = 0;
289   - };
290   - 6003F5AC195388D20070C39A /* Resources */ = {
291   - isa = PBXResourcesBuildPhase;
292   - buildActionMask = 2147483647;
293   - files = (
294   - 6003F5BA195388D20070C39A /* InfoPlist.strings in Resources */,
295   - );
296   - runOnlyForDeploymentPostprocessing = 0;
297   - };
298   -/* End PBXResourcesBuildPhase section */
299   -
300   -/* Begin PBXShellScriptBuildPhase section */
301   - 07B13B6B4FE7BECDB58D7D82 /* [CP] Check Pods Manifest.lock */ = {
302   - isa = PBXShellScriptBuildPhase;
303   - buildActionMask = 2147483647;
304   - files = (
305   - );
306   - inputFileListPaths = (
307   - );
308   - inputPaths = (
309   - "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
310   - "${PODS_ROOT}/Manifest.lock",
311   - );
312   - name = "[CP] Check Pods Manifest.lock";
313   - outputFileListPaths = (
314   - );
315   - outputPaths = (
316   - "$(DERIVED_FILE_DIR)/Pods-CNPublishContent_Tests-checkManifestLockResult.txt",
317   - );
318   - runOnlyForDeploymentPostprocessing = 0;
319   - shellPath = /bin/sh;
320   - 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";
321   - showEnvVarsInLog = 0;
322   - };
323   - 1C9681202A9E56DC46389E05 /* [CP] Embed Pods Frameworks */ = {
324   - isa = PBXShellScriptBuildPhase;
325   - buildActionMask = 2147483647;
326   - files = (
327   - );
328   - inputFileListPaths = (
329   - );
330   - inputPaths = (
331   - "${SRCROOT}/Pods/Target Support Files/Pods-CNPublishContent_Example/Pods-CNPublishContent_Example-frameworks.sh",
332   - "${BUILT_PRODUCTS_DIR}/AFNetworking/AFNetworking.framework",
333   - "${BUILT_PRODUCTS_DIR}/CNPublishContent/CNPublishContent.framework",
334   - );
335   - name = "[CP] Embed Pods Frameworks";
336   - outputFileListPaths = (
337   - );
338   - outputPaths = (
339   - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AFNetworking.framework",
340   - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNPublishContent.framework",
341   - );
342   - runOnlyForDeploymentPostprocessing = 0;
343   - shellPath = /bin/sh;
344   - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-CNPublishContent_Example/Pods-CNPublishContent_Example-frameworks.sh\"\n";
345   - showEnvVarsInLog = 0;
346   - };
347   - 4F18F65C502CF943DD78DE0E /* [CP] Embed Pods Frameworks */ = {
348   - isa = PBXShellScriptBuildPhase;
349   - buildActionMask = 2147483647;
350   - files = (
351   - );
352   - inputFileListPaths = (
353   - );
354   - inputPaths = (
355   - "${SRCROOT}/Pods/Target Support Files/Pods-CNPublishContent_Tests/Pods-CNPublishContent_Tests-frameworks.sh",
356   - "${BUILT_PRODUCTS_DIR}/AFNetworking/AFNetworking.framework",
357   - );
358   - name = "[CP] Embed Pods Frameworks";
359   - outputFileListPaths = (
360   - );
361   - outputPaths = (
362   - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AFNetworking.framework",
363   - );
364   - runOnlyForDeploymentPostprocessing = 0;
365   - shellPath = /bin/sh;
366   - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-CNPublishContent_Tests/Pods-CNPublishContent_Tests-frameworks.sh\"\n";
367   - showEnvVarsInLog = 0;
368   - };
369   - B9218DA9FB0D5EE62E120743 /* [CP] Check Pods Manifest.lock */ = {
370   - isa = PBXShellScriptBuildPhase;
371   - buildActionMask = 2147483647;
372   - files = (
373   - );
374   - inputFileListPaths = (
375   - );
376   - inputPaths = (
377   - "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
378   - "${PODS_ROOT}/Manifest.lock",
379   - );
380   - name = "[CP] Check Pods Manifest.lock";
381   - outputFileListPaths = (
382   - );
383   - outputPaths = (
384   - "$(DERIVED_FILE_DIR)/Pods-CNPublishContent_Example-checkManifestLockResult.txt",
385   - );
386   - runOnlyForDeploymentPostprocessing = 0;
387   - shellPath = /bin/sh;
388   - 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";
389   - showEnvVarsInLog = 0;
390   - };
391   -/* End PBXShellScriptBuildPhase section */
392   -
393   -/* Begin PBXSourcesBuildPhase section */
394   - 6003F586195388D20070C39A /* Sources */ = {
395   - isa = PBXSourcesBuildPhase;
396   - buildActionMask = 2147483647;
397   - files = (
398   - 6003F59E195388D20070C39A /* CNLiveAppDelegate.m in Sources */,
399   - 6003F5A7195388D20070C39A /* CNLiveViewController.m in Sources */,
400   - 6003F59A195388D20070C39A /* main.m in Sources */,
401   - );
402   - runOnlyForDeploymentPostprocessing = 0;
403   - };
404   - 6003F5AA195388D20070C39A /* Sources */ = {
405   - isa = PBXSourcesBuildPhase;
406   - buildActionMask = 2147483647;
407   - files = (
408   - 6003F5BC195388D20070C39A /* Tests.m in Sources */,
409   - );
410   - runOnlyForDeploymentPostprocessing = 0;
411   - };
412   -/* End PBXSourcesBuildPhase section */
413   -
414   -/* Begin PBXTargetDependency section */
415   - 6003F5B4195388D20070C39A /* PBXTargetDependency */ = {
416   - isa = PBXTargetDependency;
417   - target = 6003F589195388D20070C39A /* CNPublishContent_Example */;
418   - targetProxy = 6003F5B3195388D20070C39A /* PBXContainerItemProxy */;
419   - };
420   -/* End PBXTargetDependency section */
421   -
422   -/* Begin PBXVariantGroup section */
423   - 6003F596195388D20070C39A /* InfoPlist.strings */ = {
424   - isa = PBXVariantGroup;
425   - children = (
426   - 6003F597195388D20070C39A /* en */,
427   - );
428   - name = InfoPlist.strings;
429   - sourceTree = "<group>";
430   - };
431   - 6003F5B8195388D20070C39A /* InfoPlist.strings */ = {
432   - isa = PBXVariantGroup;
433   - children = (
434   - 6003F5B9195388D20070C39A /* en */,
435   - );
436   - name = InfoPlist.strings;
437   - sourceTree = "<group>";
438   - };
439   - 71719F9D1E33DC2100824A3D /* LaunchScreen.storyboard */ = {
440   - isa = PBXVariantGroup;
441   - children = (
442   - 71719F9E1E33DC2100824A3D /* Base */,
443   - );
444   - name = LaunchScreen.storyboard;
445   - sourceTree = "<group>";
446   - };
447   -/* End PBXVariantGroup section */
448   -
449   -/* Begin XCBuildConfiguration section */
450   - 6003F5BD195388D20070C39A /* Debug */ = {
451   - isa = XCBuildConfiguration;
452   - buildSettings = {
453   - ALWAYS_SEARCH_USER_PATHS = NO;
454   - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
455   - CLANG_CXX_LIBRARY = "libc++";
456   - CLANG_ENABLE_MODULES = YES;
457   - CLANG_ENABLE_OBJC_ARC = YES;
458   - CLANG_WARN_BOOL_CONVERSION = YES;
459   - CLANG_WARN_CONSTANT_CONVERSION = YES;
460   - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
461   - CLANG_WARN_EMPTY_BODY = YES;
462   - CLANG_WARN_ENUM_CONVERSION = YES;
463   - CLANG_WARN_INT_CONVERSION = YES;
464   - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
465   - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
466   - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
467   - COPY_PHASE_STRIP = NO;
468   - ENABLE_TESTABILITY = YES;
469   - GCC_C_LANGUAGE_STANDARD = gnu99;
470   - GCC_DYNAMIC_NO_PIC = NO;
471   - GCC_OPTIMIZATION_LEVEL = 0;
472   - GCC_PREPROCESSOR_DEFINITIONS = (
473   - "DEBUG=1",
474   - "$(inherited)",
475   - );
476   - GCC_SYMBOLS_PRIVATE_EXTERN = NO;
477   - GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
478   - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
479   - GCC_WARN_UNDECLARED_SELECTOR = YES;
480   - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
481   - GCC_WARN_UNUSED_FUNCTION = YES;
482   - GCC_WARN_UNUSED_VARIABLE = YES;
483   - IPHONEOS_DEPLOYMENT_TARGET = 9.3;
484   - ONLY_ACTIVE_ARCH = YES;
485   - SDKROOT = iphoneos;
486   - TARGETED_DEVICE_FAMILY = "1,2";
487   - };
488   - name = Debug;
489   - };
490   - 6003F5BE195388D20070C39A /* Release */ = {
491   - isa = XCBuildConfiguration;
492   - buildSettings = {
493   - ALWAYS_SEARCH_USER_PATHS = NO;
494   - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
495   - CLANG_CXX_LIBRARY = "libc++";
496   - CLANG_ENABLE_MODULES = YES;
497   - CLANG_ENABLE_OBJC_ARC = YES;
498   - CLANG_WARN_BOOL_CONVERSION = YES;
499   - CLANG_WARN_CONSTANT_CONVERSION = YES;
500   - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
501   - CLANG_WARN_EMPTY_BODY = YES;
502   - CLANG_WARN_ENUM_CONVERSION = YES;
503   - CLANG_WARN_INT_CONVERSION = YES;
504   - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
505   - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
506   - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
507   - COPY_PHASE_STRIP = YES;
508   - ENABLE_NS_ASSERTIONS = NO;
509   - GCC_C_LANGUAGE_STANDARD = gnu99;
510   - GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
511   - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
512   - GCC_WARN_UNDECLARED_SELECTOR = YES;
513   - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
514   - GCC_WARN_UNUSED_FUNCTION = YES;
515   - GCC_WARN_UNUSED_VARIABLE = YES;
516   - IPHONEOS_DEPLOYMENT_TARGET = 9.3;
517   - SDKROOT = iphoneos;
518   - TARGETED_DEVICE_FAMILY = "1,2";
519   - VALIDATE_PRODUCT = YES;
520   - };
521   - name = Release;
522   - };
523   - 6003F5C0195388D20070C39A /* Debug */ = {
524   - isa = XCBuildConfiguration;
525   - baseConfigurationReference = 2B32347423906BB3B11FA851 /* Pods-CNPublishContent_Example.debug.xcconfig */;
526   - buildSettings = {
527   - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
528   - DEVELOPMENT_TEAM = 59PD8HK2YG;
529   - GCC_PRECOMPILE_PREFIX_HEADER = YES;
530   - GCC_PREFIX_HEADER = "CNPublishContent/CNPublishContent-Prefix.pch";
531   - INFOPLIST_FILE = "CNPublishContent/CNPublishContent-Info.plist";
532   - MODULE_NAME = ExampleApp;
533   - PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}";
534   - PRODUCT_NAME = "$(TARGET_NAME)";
535   - WRAPPER_EXTENSION = app;
536   - };
537   - name = Debug;
538   - };
539   - 6003F5C1195388D20070C39A /* Release */ = {
540   - isa = XCBuildConfiguration;
541   - baseConfigurationReference = A21BA8A1208D47A4DB60E045 /* Pods-CNPublishContent_Example.release.xcconfig */;
542   - buildSettings = {
543   - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
544   - DEVELOPMENT_TEAM = 59PD8HK2YG;
545   - GCC_PRECOMPILE_PREFIX_HEADER = YES;
546   - GCC_PREFIX_HEADER = "CNPublishContent/CNPublishContent-Prefix.pch";
547   - INFOPLIST_FILE = "CNPublishContent/CNPublishContent-Info.plist";
548   - MODULE_NAME = ExampleApp;
549   - PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}";
550   - PRODUCT_NAME = "$(TARGET_NAME)";
551   - WRAPPER_EXTENSION = app;
552   - };
553   - name = Release;
554   - };
555   - 6003F5C3195388D20070C39A /* Debug */ = {
556   - isa = XCBuildConfiguration;
557   - baseConfigurationReference = 86DA0A0D02892BE15A717447 /* Pods-CNPublishContent_Tests.debug.xcconfig */;
558   - buildSettings = {
559   - BUNDLE_LOADER = "$(TEST_HOST)";
560   - FRAMEWORK_SEARCH_PATHS = (
561   - "$(SDKROOT)/Developer/Library/Frameworks",
562   - "$(inherited)",
563   - "$(DEVELOPER_FRAMEWORKS_DIR)",
564   - );
565   - GCC_PRECOMPILE_PREFIX_HEADER = YES;
566   - GCC_PREFIX_HEADER = "Tests/Tests-Prefix.pch";
567   - GCC_PREPROCESSOR_DEFINITIONS = (
568   - "DEBUG=1",
569   - "$(inherited)",
570   - );
571   - INFOPLIST_FILE = "Tests/Tests-Info.plist";
572   - PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}";
573   - PRODUCT_NAME = "$(TARGET_NAME)";
574   - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CNPublishContent_Example.app/CNPublishContent_Example";
575   - WRAPPER_EXTENSION = xctest;
576   - };
577   - name = Debug;
578   - };
579   - 6003F5C4195388D20070C39A /* Release */ = {
580   - isa = XCBuildConfiguration;
581   - baseConfigurationReference = 346EAA9CF3B660C291BA2CE8 /* Pods-CNPublishContent_Tests.release.xcconfig */;
582   - buildSettings = {
583   - BUNDLE_LOADER = "$(TEST_HOST)";
584   - FRAMEWORK_SEARCH_PATHS = (
585   - "$(SDKROOT)/Developer/Library/Frameworks",
586   - "$(inherited)",
587   - "$(DEVELOPER_FRAMEWORKS_DIR)",
588   - );
589   - GCC_PRECOMPILE_PREFIX_HEADER = YES;
590   - GCC_PREFIX_HEADER = "Tests/Tests-Prefix.pch";
591   - INFOPLIST_FILE = "Tests/Tests-Info.plist";
592   - PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}";
593   - PRODUCT_NAME = "$(TARGET_NAME)";
594   - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CNPublishContent_Example.app/CNPublishContent_Example";
595   - WRAPPER_EXTENSION = xctest;
596   - };
597   - name = Release;
598   - };
599   -/* End XCBuildConfiguration section */
600   -
601   -/* Begin XCConfigurationList section */
602   - 6003F585195388D10070C39A /* Build configuration list for PBXProject "CNPublishContent" */ = {
603   - isa = XCConfigurationList;
604   - buildConfigurations = (
605   - 6003F5BD195388D20070C39A /* Debug */,
606   - 6003F5BE195388D20070C39A /* Release */,
607   - );
608   - defaultConfigurationIsVisible = 0;
609   - defaultConfigurationName = Release;
610   - };
611   - 6003F5BF195388D20070C39A /* Build configuration list for PBXNativeTarget "CNPublishContent_Example" */ = {
612   - isa = XCConfigurationList;
613   - buildConfigurations = (
614   - 6003F5C0195388D20070C39A /* Debug */,
615   - 6003F5C1195388D20070C39A /* Release */,
616   - );
617   - defaultConfigurationIsVisible = 0;
618   - defaultConfigurationName = Release;
619   - };
620   - 6003F5C2195388D20070C39A /* Build configuration list for PBXNativeTarget "CNPublishContent_Tests" */ = {
621   - isa = XCConfigurationList;
622   - buildConfigurations = (
623   - 6003F5C3195388D20070C39A /* Debug */,
624   - 6003F5C4195388D20070C39A /* Release */,
625   - );
626   - defaultConfigurationIsVisible = 0;
627   - defaultConfigurationName = Release;
628   - };
629   -/* End XCConfigurationList section */
630   - };
631   - rootObject = 6003F582195388D10070C39A /* Project object */;
632   -}
CNPublishContent/Example/CNPublishContent.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted 100644 → 0
1   -<?xml version="1.0" encoding="UTF-8"?>
2   -<Workspace
3   - version = "1.0">
4   - <FileRef
5   - location = "self:CNPublishContent.xcodeproj">
6   - </FileRef>
7   -</Workspace>
CNPublishContent/Example/CNPublishContent.xcodeproj/xcshareddata/xcschemes/CNPublishContent-Example.xcscheme deleted 100644 → 0
1   -<?xml version="1.0" encoding="UTF-8"?>
2   -<Scheme
3   - LastUpgradeVersion = "0720"
4   - version = "1.3">
5   - <BuildAction
6   - parallelizeBuildables = "YES"
7   - buildImplicitDependencies = "YES">
8   - <BuildActionEntries>
9   - <BuildActionEntry
10   - buildForTesting = "YES"
11   - buildForRunning = "YES"
12   - buildForProfiling = "YES"
13   - buildForArchiving = "YES"
14   - buildForAnalyzing = "YES">
15   - <BuildableReference
16   - BuildableIdentifier = "primary"
17   - BlueprintIdentifier = "6003F589195388D20070C39A"
18   - BuildableName = "CNPublishContent_Example.app"
19   - BlueprintName = "CNPublishContent_Example"
20   - ReferencedContainer = "container:CNPublishContent.xcodeproj">
21   - </BuildableReference>
22   - </BuildActionEntry>
23   - </BuildActionEntries>
24   - </BuildAction>
25   - <TestAction
26   - buildConfiguration = "Debug"
27   - selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28   - selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29   - shouldUseLaunchSchemeArgsEnv = "YES">
30   - <Testables>
31   - <TestableReference
32   - skipped = "NO">
33   - <BuildableReference
34   - BuildableIdentifier = "primary"
35   - BlueprintIdentifier = "6003F5AD195388D20070C39A"
36   - BuildableName = "CNPublishContent_Tests.xctest"
37   - BlueprintName = "CNPublishContent_Tests"
38   - ReferencedContainer = "container:CNPublishContent.xcodeproj">
39   - </BuildableReference>
40   - </TestableReference>
41   - </Testables>
42   - <MacroExpansion>
43   - <BuildableReference
44   - BuildableIdentifier = "primary"
45   - BlueprintIdentifier = "6003F589195388D20070C39A"
46   - BuildableName = "CNPublishContent_Example.app"
47   - BlueprintName = "CNPublishContent_Example"
48   - ReferencedContainer = "container:CNPublishContent.xcodeproj">
49   - </BuildableReference>
50   - </MacroExpansion>
51   - <AdditionalOptions>
52   - </AdditionalOptions>
53   - </TestAction>
54   - <LaunchAction
55   - buildConfiguration = "Debug"
56   - selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
57   - selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
58   - launchStyle = "0"
59   - useCustomWorkingDirectory = "NO"
60   - ignoresPersistentStateOnLaunch = "NO"
61   - debugDocumentVersioning = "YES"
62   - debugServiceExtension = "internal"
63   - allowLocationSimulation = "YES">
64   - <BuildableProductRunnable
65   - runnableDebuggingMode = "0">
66   - <BuildableReference
67   - BuildableIdentifier = "primary"
68   - BlueprintIdentifier = "6003F589195388D20070C39A"
69   - BuildableName = "CNPublishContent_Example.app"
70   - BlueprintName = "CNPublishContent_Example"
71   - ReferencedContainer = "container:CNPublishContent.xcodeproj">
72   - </BuildableReference>
73   - </BuildableProductRunnable>
74   - <AdditionalOptions>
75   - </AdditionalOptions>
76   - </LaunchAction>
77   - <ProfileAction
78   - buildConfiguration = "Release"
79   - shouldUseLaunchSchemeArgsEnv = "YES"
80   - savedToolIdentifier = ""
81   - useCustomWorkingDirectory = "NO"
82   - debugDocumentVersioning = "YES">
83   - <BuildableProductRunnable
84   - runnableDebuggingMode = "0">
85   - <BuildableReference
86   - BuildableIdentifier = "primary"
87   - BlueprintIdentifier = "6003F589195388D20070C39A"
88   - BuildableName = "CNPublishContent_Example.app"
89   - BlueprintName = "CNPublishContent_Example"
90   - ReferencedContainer = "container:CNPublishContent.xcodeproj">
91   - </BuildableReference>
92   - </BuildableProductRunnable>
93   - </ProfileAction>
94   - <AnalyzeAction
95   - buildConfiguration = "Debug">
96   - </AnalyzeAction>
97   - <ArchiveAction
98   - buildConfiguration = "Release"
99   - revealArchiveInOrganizer = "YES">
100   - </ArchiveAction>
101   -</Scheme>
CNPublishContent/Example/CNPublishContent.xcworkspace/contents.xcworkspacedata deleted 100644 → 0
1   -<?xml version="1.0" encoding="UTF-8"?>
2   -<Workspace
3   - version = "1.0">
4   - <FileRef
5   - location = "group:CNPublishContent.xcodeproj">
6   - </FileRef>
7   - <FileRef
8   - location = "group:Pods/Pods.xcodeproj">
9   - </FileRef>
10   -</Workspace>
CNPublishContent/Example/CNPublishContent.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted 100644 → 0
1   -<?xml version="1.0" encoding="UTF-8"?>
2   -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3   -<plist version="1.0">
4   -<dict>
5   - <key>IDEDidComputeMac32BitWarning</key>
6   - <true/>
7   -</dict>
8   -</plist>
CNPublishContent/Example/CNPublishContent.xcworkspace/xcuserdata/yinqiaojuan.xcuserdatad/UserInterfaceState.xcuserstate deleted 100644 → 0
No preview for this file type
CNPublishContent/Example/CNPublishContent/Base.lproj/LaunchScreen.storyboard deleted 100644 → 0
1   -<?xml version="1.0" encoding="UTF-8"?>
2   -<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
3   - <device id="retina4_7" orientation="portrait">
4   - <adaptation id="fullscreen"/>
5   - </device>
6   - <dependencies>
7   - <deployment identifier="iOS"/>
8   - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/>
9   - <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
10   - </dependencies>
11   - <scenes>
12   - <!--View Controller-->
13   - <scene sceneID="EHf-IW-A2E">
14   - <objects>
15   - <viewController id="01J-lp-oVM" sceneMemberID="viewController">
16   - <layoutGuides>
17   - <viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/>
18   - <viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
19   - </layoutGuides>
20   - <view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
21   - <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
22   - <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
23   - <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
24   - </view>
25   - </viewController>
26   - <placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
27   - </objects>
28   - <point key="canvasLocation" x="53" y="375"/>
29   - </scene>
30   - </scenes>
31   -</document>
CNPublishContent/Example/CNPublishContent/Base.lproj/Main.storyboard deleted 100644 → 0
1   -<?xml version="1.0" encoding="UTF-8"?>
2   -<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="whP-gf-Uak">
3   - <device id="retina4_7" orientation="portrait">
4   - <adaptation id="fullscreen"/>
5   - </device>
6   - <dependencies>
7   - <deployment identifier="iOS"/>
8   - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/>
9   - <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
10   - </dependencies>
11   - <scenes>
12   - <!--View Controller-->
13   - <scene sceneID="wQg-tq-qST">
14   - <objects>
15   - <viewController id="whP-gf-Uak" customClass="CNLiveViewController" sceneMemberID="viewController">
16   - <layoutGuides>
17   - <viewControllerLayoutGuide type="top" id="uEw-UM-LJ8"/>
18   - <viewControllerLayoutGuide type="bottom" id="Mvr-aV-6Um"/>
19   - </layoutGuides>
20   - <view key="view" contentMode="scaleToFill" id="TpU-gO-2f1">
21   - <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
22   - <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
23   - <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
24   - </view>
25   - </viewController>
26   - <placeholder placeholderIdentifier="IBFirstResponder" id="tc2-Qw-aMS" userLabel="First Responder" sceneMemberID="firstResponder"/>
27   - </objects>
28   - <point key="canvasLocation" x="305" y="433"/>
29   - </scene>
30   - </scenes>
31   -</document>
CNPublishContent/Example/CNPublishContent/CNLiveAppDelegate.h deleted 100644 → 0
1   -//
2   -// CNLiveAppDelegate.h
3   -// CNPublishContent
4   -//
5   -// Created by 殷巧娟 on 12/04/2018.
6   -// Copyright (c) 2018 殷巧娟. All rights reserved.
7   -//
8   -
9   -@import UIKit;
10   -
11   -@interface CNLiveAppDelegate : UIResponder <UIApplicationDelegate>
12   -
13   -@property (strong, nonatomic) UIWindow *window;
14   -
15   -@end
CNPublishContent/Example/CNPublishContent/CNLiveAppDelegate.m deleted 100644 → 0
1   -//
2   -// CNLiveAppDelegate.m
3   -// CNPublishContent
4   -//
5   -// Created by 殷巧娟 on 12/04/2018.
6   -// Copyright (c) 2018 殷巧娟. All rights reserved.
7   -//
8   -
9   -#import "CNLiveAppDelegate.h"
10   -
11   -@implementation CNLiveAppDelegate
12   -
13   -- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
14   -{
15   - // Override point for customization after application launch.
16   - return YES;
17   -}
18   -
19   -- (void)applicationWillResignActive:(UIApplication *)application
20   -{
21   - // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
22   - // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
23   -}
24   -
25   -- (void)applicationDidEnterBackground:(UIApplication *)application
26   -{
27   - // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
28   - // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
29   -}
30   -
31   -- (void)applicationWillEnterForeground:(UIApplication *)application
32   -{
33   - // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
34   -}
35   -
36   -- (void)applicationDidBecomeActive:(UIApplication *)application
37   -{
38   - // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
39   -}
40   -
41   -- (void)applicationWillTerminate:(UIApplication *)application
42   -{
43   - // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
44   -}
45   -
46   -@end
CNPublishContent/Example/CNPublishContent/CNLiveViewController.h deleted 100644 → 0
1   -//
2   -// CNLiveViewController.h
3   -// CNPublishContent
4   -//
5   -// Created by 殷巧娟 on 12/04/2018.
6   -// Copyright (c) 2018 殷巧娟. All rights reserved.
7   -//
8   -
9   -@import UIKit;
10   -
11   -@interface CNLiveViewController : UIViewController
12   -
13   -@end
CNPublishContent/Example/CNPublishContent/CNLiveViewController.m deleted 100644 → 0
1   -//
2   -// CNLiveViewController.m
3   -// CNPublishContent
4   -//
5   -// Created by 殷巧娟 on 12/04/2018.
6   -// Copyright (c) 2018 殷巧娟. All rights reserved.
7   -//
8   -
9   -#import "CNLiveViewController.h"
10   -
11   -@interface CNLiveViewController ()
12   -
13   -@end
14   -
15   -@implementation CNLiveViewController
16   -
17   -- (void)viewDidLoad
18   -{
19   - [super viewDidLoad];
20   - // Do any additional setup after loading the view, typically from a nib.
21   -}
22   -
23   -- (void)didReceiveMemoryWarning
24   -{
25   - [super didReceiveMemoryWarning];
26   - // Dispose of any resources that can be recreated.
27   -}
28   -
29   -@end
CNPublishContent/Example/CNPublishContent/CNPublishContent-Info.plist deleted 100644 → 0
1   -<?xml version="1.0" encoding="UTF-8"?>
2   -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3   -<plist version="1.0">
4   -<dict>
5   - <key>CFBundleDevelopmentRegion</key>
6   - <string>en</string>
7   - <key>CFBundleDisplayName</key>
8   - <string>${PRODUCT_NAME}</string>
9   - <key>CFBundleExecutable</key>
10   - <string>${EXECUTABLE_NAME}</string>
11   - <key>CFBundleIdentifier</key>
12   - <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
13   - <key>CFBundleInfoDictionaryVersion</key>
14   - <string>6.0</string>
15   - <key>CFBundleName</key>
16   - <string>${PRODUCT_NAME}</string>
17   - <key>CFBundlePackageType</key>
18   - <string>APPL</string>
19   - <key>CFBundleShortVersionString</key>
20   - <string>1.0</string>
21   - <key>CFBundleSignature</key>
22   - <string>????</string>
23   - <key>CFBundleVersion</key>
24   - <string>1.0</string>
25   - <key>LSRequiresIPhoneOS</key>
26   - <true/>
27   - <key>UILaunchStoryboardName</key>
28   - <string>LaunchScreen</string>
29   - <key>UIMainStoryboardFile</key>
30   - <string>Main</string>
31   - <key>UIRequiredDeviceCapabilities</key>
32   - <array>
33   - <string>armv7</string>
34   - </array>
35   - <key>UISupportedInterfaceOrientations</key>
36   - <array>
37   - <string>UIInterfaceOrientationPortrait</string>
38   - <string>UIInterfaceOrientationLandscapeLeft</string>
39   - <string>UIInterfaceOrientationLandscapeRight</string>
40   - </array>
41   - <key>UISupportedInterfaceOrientations~ipad</key>
42   - <array>
43   - <string>UIInterfaceOrientationPortrait</string>
44   - <string>UIInterfaceOrientationPortraitUpsideDown</string>
45   - <string>UIInterfaceOrientationLandscapeLeft</string>
46   - <string>UIInterfaceOrientationLandscapeRight</string>
47   - </array>
48   -</dict>
49   -</plist>
CNPublishContent/Example/CNPublishContent/CNPublishContent-Prefix.pch deleted 100644 → 0
1   -//
2   -// Prefix header
3   -//
4   -// The contents of this file are implicitly included at the beginning of every source file.
5   -//
6   -
7   -#import <Availability.h>
8   -
9   -#ifndef __IPHONE_5_0
10   -#warning "This project uses features only available in iOS SDK 5.0 and later."
11   -#endif
12   -
13   -#ifdef __OBJC__
14   - @import UIKit;
15   - @import Foundation;
16   -#endif
CNPublishContent/Example/CNPublishContent/Images.xcassets/AppIcon.appiconset/Contents.json deleted 100644 → 0
1   -{
2   - "images" : [
3   - {
4   - "idiom" : "iphone",
5   - "size" : "20x20",
6   - "scale" : "2x"
7   - },
8   - {
9   - "idiom" : "iphone",
10   - "size" : "20x20",
11   - "scale" : "3x"
12   - },
13   - {
14   - "idiom" : "iphone",
15   - "size" : "29x29",
16   - "scale" : "2x"
17   - },
18   - {
19   - "idiom" : "iphone",
20   - "size" : "29x29",
21   - "scale" : "3x"
22   - },
23   - {
24   - "idiom" : "iphone",
25   - "size" : "40x40",
26   - "scale" : "2x"
27   - },
28   - {
29   - "idiom" : "iphone",
30   - "size" : "40x40",
31   - "scale" : "3x"
32   - },
33   - {
34   - "idiom" : "iphone",
35   - "size" : "60x60",
36   - "scale" : "2x"
37   - },
38   - {
39   - "idiom" : "iphone",
40   - "size" : "60x60",
41   - "scale" : "3x"
42   - },
43   - {
44   - "idiom" : "ipad",
45   - "size" : "20x20",
46   - "scale" : "1x"
47   - },
48   - {
49   - "idiom" : "ipad",
50   - "size" : "20x20",
51   - "scale" : "2x"
52   - },
53   - {
54   - "idiom" : "ipad",
55   - "size" : "29x29",
56   - "scale" : "1x"
57   - },
58   - {
59   - "idiom" : "ipad",
60   - "size" : "29x29",
61   - "scale" : "2x"
62   - },
63   - {
64   - "idiom" : "ipad",
65   - "size" : "40x40",
66   - "scale" : "1x"
67   - },
68   - {
69   - "idiom" : "ipad",
70   - "size" : "40x40",
71   - "scale" : "2x"
72   - },
73   - {
74   - "idiom" : "ipad",
75   - "size" : "76x76",
76   - "scale" : "1x"
77   - },
78   - {
79   - "idiom" : "ipad",
80   - "size" : "76x76",
81   - "scale" : "2x"
82   - },
83   - {
84   - "idiom" : "ipad",
85   - "size" : "83.5x83.5",
86   - "scale" : "2x"
87   - },
88   - {
89   - "idiom" : "ios-marketing",
90   - "size" : "1024x1024",
91   - "scale" : "1x"
92   - }
93   - ],
94   - "info" : {
95   - "version" : 1,
96   - "author" : "xcode"
97   - }
98   -}
CNPublishContent/Example/CNPublishContent/en.lproj/InfoPlist.strings deleted 100644 → 0
1   -/* Localized versions of Info.plist keys */
2   -
CNPublishContent/Example/CNPublishContent/main.m deleted 100644 → 0
1   -//
2   -// main.m
3   -// CNPublishContent
4   -//
5   -// Created by 殷巧娟 on 12/04/2018.
6   -// Copyright (c) 2018 殷巧娟. All rights reserved.
7   -//
8   -
9   -@import UIKit;
10   -#import "CNLiveAppDelegate.h"
11   -
12   -int main(int argc, char * argv[])
13   -{
14   - @autoreleasepool {
15   - return UIApplicationMain(argc, argv, nil, NSStringFromClass([CNLiveAppDelegate class]));
16   - }
17   -}
CNPublishContent/Example/Podfile deleted 100644 → 0
1   -use_frameworks!
2   -
3   -target 'CNPublishContent_Example' do
4   - pod 'CNPublishContent', :path => '../'
5   -
6   - pod 'AFNetworking'
7   -
8   - target 'CNPublishContent_Tests' do
9   - inherit! :search_paths
10   - pod 'AFNetworking'
11   -
12   - end
13   -end
CNPublishContent/Example/Podfile.lock deleted 100644 → 0
1   -PODS:
2   - - AFNetworking (3.2.1):
3   - - AFNetworking/NSURLSession (= 3.2.1)
4   - - AFNetworking/Reachability (= 3.2.1)
5   - - AFNetworking/Security (= 3.2.1)
6   - - AFNetworking/Serialization (= 3.2.1)
7   - - AFNetworking/UIKit (= 3.2.1)
8   - - AFNetworking/NSURLSession (3.2.1):
9   - - AFNetworking/Reachability
10   - - AFNetworking/Security
11   - - AFNetworking/Serialization
12   - - AFNetworking/Reachability (3.2.1)
13   - - AFNetworking/Security (3.2.1)
14   - - AFNetworking/Serialization (3.2.1)
15   - - AFNetworking/UIKit (3.2.1):
16   - - AFNetworking/NSURLSession
17   - - CNPublishContent (0.1.0):
18   - - AFNetworking
19   -
20   -DEPENDENCIES:
21   - - AFNetworking
22   - - CNPublishContent (from `../`)
23   -
24   -SPEC REPOS:
25   - https://github.com/cocoapods/specs.git:
26   - - AFNetworking
27   -
28   -EXTERNAL SOURCES:
29   - CNPublishContent:
30   - :path: "../"
31   -
32   -SPEC CHECKSUMS:
33   - AFNetworking: b6f891fdfaed196b46c7a83cf209e09697b94057
34   - CNPublishContent: a221238bf92355bdc6d162edeabf75f348ad1fed
35   -
36   -PODFILE CHECKSUM: 4c688f95fc5fb49002aa5405034220e1c5ccd4fa
37   -
38   -COCOAPODS: 1.5.3
CNPublishContent/Example/Pods/AFNetworking/AFNetworking/AFCompatibilityMacros.h deleted 100644 → 0
1   -// AFCompatibilityMacros.h
2   -// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
3   -//
4   -// Permission is hereby granted, free of charge, to any person obtaining a copy
5   -// of this software and associated documentation files (the "Software"), to deal
6   -// in the Software without restriction, including without limitation the rights
7   -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8   -// copies of the Software, and to permit persons to whom the Software is
9   -// furnished to do so, subject to the following conditions:
10   -//
11   -// The above copyright notice and this permission notice shall be included in
12   -// all copies or substantial portions of the Software.
13   -//
14   -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20   -// THE SOFTWARE.
21   -
22   -#ifndef AFCompatibilityMacros_h
23   -#define AFCompatibilityMacros_h
24   -
25   -#ifdef API_UNAVAILABLE
26   - #define AF_API_UNAVAILABLE(x) API_UNAVAILABLE(x)
27   -#else
28   - #define AF_API_UNAVAILABLE(x)
29   -#endif // API_UNAVAILABLE
30   -
31   -#if __has_warning("-Wunguarded-availability-new")
32   - #define AF_CAN_USE_AT_AVAILABLE 1
33   -#else
34   - #define AF_CAN_USE_AT_AVAILABLE 0
35   -#endif
36   -
37   -#endif /* AFCompatibilityMacros_h */
CNPublishContent/Example/Pods/AFNetworking/AFNetworking/AFHTTPSessionManager.h deleted 100644 → 0
1   -// AFHTTPSessionManager.h
2   -// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
3   -//
4   -// Permission is hereby granted, free of charge, to any person obtaining a copy
5   -// of this software and associated documentation files (the "Software"), to deal
6   -// in the Software without restriction, including without limitation the rights
7   -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8   -// copies of the Software, and to permit persons to whom the Software is
9   -// furnished to do so, subject to the following conditions:
10   -//
11   -// The above copyright notice and this permission notice shall be included in
12   -// all copies or substantial portions of the Software.
13   -//
14   -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20   -// THE SOFTWARE.
21   -
22   -#import <Foundation/Foundation.h>
23   -#if !TARGET_OS_WATCH
24   -#import <SystemConfiguration/SystemConfiguration.h>
25   -#endif
26   -#import <TargetConditionals.h>
27   -
28   -#if TARGET_OS_IOS || TARGET_OS_WATCH || TARGET_OS_TV
29   -#import <MobileCoreServices/MobileCoreServices.h>
30   -#else
31   -#import <CoreServices/CoreServices.h>
32   -#endif
33   -
34   -#import "AFURLSessionManager.h"
35   -
36   -/**
37   - `AFHTTPSessionManager` is a subclass of `AFURLSessionManager` with convenience methods for making HTTP requests. When a `baseURL` is provided, requests made with the `GET` / `POST` / et al. convenience methods can be made with relative paths.
38   -
39   - ## Subclassing Notes
40   -
41   - Developers targeting iOS 7 or Mac OS X 10.9 or later that deal extensively with a web service are encouraged to subclass `AFHTTPSessionManager`, providing a class method that returns a shared singleton object on which authentication and other configuration can be shared across the application.
42   -
43   - For developers targeting iOS 6 or Mac OS X 10.8 or earlier, `AFHTTPRequestOperationManager` may be used to similar effect.
44   -
45   - ## Methods to Override
46   -
47   - To change the behavior of all data task operation construction, which is also used in the `GET` / `POST` / et al. convenience methods, override `dataTaskWithRequest:uploadProgress:downloadProgress:completionHandler:`.
48   -
49   - ## Serialization
50   -
51   - Requests created by an HTTP client will contain default headers and encode parameters according to the `requestSerializer` property, which is an object conforming to `<AFURLRequestSerialization>`.
52   -
53   - Responses received from the server are automatically validated and serialized by the `responseSerializers` property, which is an object conforming to `<AFURLResponseSerialization>`
54   -
55   - ## URL Construction Using Relative Paths
56   -
57   - For HTTP convenience methods, the request serializer constructs URLs from the path relative to the `-baseURL`, using `NSURL +URLWithString:relativeToURL:`, when provided. If `baseURL` is `nil`, `path` needs to resolve to a valid `NSURL` object using `NSURL +URLWithString:`.
58   -
59   - Below are a few examples of how `baseURL` and relative paths interact:
60   -
61   - NSURL *baseURL = [NSURL URLWithString:@"http://example.com/v1/"];
62   - [NSURL URLWithString:@"foo" relativeToURL:baseURL]; // http://example.com/v1/foo
63   - [NSURL URLWithString:@"foo?bar=baz" relativeToURL:baseURL]; // http://example.com/v1/foo?bar=baz
64   - [NSURL URLWithString:@"/foo" relativeToURL:baseURL]; // http://example.com/foo
65   - [NSURL URLWithString:@"foo/" relativeToURL:baseURL]; // http://example.com/v1/foo
66   - [NSURL URLWithString:@"/foo/" relativeToURL:baseURL]; // http://example.com/foo/
67   - [NSURL URLWithString:@"http://example2.com/" relativeToURL:baseURL]; // http://example2.com/
68   -
69   - Also important to note is that a trailing slash will be added to any `baseURL` without one. This would otherwise cause unexpected behavior when constructing URLs using paths without a leading slash.
70   -
71   - @warning Managers for background sessions must be owned for the duration of their use. This can be accomplished by creating an application-wide or shared singleton instance.
72   - */
73   -
74   -NS_ASSUME_NONNULL_BEGIN
75   -
76   -@interface AFHTTPSessionManager : AFURLSessionManager <NSSecureCoding, NSCopying>
77   -
78   -/**
79   - The URL used to construct requests from relative paths in methods like `requestWithMethod:URLString:parameters:`, and the `GET` / `POST` / et al. convenience methods.
80   - */
81   -@property (readonly, nonatomic, strong, nullable) NSURL *baseURL;
82   -
83   -/**
84   - Requests created with `requestWithMethod:URLString:parameters:` & `multipartFormRequestWithMethod:URLString:parameters:constructingBodyWithBlock:` are constructed with a set of default headers using a parameter serialization specified by this property. By default, this is set to an instance of `AFHTTPRequestSerializer`, which serializes query string parameters for `GET`, `HEAD`, and `DELETE` requests, or otherwise URL-form-encodes HTTP message bodies.
85   -
86   - @warning `requestSerializer` must not be `nil`.
87   - */
88   -@property (nonatomic, strong) AFHTTPRequestSerializer <AFURLRequestSerialization> * requestSerializer;
89   -
90   -/**
91   - Responses sent from the server in data tasks created with `dataTaskWithRequest:success:failure:` and run using the `GET` / `POST` / et al. convenience methods are automatically validated and serialized by the response serializer. By default, this property is set to an instance of `AFJSONResponseSerializer`.
92   -
93   - @warning `responseSerializer` must not be `nil`.
94   - */
95   -@property (nonatomic, strong) AFHTTPResponseSerializer <AFURLResponseSerialization> * responseSerializer;
96   -
97   -///-------------------------------
98   -/// @name Managing Security Policy
99   -///-------------------------------
100   -
101   -/**
102   - The security policy used by created session to evaluate server trust for secure connections. `AFURLSessionManager` uses the `defaultPolicy` unless otherwise specified. A security policy configured with `AFSSLPinningModePublicKey` or `AFSSLPinningModeCertificate` can only be applied on a session manager initialized with a secure base URL (i.e. https). Applying a security policy with pinning enabled on an insecure session manager throws an `Invalid Security Policy` exception.
103   - */
104   -@property (nonatomic, strong) AFSecurityPolicy *securityPolicy;
105   -
106   -///---------------------
107   -/// @name Initialization
108   -///---------------------
109   -
110   -/**
111   - Creates and returns an `AFHTTPSessionManager` object.
112   - */
113   -+ (instancetype)manager;
114   -
115   -/**
116   - Initializes an `AFHTTPSessionManager` object with the specified base URL.
117   -
118   - @param url The base URL for the HTTP client.
119   -
120   - @return The newly-initialized HTTP client
121   - */
122   -- (instancetype)initWithBaseURL:(nullable NSURL *)url;
123   -
124   -/**
125   - Initializes an `AFHTTPSessionManager` object with the specified base URL.
126   -
127   - This is the designated initializer.
128   -
129   - @param url The base URL for the HTTP client.
130   - @param configuration The configuration used to create the managed session.
131   -
132   - @return The newly-initialized HTTP client
133   - */
134   -- (instancetype)initWithBaseURL:(nullable NSURL *)url
135   - sessionConfiguration:(nullable NSURLSessionConfiguration *)configuration NS_DESIGNATED_INITIALIZER;
136   -
137   -///---------------------------
138   -/// @name Making HTTP Requests
139   -///---------------------------
140   -
141   -/**
142   - Creates and runs an `NSURLSessionDataTask` with a `GET` request.
143   -
144   - @param URLString The URL string used to create the request URL.
145   - @param parameters The parameters to be encoded according to the client request serializer.
146   - @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer.
147   - @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred.
148   -
149   - @see -dataTaskWithRequest:completionHandler:
150   - */
151   -- (nullable NSURLSessionDataTask *)GET:(NSString *)URLString
152   - parameters:(nullable id)parameters
153   - success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success
154   - failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure DEPRECATED_ATTRIBUTE;
155   -
156   -
157   -/**
158   - Creates and runs an `NSURLSessionDataTask` with a `GET` request.
159   -
160   - @param URLString The URL string used to create the request URL.
161   - @param parameters The parameters to be encoded according to the client request serializer.
162   - @param downloadProgress A block object to be executed when the download progress is updated. Note this block is called on the session queue, not the main queue.
163   - @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer.
164   - @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred.
165   -
166   - @see -dataTaskWithRequest:uploadProgress:downloadProgress:completionHandler:
167   - */
168   -- (nullable NSURLSessionDataTask *)GET:(NSString *)URLString
169   - parameters:(nullable id)parameters
170   - progress:(nullable void (^)(NSProgress *downloadProgress))downloadProgress
171   - success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success
172   - failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure;
173   -
174   -/**
175   - Creates and runs an `NSURLSessionDataTask` with a `HEAD` request.
176   -
177   - @param URLString The URL string used to create the request URL.
178   - @param parameters The parameters to be encoded according to the client request serializer.
179   - @param success A block object to be executed when the task finishes successfully. This block has no return value and takes a single arguments: the data task.
180   - @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred.
181   -
182   - @see -dataTaskWithRequest:completionHandler:
183   - */
184   -- (nullable NSURLSessionDataTask *)HEAD:(NSString *)URLString
185   - parameters:(nullable id)parameters
186   - success:(nullable void (^)(NSURLSessionDataTask *task))success
187   - failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure;
188   -
189   -/**
190   - Creates and runs an `NSURLSessionDataTask` with a `POST` request.
191   -
192   - @param URLString The URL string used to create the request URL.
193   - @param parameters The parameters to be encoded according to the client request serializer.
194   - @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer.
195   - @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred.
196   -
197   - @see -dataTaskWithRequest:completionHandler:
198   - */
199   -- (nullable NSURLSessionDataTask *)POST:(NSString *)URLString
200   - parameters:(nullable id)parameters
201   - success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success
202   - failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure DEPRECATED_ATTRIBUTE;
203   -
204   -/**
205   - Creates and runs an `NSURLSessionDataTask` with a `POST` request.
206   -
207   - @param URLString The URL string used to create the request URL.
208   - @param parameters The parameters to be encoded according to the client request serializer.
209   - @param uploadProgress A block object to be executed when the upload progress is updated. Note this block is called on the session queue, not the main queue.
210   - @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer.
211   - @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred.
212   -
213   - @see -dataTaskWithRequest:uploadProgress:downloadProgress:completionHandler:
214   - */
215   -- (nullable NSURLSessionDataTask *)POST:(NSString *)URLString
216   - parameters:(nullable id)parameters
217   - progress:(nullable void (^)(NSProgress *uploadProgress))uploadProgress
218   - success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success
219   - failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure;
220   -
221   -/**
222   - Creates and runs an `NSURLSessionDataTask` with a multipart `POST` request.
223   -
224   - @param URLString The URL string used to create the request URL.
225   - @param parameters The parameters to be encoded according to the client request serializer.
226   - @param block A block that takes a single argument and appends data to the HTTP body. The block argument is an object adopting the `AFMultipartFormData` protocol.
227   - @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer.
228   - @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred.
229   -
230   - @see -dataTaskWithRequest:completionHandler:
231   - */
232   -- (nullable NSURLSessionDataTask *)POST:(NSString *)URLString
233   - parameters:(nullable id)parameters
234   - constructingBodyWithBlock:(nullable void (^)(id <AFMultipartFormData> formData))block
235   - success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success
236   - failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure DEPRECATED_ATTRIBUTE;
237   -
238   -/**
239   - Creates and runs an `NSURLSessionDataTask` with a multipart `POST` request.
240   -
241   - @param URLString The URL string used to create the request URL.
242   - @param parameters The parameters to be encoded according to the client request serializer.
243   - @param block A block that takes a single argument and appends data to the HTTP body. The block argument is an object adopting the `AFMultipartFormData` protocol.
244   - @param uploadProgress A block object to be executed when the upload progress is updated. Note this block is called on the session queue, not the main queue.
245   - @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer.
246   - @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred.
247   -
248   - @see -dataTaskWithRequest:uploadProgress:downloadProgress:completionHandler:
249   - */
250   -- (nullable NSURLSessionDataTask *)POST:(NSString *)URLString
251   - parameters:(nullable id)parameters
252   - constructingBodyWithBlock:(nullable void (^)(id <AFMultipartFormData> formData))block
253   - progress:(nullable void (^)(NSProgress *uploadProgress))uploadProgress
254   - success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success
255   - failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure;
256   -
257   -/**
258   - Creates and runs an `NSURLSessionDataTask` with a `PUT` request.
259   -
260   - @param URLString The URL string used to create the request URL.
261   - @param parameters The parameters to be encoded according to the client request serializer.
262   - @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer.
263   - @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred.
264   -
265   - @see -dataTaskWithRequest:completionHandler:
266   - */
267   -- (nullable NSURLSessionDataTask *)PUT:(NSString *)URLString
268   - parameters:(nullable id)parameters
269   - success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success
270   - failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure;
271   -
272   -/**
273   - Creates and runs an `NSURLSessionDataTask` with a `PATCH` request.
274   -
275   - @param URLString The URL string used to create the request URL.
276   - @param parameters The parameters to be encoded according to the client request serializer.
277   - @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer.
278   - @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred.
279   -
280   - @see -dataTaskWithRequest:completionHandler:
281   - */
282   -- (nullable NSURLSessionDataTask *)PATCH:(NSString *)URLString
283   - parameters:(nullable id)parameters
284   - success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success
285   - failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure;
286   -
287   -/**
288   - Creates and runs an `NSURLSessionDataTask` with a `DELETE` request.
289   -
290   - @param URLString The URL string used to create the request URL.
291   - @param parameters The parameters to be encoded according to the client request serializer.
292   - @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer.
293   - @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred.
294   -
295   - @see -dataTaskWithRequest:completionHandler:
296   - */
297   -- (nullable NSURLSessionDataTask *)DELETE:(NSString *)URLString
298   - parameters:(nullable id)parameters
299   - success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success
300   - failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure;
301   -
302   -@end
303   -
304   -NS_ASSUME_NONNULL_END
CNPublishContent/Example/Pods/AFNetworking/AFNetworking/AFHTTPSessionManager.m deleted 100644 → 0
1   -// AFHTTPSessionManager.m
2   -// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
3   -//
4   -// Permission is hereby granted, free of charge, to any person obtaining a copy
5   -// of this software and associated documentation files (the "Software"), to deal
6   -// in the Software without restriction, including without limitation the rights
7   -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8   -// copies of the Software, and to permit persons to whom the Software is
9   -// furnished to do so, subject to the following conditions:
10   -//
11   -// The above copyright notice and this permission notice shall be included in
12   -// all copies or substantial portions of the Software.
13   -//
14   -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20   -// THE SOFTWARE.
21   -
22   -#import "AFHTTPSessionManager.h"
23   -
24   -#import "AFURLRequestSerialization.h"
25   -#import "AFURLResponseSerialization.h"
26   -
27   -#import <Availability.h>
28   -#import <TargetConditionals.h>
29   -#import <Security/Security.h>
30   -
31   -#import <netinet/in.h>
32   -#import <netinet6/in6.h>
33   -#import <arpa/inet.h>
34   -#import <ifaddrs.h>
35   -#import <netdb.h>
36   -
37   -#if TARGET_OS_IOS || TARGET_OS_TV
38   -#import <UIKit/UIKit.h>
39   -#elif TARGET_OS_WATCH
40   -#import <WatchKit/WatchKit.h>
41   -#endif
42   -
43   -@interface AFHTTPSessionManager ()
44   -@property (readwrite, nonatomic, strong) NSURL *baseURL;
45   -@end
46   -
47   -@implementation AFHTTPSessionManager
48   -@dynamic responseSerializer;
49   -
50   -+ (instancetype)manager {
51   - return [[[self class] alloc] initWithBaseURL:nil];
52   -}
53   -
54   -- (instancetype)init {
55   - return [self initWithBaseURL:nil];
56   -}
57   -
58   -- (instancetype)initWithBaseURL:(NSURL *)url {
59   - return [self initWithBaseURL:url sessionConfiguration:nil];
60   -}
61   -
62   -- (instancetype)initWithSessionConfiguration:(NSURLSessionConfiguration *)configuration {
63   - return [self initWithBaseURL:nil sessionConfiguration:configuration];
64   -}
65   -
66   -- (instancetype)initWithBaseURL:(NSURL *)url
67   - sessionConfiguration:(NSURLSessionConfiguration *)configuration
68   -{
69   - self = [super initWithSessionConfiguration:configuration];
70   - if (!self) {
71   - return nil;
72   - }
73   -
74   - // Ensure terminal slash for baseURL path, so that NSURL +URLWithString:relativeToURL: works as expected
75   - if ([[url path] length] > 0 && ![[url absoluteString] hasSuffix:@"/"]) {
76   - url = [url URLByAppendingPathComponent:@""];
77   - }
78   -
79   - self.baseURL = url;
80   -
81   - self.requestSerializer = [AFHTTPRequestSerializer serializer];
82   - self.responseSerializer = [AFJSONResponseSerializer serializer];
83   -
84   - return self;
85   -}
86   -
87   -#pragma mark -
88   -
89   -- (void)setRequestSerializer:(AFHTTPRequestSerializer <AFURLRequestSerialization> *)requestSerializer {
90   - NSParameterAssert(requestSerializer);
91   -
92   - _requestSerializer = requestSerializer;
93   -}
94   -
95   -- (void)setResponseSerializer:(AFHTTPResponseSerializer <AFURLResponseSerialization> *)responseSerializer {
96   - NSParameterAssert(responseSerializer);
97   -
98   - [super setResponseSerializer:responseSerializer];
99   -}
100   -
101   -@dynamic securityPolicy;
102   -
103   -- (void)setSecurityPolicy:(AFSecurityPolicy *)securityPolicy {
104   - if (securityPolicy.SSLPinningMode != AFSSLPinningModeNone && ![self.baseURL.scheme isEqualToString:@"https"]) {
105   - NSString *pinningMode = @"Unknown Pinning Mode";
106   - switch (securityPolicy.SSLPinningMode) {
107   - case AFSSLPinningModeNone: pinningMode = @"AFSSLPinningModeNone"; break;
108   - case AFSSLPinningModeCertificate: pinningMode = @"AFSSLPinningModeCertificate"; break;
109   - case AFSSLPinningModePublicKey: pinningMode = @"AFSSLPinningModePublicKey"; break;
110   - }
111   - NSString *reason = [NSString stringWithFormat:@"A security policy configured with `%@` can only be applied on a manager with a secure base URL (i.e. https)", pinningMode];
112   - @throw [NSException exceptionWithName:@"Invalid Security Policy" reason:reason userInfo:nil];
113   - }
114   -
115   - [super setSecurityPolicy:securityPolicy];
116   -}
117   -
118   -#pragma mark -
119   -
120   -- (NSURLSessionDataTask *)GET:(NSString *)URLString
121   - parameters:(id)parameters
122   - success:(void (^)(NSURLSessionDataTask *task, id responseObject))success
123   - failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure
124   -{
125   -
126   - return [self GET:URLString parameters:parameters progress:nil success:success failure:failure];
127   -}
128   -
129   -- (NSURLSessionDataTask *)GET:(NSString *)URLString
130   - parameters:(id)parameters
131   - progress:(void (^)(NSProgress * _Nonnull))downloadProgress
132   - success:(void (^)(NSURLSessionDataTask * _Nonnull, id _Nullable))success
133   - failure:(void (^)(NSURLSessionDataTask * _Nullable, NSError * _Nonnull))failure
134   -{
135   -
136   - NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@"GET"
137   - URLString:URLString
138   - parameters:parameters
139   - uploadProgress:nil
140   - downloadProgress:downloadProgress
141   - success:success
142   - failure:failure];
143   -
144   - [dataTask resume];
145   -
146   - return dataTask;
147   -}
148   -
149   -- (NSURLSessionDataTask *)HEAD:(NSString *)URLString
150   - parameters:(id)parameters
151   - success:(void (^)(NSURLSessionDataTask *task))success
152   - failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure
153   -{
154   - NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@"HEAD" URLString:URLString parameters:parameters uploadProgress:nil downloadProgress:nil success:^(NSURLSessionDataTask *task, __unused id responseObject) {
155   - if (success) {
156   - success(task);
157   - }
158   - } failure:failure];
159   -
160   - [dataTask resume];
161   -
162   - return dataTask;
163   -}
164   -
165   -- (NSURLSessionDataTask *)POST:(NSString *)URLString
166   - parameters:(id)parameters
167   - success:(void (^)(NSURLSessionDataTask *task, id responseObject))success
168   - failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure
169   -{
170   - return [self POST:URLString parameters:parameters progress:nil success:success failure:failure];
171   -}
172   -
173   -- (NSURLSessionDataTask *)POST:(NSString *)URLString
174   - parameters:(id)parameters
175   - progress:(void (^)(NSProgress * _Nonnull))uploadProgress
176   - success:(void (^)(NSURLSessionDataTask * _Nonnull, id _Nullable))success
177   - failure:(void (^)(NSURLSessionDataTask * _Nullable, NSError * _Nonnull))failure
178   -{
179   - NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@"POST" URLString:URLString parameters:parameters uploadProgress:uploadProgress downloadProgress:nil success:success failure:failure];
180   -
181   - [dataTask resume];
182   -
183   - return dataTask;
184   -}
185   -
186   -- (NSURLSessionDataTask *)POST:(NSString *)URLString
187   - parameters:(nullable id)parameters
188   - constructingBodyWithBlock:(nullable void (^)(id<AFMultipartFormData> _Nonnull))block
189   - success:(nullable void (^)(NSURLSessionDataTask * _Nonnull, id _Nullable))success
190   - failure:(nullable void (^)(NSURLSessionDataTask * _Nullable, NSError * _Nonnull))failure
191   -{
192   - return [self POST:URLString parameters:parameters constructingBodyWithBlock:block progress:nil success:success failure:failure];
193   -}
194   -
195   -- (NSURLSessionDataTask *)POST:(NSString *)URLString
196   - parameters:(id)parameters
197   - constructingBodyWithBlock:(void (^)(id <AFMultipartFormData> formData))block
198   - progress:(nullable void (^)(NSProgress * _Nonnull))uploadProgress
199   - success:(void (^)(NSURLSessionDataTask *task, id responseObject))success
200   - failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure
201   -{
202   - NSError *serializationError = nil;
203   - NSMutableURLRequest *request = [self.requestSerializer multipartFormRequestWithMethod:@"POST" URLString:[[NSURL URLWithString:URLString relativeToURL:self.baseURL] absoluteString] parameters:parameters constructingBodyWithBlock:block error:&serializationError];
204   - if (serializationError) {
205   - if (failure) {
206   - dispatch_async(self.completionQueue ?: dispatch_get_main_queue(), ^{
207   - failure(nil, serializationError);
208   - });
209   - }
210   -
211   - return nil;
212   - }
213   -
214   - __block NSURLSessionDataTask *task = [self uploadTaskWithStreamedRequest:request progress:uploadProgress completionHandler:^(NSURLResponse * __unused response, id responseObject, NSError *error) {
215   - if (error) {
216   - if (failure) {
217   - failure(task, error);
218   - }
219   - } else {
220   - if (success) {
221   - success(task, responseObject);
222   - }
223   - }
224   - }];
225   -
226   - [task resume];
227   -
228   - return task;
229   -}
230   -
231   -- (NSURLSessionDataTask *)PUT:(NSString *)URLString
232   - parameters:(id)parameters
233   - success:(void (^)(NSURLSessionDataTask *task, id responseObject))success
234   - failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure
235   -{
236   - NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@"PUT" URLString:URLString parameters:parameters uploadProgress:nil downloadProgress:nil success:success failure:failure];
237   -
238   - [dataTask resume];
239   -
240   - return dataTask;
241   -}
242   -
243   -- (NSURLSessionDataTask *)PATCH:(NSString *)URLString
244   - parameters:(id)parameters
245   - success:(void (^)(NSURLSessionDataTask *task, id responseObject))success
246   - failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure
247   -{
248   - NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@"PATCH" URLString:URLString parameters:parameters uploadProgress:nil downloadProgress:nil success:success failure:failure];
249   -
250   - [dataTask resume];
251   -
252   - return dataTask;
253   -}
254   -
255   -- (NSURLSessionDataTask *)DELETE:(NSString *)URLString
256   - parameters:(id)parameters
257   - success:(void (^)(NSURLSessionDataTask *task, id responseObject))success
258   - failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure
259   -{
260   - NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@"DELETE" URLString:URLString parameters:parameters uploadProgress:nil downloadProgress:nil success:success failure:failure];
261   -
262   - [dataTask resume];
263   -
264   - return dataTask;
265   -}
266   -
267   -- (NSURLSessionDataTask *)dataTaskWithHTTPMethod:(NSString *)method
268   - URLString:(NSString *)URLString
269   - parameters:(id)parameters
270   - uploadProgress:(nullable void (^)(NSProgress *uploadProgress)) uploadProgress
271   - downloadProgress:(nullable void (^)(NSProgress *downloadProgress)) downloadProgress
272   - success:(void (^)(NSURLSessionDataTask *, id))success
273   - failure:(void (^)(NSURLSessionDataTask *, NSError *))failure
274   -{
275   - NSError *serializationError = nil;
276   - NSMutableURLRequest *request = [self.requestSerializer requestWithMethod:method URLString:[[NSURL URLWithString:URLString relativeToURL:self.baseURL] absoluteString] parameters:parameters error:&serializationError];
277   - if (serializationError) {
278   - if (failure) {
279   - dispatch_async(self.completionQueue ?: dispatch_get_main_queue(), ^{
280   - failure(nil, serializationError);
281   - });
282   - }
283   -
284   - return nil;
285   - }
286   -
287   - __block NSURLSessionDataTask *dataTask = nil;
288   - dataTask = [self dataTaskWithRequest:request
289   - uploadProgress:uploadProgress
290   - downloadProgress:downloadProgress
291   - completionHandler:^(NSURLResponse * __unused response, id responseObject, NSError *error) {
292   - if (error) {
293   - if (failure) {
294   - failure(dataTask, error);
295   - }
296   - } else {
297   - if (success) {
298   - success(dataTask, responseObject);
299   - }
300   - }
301   - }];
302   -
303   - return dataTask;
304   -}
305   -
306   -#pragma mark - NSObject
307   -
308   -- (NSString *)description {
309   - return [NSString stringWithFormat:@"<%@: %p, baseURL: %@, session: %@, operationQueue: %@>", NSStringFromClass([self class]), self, [self.baseURL absoluteString], self.session, self.operationQueue];
310   -}
311   -
312   -#pragma mark - NSSecureCoding
313   -
314   -+ (BOOL)supportsSecureCoding {
315   - return YES;
316   -}
317   -
318   -- (instancetype)initWithCoder:(NSCoder *)decoder {
319   - NSURL *baseURL = [decoder decodeObjectOfClass:[NSURL class] forKey:NSStringFromSelector(@selector(baseURL))];
320   - NSURLSessionConfiguration *configuration = [decoder decodeObjectOfClass:[NSURLSessionConfiguration class] forKey:@"sessionConfiguration"];
321   - if (!configuration) {
322   - NSString *configurationIdentifier = [decoder decodeObjectOfClass:[NSString class] forKey:@"identifier"];
323   - if (configurationIdentifier) {
324   -#if (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1100)
325   - configuration = [NSURLSessionConfiguration backgroundSessionConfigurationWithIdentifier:configurationIdentifier];
326   -#else
327   - configuration = [NSURLSessionConfiguration backgroundSessionConfiguration:configurationIdentifier];
328   -#endif
329   - }
330   - }
331   -
332   - self = [self initWithBaseURL:baseURL sessionConfiguration:configuration];
333   - if (!self) {
334   - return nil;
335   - }
336   -
337   - self.requestSerializer = [decoder decodeObjectOfClass:[AFHTTPRequestSerializer class] forKey:NSStringFromSelector(@selector(requestSerializer))];
338   - self.responseSerializer = [decoder decodeObjectOfClass:[AFHTTPResponseSerializer class] forKey:NSStringFromSelector(@selector(responseSerializer))];
339   - AFSecurityPolicy *decodedPolicy = [decoder decodeObjectOfClass:[AFSecurityPolicy class] forKey:NSStringFromSelector(@selector(securityPolicy))];
340   - if (decodedPolicy) {
341   - self.securityPolicy = decodedPolicy;
342   - }
343   -
344   - return self;
345   -}
346   -
347   -- (void)encodeWithCoder:(NSCoder *)coder {
348   - [super encodeWithCoder:coder];
349   -
350   - [coder encodeObject:self.baseURL forKey:NSStringFromSelector(@selector(baseURL))];
351   - if ([self.session.configuration conformsToProtocol:@protocol(NSCoding)]) {
352   - [coder encodeObject:self.session.configuration forKey:@"sessionConfiguration"];
353   - } else {
354   - [coder encodeObject:self.session.configuration.identifier forKey:@"identifier"];
355   - }
356   - [coder encodeObject:self.requestSerializer forKey:NSStringFromSelector(@selector(requestSerializer))];
357   - [coder encodeObject:self.responseSerializer forKey:NSStringFromSelector(@selector(responseSerializer))];
358   - [coder encodeObject:self.securityPolicy forKey:NSStringFromSelector(@selector(securityPolicy))];
359   -}
360   -
361   -#pragma mark - NSCopying
362   -
363   -- (instancetype)copyWithZone:(NSZone *)zone {
364   - AFHTTPSessionManager *HTTPClient = [[[self class] allocWithZone:zone] initWithBaseURL:self.baseURL sessionConfiguration:self.session.configuration];
365   -
366   - HTTPClient.requestSerializer = [self.requestSerializer copyWithZone:zone];
367   - HTTPClient.responseSerializer = [self.responseSerializer copyWithZone:zone];
368   - HTTPClient.securityPolicy = [self.securityPolicy copyWithZone:zone];
369   - return HTTPClient;
370   -}
371   -
372   -@end
CNPublishContent/Example/Pods/AFNetworking/AFNetworking/AFNetworkReachabilityManager.h deleted 100644 → 0
1   -// AFNetworkReachabilityManager.h
2   -// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
3   -//
4   -// Permission is hereby granted, free of charge, to any person obtaining a copy
5   -// of this software and associated documentation files (the "Software"), to deal
6   -// in the Software without restriction, including without limitation the rights
7   -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8   -// copies of the Software, and to permit persons to whom the Software is
9   -// furnished to do so, subject to the following conditions:
10   -//
11   -// The above copyright notice and this permission notice shall be included in
12   -// all copies or substantial portions of the Software.
13   -//
14   -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20   -// THE SOFTWARE.
21   -
22   -#import <Foundation/Foundation.h>
23   -
24   -#if !TARGET_OS_WATCH
25   -#import <SystemConfiguration/SystemConfiguration.h>
26   -
27   -typedef NS_ENUM(NSInteger, AFNetworkReachabilityStatus) {
28   - AFNetworkReachabilityStatusUnknown = -1,
29   - AFNetworkReachabilityStatusNotReachable = 0,
30   - AFNetworkReachabilityStatusReachableViaWWAN = 1,
31   - AFNetworkReachabilityStatusReachableViaWiFi = 2,
32   -};
33   -
34   -NS_ASSUME_NONNULL_BEGIN
35   -
36   -/**
37   - `AFNetworkReachabilityManager` monitors the reachability of domains, and addresses for both WWAN and WiFi network interfaces.
38   -
39   - Reachability can be used to determine background information about why a network operation failed, or to trigger a network operation retrying when a connection is established. It should not be used to prevent a user from initiating a network request, as it's possible that an initial request may be required to establish reachability.
40   -
41   - See Apple's Reachability Sample Code ( https://developer.apple.com/library/ios/samplecode/reachability/ )
42   -
43   - @warning Instances of `AFNetworkReachabilityManager` must be started with `-startMonitoring` before reachability status can be determined.
44   - */
45   -@interface AFNetworkReachabilityManager : NSObject
46   -
47   -/**
48   - The current network reachability status.
49   - */
50   -@property (readonly, nonatomic, assign) AFNetworkReachabilityStatus networkReachabilityStatus;
51   -
52   -/**
53   - Whether or not the network is currently reachable.
54   - */
55   -@property (readonly, nonatomic, assign, getter = isReachable) BOOL reachable;
56   -
57   -/**
58   - Whether or not the network is currently reachable via WWAN.
59   - */
60   -@property (readonly, nonatomic, assign, getter = isReachableViaWWAN) BOOL reachableViaWWAN;
61   -
62   -/**
63   - Whether or not the network is currently reachable via WiFi.
64   - */
65   -@property (readonly, nonatomic, assign, getter = isReachableViaWiFi) BOOL reachableViaWiFi;
66   -
67   -///---------------------
68   -/// @name Initialization
69   -///---------------------
70   -
71   -/**
72   - Returns the shared network reachability manager.
73   - */
74   -+ (instancetype)sharedManager;
75   -
76   -/**
77   - Creates and returns a network reachability manager with the default socket address.
78   -
79   - @return An initialized network reachability manager, actively monitoring the default socket address.
80   - */
81   -+ (instancetype)manager;
82   -
83   -/**
84   - Creates and returns a network reachability manager for the specified domain.
85   -
86   - @param domain The domain used to evaluate network reachability.
87   -
88   - @return An initialized network reachability manager, actively monitoring the specified domain.
89   - */
90   -+ (instancetype)managerForDomain:(NSString *)domain;
91   -
92   -/**
93   - Creates and returns a network reachability manager for the socket address.
94   -
95   - @param address The socket address (`sockaddr_in6`) used to evaluate network reachability.
96   -
97   - @return An initialized network reachability manager, actively monitoring the specified socket address.
98   - */
99   -+ (instancetype)managerForAddress:(const void *)address;
100   -
101   -/**
102   - Initializes an instance of a network reachability manager from the specified reachability object.
103   -
104   - @param reachability The reachability object to monitor.
105   -
106   - @return An initialized network reachability manager, actively monitoring the specified reachability.
107   - */
108   -- (instancetype)initWithReachability:(SCNetworkReachabilityRef)reachability NS_DESIGNATED_INITIALIZER;
109   -
110   -/**
111   - * Unavailable initializer
112   - */
113   -+ (instancetype)new NS_UNAVAILABLE;
114   -
115   -/**
116   - * Unavailable initializer
117   - */
118   -- (instancetype)init NS_UNAVAILABLE;
119   -
120   -///--------------------------------------------------
121   -/// @name Starting & Stopping Reachability Monitoring
122   -///--------------------------------------------------
123   -
124   -/**
125   - Starts monitoring for changes in network reachability status.
126   - */
127   -- (void)startMonitoring;
128   -
129   -/**
130   - Stops monitoring for changes in network reachability status.
131   - */
132   -- (void)stopMonitoring;
133   -
134   -///-------------------------------------------------
135   -/// @name Getting Localized Reachability Description
136   -///-------------------------------------------------
137   -
138   -/**
139   - Returns a localized string representation of the current network reachability status.
140   - */
141   -- (NSString *)localizedNetworkReachabilityStatusString;
142   -
143   -///---------------------------------------------------
144   -/// @name Setting Network Reachability Change Callback
145   -///---------------------------------------------------
146   -
147   -/**
148   - Sets a callback to be executed when the network availability of the `baseURL` host changes.
149   -
150   - @param block A block object to be executed when the network availability of the `baseURL` host changes.. This block has no return value and takes a single argument which represents the various reachability states from the device to the `baseURL`.
151   - */
152   -- (void)setReachabilityStatusChangeBlock:(nullable void (^)(AFNetworkReachabilityStatus status))block;
153   -
154   -@end
155   -
156   -///----------------
157   -/// @name Constants
158   -///----------------
159   -
160   -/**
161   - ## Network Reachability
162   -
163   - The following constants are provided by `AFNetworkReachabilityManager` as possible network reachability statuses.
164   -
165   - enum {
166   - AFNetworkReachabilityStatusUnknown,
167   - AFNetworkReachabilityStatusNotReachable,
168   - AFNetworkReachabilityStatusReachableViaWWAN,
169   - AFNetworkReachabilityStatusReachableViaWiFi,
170   - }
171   -
172   - `AFNetworkReachabilityStatusUnknown`
173   - The `baseURL` host reachability is not known.
174   -
175   - `AFNetworkReachabilityStatusNotReachable`
176   - The `baseURL` host cannot be reached.
177   -
178   - `AFNetworkReachabilityStatusReachableViaWWAN`
179   - The `baseURL` host can be reached via a cellular connection, such as EDGE or GPRS.
180   -
181   - `AFNetworkReachabilityStatusReachableViaWiFi`
182   - The `baseURL` host can be reached via a Wi-Fi connection.
183   -
184   - ### Keys for Notification UserInfo Dictionary
185   -
186   - Strings that are used as keys in a `userInfo` dictionary in a network reachability status change notification.
187   -
188   - `AFNetworkingReachabilityNotificationStatusItem`
189   - A key in the userInfo dictionary in a `AFNetworkingReachabilityDidChangeNotification` notification.
190   - The corresponding value is an `NSNumber` object representing the `AFNetworkReachabilityStatus` value for the current reachability status.
191   - */
192   -
193   -///--------------------
194   -/// @name Notifications
195   -///--------------------
196   -
197   -/**
198   - Posted when network reachability changes.
199   - This notification assigns no notification object. The `userInfo` dictionary contains an `NSNumber` object under the `AFNetworkingReachabilityNotificationStatusItem` key, representing the `AFNetworkReachabilityStatus` value for the current network reachability.
200   -
201   - @warning In order for network reachability to be monitored, include the `SystemConfiguration` framework in the active target's "Link Binary With Library" build phase, and add `#import <SystemConfiguration/SystemConfiguration.h>` to the header prefix of the project (`Prefix.pch`).
202   - */
203   -FOUNDATION_EXPORT NSString * const AFNetworkingReachabilityDidChangeNotification;
204   -FOUNDATION_EXPORT NSString * const AFNetworkingReachabilityNotificationStatusItem;
205   -
206   -///--------------------
207   -/// @name Functions
208   -///--------------------
209   -
210   -/**
211   - Returns a localized string representation of an `AFNetworkReachabilityStatus` value.
212   - */
213   -FOUNDATION_EXPORT NSString * AFStringFromNetworkReachabilityStatus(AFNetworkReachabilityStatus status);
214   -
215   -NS_ASSUME_NONNULL_END
216   -#endif
CNPublishContent/Example/Pods/AFNetworking/AFNetworking/AFNetworkReachabilityManager.m deleted 100644 → 0
1   -// AFNetworkReachabilityManager.m
2   -// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
3   -//
4   -// Permission is hereby granted, free of charge, to any person obtaining a copy
5   -// of this software and associated documentation files (the "Software"), to deal
6   -// in the Software without restriction, including without limitation the rights
7   -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8   -// copies of the Software, and to permit persons to whom the Software is
9   -// furnished to do so, subject to the following conditions:
10   -//
11   -// The above copyright notice and this permission notice shall be included in
12   -// all copies or substantial portions of the Software.
13   -//
14   -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20   -// THE SOFTWARE.
21   -
22   -#import "AFNetworkReachabilityManager.h"
23   -#if !TARGET_OS_WATCH
24   -
25   -#import <netinet/in.h>
26   -#import <netinet6/in6.h>
27   -#import <arpa/inet.h>
28   -#import <ifaddrs.h>
29   -#import <netdb.h>
30   -
31   -NSString * const AFNetworkingReachabilityDidChangeNotification = @"com.alamofire.networking.reachability.change";
32   -NSString * const AFNetworkingReachabilityNotificationStatusItem = @"AFNetworkingReachabilityNotificationStatusItem";
33   -
34   -typedef void (^AFNetworkReachabilityStatusBlock)(AFNetworkReachabilityStatus status);
35   -
36   -NSString * AFStringFromNetworkReachabilityStatus(AFNetworkReachabilityStatus status) {
37   - switch (status) {
38   - case AFNetworkReachabilityStatusNotReachable:
39   - return NSLocalizedStringFromTable(@"Not Reachable", @"AFNetworking", nil);
40   - case AFNetworkReachabilityStatusReachableViaWWAN:
41   - return NSLocalizedStringFromTable(@"Reachable via WWAN", @"AFNetworking", nil);
42   - case AFNetworkReachabilityStatusReachableViaWiFi:
43   - return NSLocalizedStringFromTable(@"Reachable via WiFi", @"AFNetworking", nil);
44   - case AFNetworkReachabilityStatusUnknown:
45   - default:
46   - return NSLocalizedStringFromTable(@"Unknown", @"AFNetworking", nil);
47   - }
48   -}
49   -
50   -static AFNetworkReachabilityStatus AFNetworkReachabilityStatusForFlags(SCNetworkReachabilityFlags flags) {
51   - BOOL isReachable = ((flags & kSCNetworkReachabilityFlagsReachable) != 0);
52   - BOOL needsConnection = ((flags & kSCNetworkReachabilityFlagsConnectionRequired) != 0);
53   - BOOL canConnectionAutomatically = (((flags & kSCNetworkReachabilityFlagsConnectionOnDemand ) != 0) || ((flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) != 0));
54   - BOOL canConnectWithoutUserInteraction = (canConnectionAutomatically && (flags & kSCNetworkReachabilityFlagsInterventionRequired) == 0);
55   - BOOL isNetworkReachable = (isReachable && (!needsConnection || canConnectWithoutUserInteraction));
56   -
57   - AFNetworkReachabilityStatus status = AFNetworkReachabilityStatusUnknown;
58   - if (isNetworkReachable == NO) {
59   - status = AFNetworkReachabilityStatusNotReachable;
60   - }
61   -#if TARGET_OS_IPHONE
62   - else if ((flags & kSCNetworkReachabilityFlagsIsWWAN) != 0) {
63   - status = AFNetworkReachabilityStatusReachableViaWWAN;
64   - }
65   -#endif
66   - else {
67   - status = AFNetworkReachabilityStatusReachableViaWiFi;
68   - }
69   -
70   - return status;
71   -}
72   -
73   -/**
74   - * Queue a status change notification for the main thread.
75   - *
76   - * This is done to ensure that the notifications are received in the same order
77   - * as they are sent. If notifications are sent directly, it is possible that
78   - * a queued notification (for an earlier status condition) is processed after
79   - * the later update, resulting in the listener being left in the wrong state.
80   - */
81   -static void AFPostReachabilityStatusChange(SCNetworkReachabilityFlags flags, AFNetworkReachabilityStatusBlock block) {
82   - AFNetworkReachabilityStatus status = AFNetworkReachabilityStatusForFlags(flags);
83   - dispatch_async(dispatch_get_main_queue(), ^{
84   - if (block) {
85   - block(status);
86   - }
87   - NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
88   - NSDictionary *userInfo = @{ AFNetworkingReachabilityNotificationStatusItem: @(status) };
89   - [notificationCenter postNotificationName:AFNetworkingReachabilityDidChangeNotification object:nil userInfo:userInfo];
90   - });
91   -}
92   -
93   -static void AFNetworkReachabilityCallback(SCNetworkReachabilityRef __unused target, SCNetworkReachabilityFlags flags, void *info) {
94   - AFPostReachabilityStatusChange(flags, (__bridge AFNetworkReachabilityStatusBlock)info);
95   -}
96   -
97   -
98   -static const void * AFNetworkReachabilityRetainCallback(const void *info) {
99   - return Block_copy(info);
100   -}
101   -
102   -static void AFNetworkReachabilityReleaseCallback(const void *info) {
103   - if (info) {
104   - Block_release(info);
105   - }
106   -}
107   -
108   -@interface AFNetworkReachabilityManager ()
109   -@property (readonly, nonatomic, assign) SCNetworkReachabilityRef networkReachability;
110   -@property (readwrite, nonatomic, assign) AFNetworkReachabilityStatus networkReachabilityStatus;
111   -@property (readwrite, nonatomic, copy) AFNetworkReachabilityStatusBlock networkReachabilityStatusBlock;
112   -@end
113   -
114   -@implementation AFNetworkReachabilityManager
115   -
116   -+ (instancetype)sharedManager {
117   - static AFNetworkReachabilityManager *_sharedManager = nil;
118   - static dispatch_once_t onceToken;
119   - dispatch_once(&onceToken, ^{
120   - _sharedManager = [self manager];
121   - });
122   -
123   - return _sharedManager;
124   -}
125   -
126   -+ (instancetype)managerForDomain:(NSString *)domain {
127   - SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithName(kCFAllocatorDefault, [domain UTF8String]);
128   -
129   - AFNetworkReachabilityManager *manager = [[self alloc] initWithReachability:reachability];
130   -
131   - CFRelease(reachability);
132   -
133   - return manager;
134   -}
135   -
136   -+ (instancetype)managerForAddress:(const void *)address {
137   - SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithAddress(kCFAllocatorDefault, (const struct sockaddr *)address);
138   - AFNetworkReachabilityManager *manager = [[self alloc] initWithReachability:reachability];
139   -
140   - CFRelease(reachability);
141   -
142   - return manager;
143   -}
144   -
145   -+ (instancetype)manager
146   -{
147   -#if (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 90000) || (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100)
148   - struct sockaddr_in6 address;
149   - bzero(&address, sizeof(address));
150   - address.sin6_len = sizeof(address);
151   - address.sin6_family = AF_INET6;
152   -#else
153   - struct sockaddr_in address;
154   - bzero(&address, sizeof(address));
155   - address.sin_len = sizeof(address);
156   - address.sin_family = AF_INET;
157   -#endif
158   - return [self managerForAddress:&address];
159   -}
160   -
161   -- (instancetype)initWithReachability:(SCNetworkReachabilityRef)reachability {
162   - self = [super init];
163   - if (!self) {
164   - return nil;
165   - }
166   -
167   - _networkReachability = CFRetain(reachability);
168   - self.networkReachabilityStatus = AFNetworkReachabilityStatusUnknown;
169   -
170   - return self;
171   -}
172   -
173   -- (instancetype)init
174   -{
175   - @throw [NSException exceptionWithName:NSGenericException
176   - reason:@"`-init` unavailable. Use `-initWithReachability:` instead"
177   - userInfo:nil];
178   - return nil;
179   -}
180   -
181   -- (void)dealloc {
182   - [self stopMonitoring];
183   -
184   - if (_networkReachability != NULL) {
185   - CFRelease(_networkReachability);
186   - }
187   -}
188   -
189   -#pragma mark -
190   -
191   -- (BOOL)isReachable {
192   - return [self isReachableViaWWAN] || [self isReachableViaWiFi];
193   -}
194   -
195   -- (BOOL)isReachableViaWWAN {
196   - return self.networkReachabilityStatus == AFNetworkReachabilityStatusReachableViaWWAN;
197   -}
198   -
199   -- (BOOL)isReachableViaWiFi {
200   - return self.networkReachabilityStatus == AFNetworkReachabilityStatusReachableViaWiFi;
201   -}
202   -
203   -#pragma mark -
204   -
205   -- (void)startMonitoring {
206   - [self stopMonitoring];
207   -
208   - if (!self.networkReachability) {
209   - return;
210   - }
211   -
212   - __weak __typeof(self)weakSelf = self;
213   - AFNetworkReachabilityStatusBlock callback = ^(AFNetworkReachabilityStatus status) {
214   - __strong __typeof(weakSelf)strongSelf = weakSelf;
215   -
216   - strongSelf.networkReachabilityStatus = status;
217   - if (strongSelf.networkReachabilityStatusBlock) {
218   - strongSelf.networkReachabilityStatusBlock(status);
219   - }
220   -
221   - };
222   -
223   - SCNetworkReachabilityContext context = {0, (__bridge void *)callback, AFNetworkReachabilityRetainCallback, AFNetworkReachabilityReleaseCallback, NULL};
224   - SCNetworkReachabilitySetCallback(self.networkReachability, AFNetworkReachabilityCallback, &context);
225   - SCNetworkReachabilityScheduleWithRunLoop(self.networkReachability, CFRunLoopGetMain(), kCFRunLoopCommonModes);
226   -
227   - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0),^{
228   - SCNetworkReachabilityFlags flags;
229   - if (SCNetworkReachabilityGetFlags(self.networkReachability, &flags)) {
230   - AFPostReachabilityStatusChange(flags, callback);
231   - }
232   - });
233   -}
234   -
235   -- (void)stopMonitoring {
236   - if (!self.networkReachability) {
237   - return;
238   - }
239   -
240   - SCNetworkReachabilityUnscheduleFromRunLoop(self.networkReachability, CFRunLoopGetMain(), kCFRunLoopCommonModes);
241   -}
242   -
243   -#pragma mark -
244   -
245   -- (NSString *)localizedNetworkReachabilityStatusString {
246   - return AFStringFromNetworkReachabilityStatus(self.networkReachabilityStatus);
247   -}
248   -
249   -#pragma mark -
250   -
251   -- (void)setReachabilityStatusChangeBlock:(void (^)(AFNetworkReachabilityStatus status))block {
252   - self.networkReachabilityStatusBlock = block;
253   -}
254   -
255   -#pragma mark - NSKeyValueObserving
256   -
257   -+ (NSSet *)keyPathsForValuesAffectingValueForKey:(NSString *)key {
258   - if ([key isEqualToString:@"reachable"] || [key isEqualToString:@"reachableViaWWAN"] || [key isEqualToString:@"reachableViaWiFi"]) {
259   - return [NSSet setWithObject:@"networkReachabilityStatus"];
260   - }
261   -
262   - return [super keyPathsForValuesAffectingValueForKey:key];
263   -}
264   -
265   -@end
266   -#endif
CNPublishContent/Example/Pods/AFNetworking/AFNetworking/AFNetworking.h deleted 100644 → 0
1   -// AFNetworking.h
2   -//
3   -// Copyright (c) 2013 AFNetworking (http://afnetworking.com/)
4   -//
5   -// Permission is hereby granted, free of charge, to any person obtaining a copy
6   -// of this software and associated documentation files (the "Software"), to deal
7   -// in the Software without restriction, including without limitation the rights
8   -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9   -// copies of the Software, and to permit persons to whom the Software is
10   -// furnished to do so, subject to the following conditions:
11   -//
12   -// The above copyright notice and this permission notice shall be included in
13   -// all copies or substantial portions of the Software.
14   -//
15   -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16   -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17   -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18   -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19   -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20   -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21   -// THE SOFTWARE.
22   -
23   -#import <Foundation/Foundation.h>
24   -#import <Availability.h>
25   -#import <TargetConditionals.h>
26   -
27   -#ifndef _AFNETWORKING_
28   - #define _AFNETWORKING_
29   -
30   - #import "AFURLRequestSerialization.h"
31   - #import "AFURLResponseSerialization.h"
32   - #import "AFSecurityPolicy.h"
33   -
34   -#if !TARGET_OS_WATCH
35   - #import "AFNetworkReachabilityManager.h"
36   -#endif
37   -
38   - #import "AFURLSessionManager.h"
39   - #import "AFHTTPSessionManager.h"
40   -
41   -#endif /* _AFNETWORKING_ */
CNPublishContent/Example/Pods/AFNetworking/AFNetworking/AFSecurityPolicy.h deleted 100644 → 0
1   -// AFSecurityPolicy.h
2   -// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
3   -//
4   -// Permission is hereby granted, free of charge, to any person obtaining a copy
5   -// of this software and associated documentation files (the "Software"), to deal
6   -// in the Software without restriction, including without limitation the rights
7   -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8   -// copies of the Software, and to permit persons to whom the Software is
9   -// furnished to do so, subject to the following conditions:
10   -//
11   -// The above copyright notice and this permission notice shall be included in
12   -// all copies or substantial portions of the Software.
13   -//
14   -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20   -// THE SOFTWARE.
21   -
22   -#import <Foundation/Foundation.h>
23   -#import <Security/Security.h>
24   -
25   -typedef NS_ENUM(NSUInteger, AFSSLPinningMode) {
26   - AFSSLPinningModeNone,
27   - AFSSLPinningModePublicKey,
28   - AFSSLPinningModeCertificate,
29   -};
30   -
31   -/**
32   - `AFSecurityPolicy` evaluates server trust against pinned X.509 certificates and public keys over secure connections.
33   -
34   - Adding pinned SSL certificates to your app helps prevent man-in-the-middle attacks and other vulnerabilities. Applications dealing with sensitive customer data or financial information are strongly encouraged to route all communication over an HTTPS connection with SSL pinning configured and enabled.
35   - */
36   -
37   -NS_ASSUME_NONNULL_BEGIN
38   -
39   -@interface AFSecurityPolicy : NSObject <NSSecureCoding, NSCopying>
40   -
41   -/**
42   - The criteria by which server trust should be evaluated against the pinned SSL certificates. Defaults to `AFSSLPinningModeNone`.
43   - */
44   -@property (readonly, nonatomic, assign) AFSSLPinningMode SSLPinningMode;
45   -
46   -/**
47   - The certificates used to evaluate server trust according to the SSL pinning mode.
48   -
49   - By default, this property is set to any (`.cer`) certificates included in the target compiling AFNetworking. Note that if you are using AFNetworking as embedded framework, no certificates will be pinned by default. Use `certificatesInBundle` to load certificates from your target, and then create a new policy by calling `policyWithPinningMode:withPinnedCertificates`.
50   -
51   - Note that if pinning is enabled, `evaluateServerTrust:forDomain:` will return true if any pinned certificate matches.
52   - */
53   -@property (nonatomic, strong, nullable) NSSet <NSData *> *pinnedCertificates;
54   -
55   -/**
56   - Whether or not to trust servers with an invalid or expired SSL certificates. Defaults to `NO`.
57   - */
58   -@property (nonatomic, assign) BOOL allowInvalidCertificates;
59   -
60   -/**
61   - Whether or not to validate the domain name in the certificate's CN field. Defaults to `YES`.
62   - */
63   -@property (nonatomic, assign) BOOL validatesDomainName;
64   -
65   -///-----------------------------------------
66   -/// @name Getting Certificates from the Bundle
67   -///-----------------------------------------
68   -
69   -/**
70   - Returns any certificates included in the bundle. If you are using AFNetworking as an embedded framework, you must use this method to find the certificates you have included in your app bundle, and use them when creating your security policy by calling `policyWithPinningMode:withPinnedCertificates`.
71   -
72   - @return The certificates included in the given bundle.
73   - */
74   -+ (NSSet <NSData *> *)certificatesInBundle:(NSBundle *)bundle;
75   -
76   -///-----------------------------------------
77   -/// @name Getting Specific Security Policies
78   -///-----------------------------------------
79   -
80   -/**
81   - Returns the shared default security policy, which does not allow invalid certificates, validates domain name, and does not validate against pinned certificates or public keys.
82   -
83   - @return The default security policy.
84   - */
85   -+ (instancetype)defaultPolicy;
86   -
87   -///---------------------
88   -/// @name Initialization
89   -///---------------------
90   -
91   -/**
92   - Creates and returns a security policy with the specified pinning mode.
93   -
94   - @param pinningMode The SSL pinning mode.
95   -
96   - @return A new security policy.
97   - */
98   -+ (instancetype)policyWithPinningMode:(AFSSLPinningMode)pinningMode;
99   -
100   -/**
101   - Creates and returns a security policy with the specified pinning mode.
102   -
103   - @param pinningMode The SSL pinning mode.
104   - @param pinnedCertificates The certificates to pin against.
105   -
106   - @return A new security policy.
107   - */
108   -+ (instancetype)policyWithPinningMode:(AFSSLPinningMode)pinningMode withPinnedCertificates:(NSSet <NSData *> *)pinnedCertificates;
109   -
110   -///------------------------------
111   -/// @name Evaluating Server Trust
112   -///------------------------------
113   -
114   -/**
115   - Whether or not the specified server trust should be accepted, based on the security policy.
116   -
117   - This method should be used when responding to an authentication challenge from a server.
118   -
119   - @param serverTrust The X.509 certificate trust of the server.
120   - @param domain The domain of serverTrust. If `nil`, the domain will not be validated.
121   -
122   - @return Whether or not to trust the server.
123   - */
124   -- (BOOL)evaluateServerTrust:(SecTrustRef)serverTrust
125   - forDomain:(nullable NSString *)domain;
126   -
127   -@end
128   -
129   -NS_ASSUME_NONNULL_END
130   -
131   -///----------------
132   -/// @name Constants
133   -///----------------
134   -
135   -/**
136   - ## SSL Pinning Modes
137   -
138   - The following constants are provided by `AFSSLPinningMode` as possible SSL pinning modes.
139   -
140   - enum {
141   - AFSSLPinningModeNone,
142   - AFSSLPinningModePublicKey,
143   - AFSSLPinningModeCertificate,
144   - }
145   -
146   - `AFSSLPinningModeNone`
147   - Do not used pinned certificates to validate servers.
148   -
149   - `AFSSLPinningModePublicKey`
150   - Validate host certificates against public keys of pinned certificates.
151   -
152   - `AFSSLPinningModeCertificate`
153   - Validate host certificates against pinned certificates.
154   -*/
CNPublishContent/Example/Pods/AFNetworking/AFNetworking/AFSecurityPolicy.m deleted 100644 → 0
1   -// AFSecurityPolicy.m
2   -// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
3   -//
4   -// Permission is hereby granted, free of charge, to any person obtaining a copy
5   -// of this software and associated documentation files (the "Software"), to deal
6   -// in the Software without restriction, including without limitation the rights
7   -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8   -// copies of the Software, and to permit persons to whom the Software is
9   -// furnished to do so, subject to the following conditions:
10   -//
11   -// The above copyright notice and this permission notice shall be included in
12   -// all copies or substantial portions of the Software.
13   -//
14   -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20   -// THE SOFTWARE.
21   -
22   -#import "AFSecurityPolicy.h"
23   -
24   -#import <AssertMacros.h>
25   -
26   -#if !TARGET_OS_IOS && !TARGET_OS_WATCH && !TARGET_OS_TV
27   -static NSData * AFSecKeyGetData(SecKeyRef key) {
28   - CFDataRef data = NULL;
29   -
30   - __Require_noErr_Quiet(SecItemExport(key, kSecFormatUnknown, kSecItemPemArmour, NULL, &data), _out);
31   -
32   - return (__bridge_transfer NSData *)data;
33   -
34   -_out:
35   - if (data) {
36   - CFRelease(data);
37   - }
38   -
39   - return nil;
40   -}
41   -#endif
42   -
43   -static BOOL AFSecKeyIsEqualToKey(SecKeyRef key1, SecKeyRef key2) {
44   -#if TARGET_OS_IOS || TARGET_OS_WATCH || TARGET_OS_TV
45   - return [(__bridge id)key1 isEqual:(__bridge id)key2];
46   -#else
47   - return [AFSecKeyGetData(key1) isEqual:AFSecKeyGetData(key2)];
48   -#endif
49   -}
50   -
51   -static id AFPublicKeyForCertificate(NSData *certificate) {
52   - id allowedPublicKey = nil;
53   - SecCertificateRef allowedCertificate;
54   - SecPolicyRef policy = nil;
55   - SecTrustRef allowedTrust = nil;
56   - SecTrustResultType result;
57   -
58   - allowedCertificate = SecCertificateCreateWithData(NULL, (__bridge CFDataRef)certificate);
59   - __Require_Quiet(allowedCertificate != NULL, _out);
60   -
61   - policy = SecPolicyCreateBasicX509();
62   - __Require_noErr_Quiet(SecTrustCreateWithCertificates(allowedCertificate, policy, &allowedTrust), _out);
63   - __Require_noErr_Quiet(SecTrustEvaluate(allowedTrust, &result), _out);
64   -
65   - allowedPublicKey = (__bridge_transfer id)SecTrustCopyPublicKey(allowedTrust);
66   -
67   -_out:
68   - if (allowedTrust) {
69   - CFRelease(allowedTrust);
70   - }
71   -
72   - if (policy) {
73   - CFRelease(policy);
74   - }
75   -
76   - if (allowedCertificate) {
77   - CFRelease(allowedCertificate);
78   - }
79   -
80   - return allowedPublicKey;
81   -}
82   -
83   -static BOOL AFServerTrustIsValid(SecTrustRef serverTrust) {
84   - BOOL isValid = NO;
85   - SecTrustResultType result;
86   - __Require_noErr_Quiet(SecTrustEvaluate(serverTrust, &result), _out);
87   -
88   - isValid = (result == kSecTrustResultUnspecified || result == kSecTrustResultProceed);
89   -
90   -_out:
91   - return isValid;
92   -}
93   -
94   -static NSArray * AFCertificateTrustChainForServerTrust(SecTrustRef serverTrust) {
95   - CFIndex certificateCount = SecTrustGetCertificateCount(serverTrust);
96   - NSMutableArray *trustChain = [NSMutableArray arrayWithCapacity:(NSUInteger)certificateCount];
97   -
98   - for (CFIndex i = 0; i < certificateCount; i++) {
99   - SecCertificateRef certificate = SecTrustGetCertificateAtIndex(serverTrust, i);
100   - [trustChain addObject:(__bridge_transfer NSData *)SecCertificateCopyData(certificate)];
101   - }
102   -
103   - return [NSArray arrayWithArray:trustChain];
104   -}
105   -
106   -static NSArray * AFPublicKeyTrustChainForServerTrust(SecTrustRef serverTrust) {
107   - SecPolicyRef policy = SecPolicyCreateBasicX509();
108   - CFIndex certificateCount = SecTrustGetCertificateCount(serverTrust);
109   - NSMutableArray *trustChain = [NSMutableArray arrayWithCapacity:(NSUInteger)certificateCount];
110   - for (CFIndex i = 0; i < certificateCount; i++) {
111   - SecCertificateRef certificate = SecTrustGetCertificateAtIndex(serverTrust, i);
112   -
113   - SecCertificateRef someCertificates[] = {certificate};
114   - CFArrayRef certificates = CFArrayCreate(NULL, (const void **)someCertificates, 1, NULL);
115   -
116   - SecTrustRef trust;
117   - __Require_noErr_Quiet(SecTrustCreateWithCertificates(certificates, policy, &trust), _out);
118   -
119   - SecTrustResultType result;
120   - __Require_noErr_Quiet(SecTrustEvaluate(trust, &result), _out);
121   -
122   - [trustChain addObject:(__bridge_transfer id)SecTrustCopyPublicKey(trust)];
123   -
124   - _out:
125   - if (trust) {
126   - CFRelease(trust);
127   - }
128   -
129   - if (certificates) {
130   - CFRelease(certificates);
131   - }
132   -
133   - continue;
134   - }
135   - CFRelease(policy);
136   -
137   - return [NSArray arrayWithArray:trustChain];
138   -}
139   -
140   -#pragma mark -
141   -
142   -@interface AFSecurityPolicy()
143   -@property (readwrite, nonatomic, assign) AFSSLPinningMode SSLPinningMode;
144   -@property (readwrite, nonatomic, strong) NSSet *pinnedPublicKeys;
145   -@end
146   -
147   -@implementation AFSecurityPolicy
148   -
149   -+ (NSSet *)certificatesInBundle:(NSBundle *)bundle {
150   - NSArray *paths = [bundle pathsForResourcesOfType:@"cer" inDirectory:@"."];
151   -
152   - NSMutableSet *certificates = [NSMutableSet setWithCapacity:[paths count]];
153   - for (NSString *path in paths) {
154   - NSData *certificateData = [NSData dataWithContentsOfFile:path];
155   - [certificates addObject:certificateData];
156   - }
157   -
158   - return [NSSet setWithSet:certificates];
159   -}
160   -
161   -+ (NSSet *)defaultPinnedCertificates {
162   - static NSSet *_defaultPinnedCertificates = nil;
163   - static dispatch_once_t onceToken;
164   - dispatch_once(&onceToken, ^{
165   - NSBundle *bundle = [NSBundle bundleForClass:[self class]];
166   - _defaultPinnedCertificates = [self certificatesInBundle:bundle];
167   - });
168   -
169   - return _defaultPinnedCertificates;
170   -}
171   -
172   -+ (instancetype)defaultPolicy {
173   - AFSecurityPolicy *securityPolicy = [[self alloc] init];
174   - securityPolicy.SSLPinningMode = AFSSLPinningModeNone;
175   -
176   - return securityPolicy;
177   -}
178   -
179   -+ (instancetype)policyWithPinningMode:(AFSSLPinningMode)pinningMode {
180   - return [self policyWithPinningMode:pinningMode withPinnedCertificates:[self defaultPinnedCertificates]];
181   -}
182   -
183   -+ (instancetype)policyWithPinningMode:(AFSSLPinningMode)pinningMode withPinnedCertificates:(NSSet *)pinnedCertificates {
184   - AFSecurityPolicy *securityPolicy = [[self alloc] init];
185   - securityPolicy.SSLPinningMode = pinningMode;
186   -
187   - [securityPolicy setPinnedCertificates:pinnedCertificates];
188   -
189   - return securityPolicy;
190   -}
191   -
192   -- (instancetype)init {
193   - self = [super init];
194   - if (!self) {
195   - return nil;
196   - }
197   -
198   - self.validatesDomainName = YES;
199   -
200   - return self;
201   -}
202   -
203   -- (void)setPinnedCertificates:(NSSet *)pinnedCertificates {
204   - _pinnedCertificates = pinnedCertificates;
205   -
206   - if (self.pinnedCertificates) {
207   - NSMutableSet *mutablePinnedPublicKeys = [NSMutableSet setWithCapacity:[self.pinnedCertificates count]];
208   - for (NSData *certificate in self.pinnedCertificates) {
209   - id publicKey = AFPublicKeyForCertificate(certificate);
210   - if (!publicKey) {
211   - continue;
212   - }
213   - [mutablePinnedPublicKeys addObject:publicKey];
214   - }
215   - self.pinnedPublicKeys = [NSSet setWithSet:mutablePinnedPublicKeys];
216   - } else {
217   - self.pinnedPublicKeys = nil;
218   - }
219   -}
220   -
221   -#pragma mark -
222   -
223   -- (BOOL)evaluateServerTrust:(SecTrustRef)serverTrust
224   - forDomain:(NSString *)domain
225   -{
226   - if (domain && self.allowInvalidCertificates && self.validatesDomainName && (self.SSLPinningMode == AFSSLPinningModeNone || [self.pinnedCertificates count] == 0)) {
227   - // https://developer.apple.com/library/mac/documentation/NetworkingInternet/Conceptual/NetworkingTopics/Articles/OverridingSSLChainValidationCorrectly.html
228   - // According to the docs, you should only trust your provided certs for evaluation.
229   - // Pinned certificates are added to the trust. Without pinned certificates,
230   - // there is nothing to evaluate against.
231   - //
232   - // From Apple Docs:
233   - // "Do not implicitly trust self-signed certificates as anchors (kSecTrustOptionImplicitAnchors).
234   - // Instead, add your own (self-signed) CA certificate to the list of trusted anchors."
235   - NSLog(@"In order to validate a domain name for self signed certificates, you MUST use pinning.");
236   - return NO;
237   - }
238   -
239   - NSMutableArray *policies = [NSMutableArray array];
240   - if (self.validatesDomainName) {
241   - [policies addObject:(__bridge_transfer id)SecPolicyCreateSSL(true, (__bridge CFStringRef)domain)];
242   - } else {
243   - [policies addObject:(__bridge_transfer id)SecPolicyCreateBasicX509()];
244   - }
245   -
246   - SecTrustSetPolicies(serverTrust, (__bridge CFArrayRef)policies);
247   -
248   - if (self.SSLPinningMode == AFSSLPinningModeNone) {
249   - return self.allowInvalidCertificates || AFServerTrustIsValid(serverTrust);
250   - } else if (!AFServerTrustIsValid(serverTrust) && !self.allowInvalidCertificates) {
251   - return NO;
252   - }
253   -
254   - switch (self.SSLPinningMode) {
255   - case AFSSLPinningModeNone:
256   - default:
257   - return NO;
258   - case AFSSLPinningModeCertificate: {
259   - NSMutableArray *pinnedCertificates = [NSMutableArray array];
260   - for (NSData *certificateData in self.pinnedCertificates) {
261   - [pinnedCertificates addObject:(__bridge_transfer id)SecCertificateCreateWithData(NULL, (__bridge CFDataRef)certificateData)];
262   - }
263   - SecTrustSetAnchorCertificates(serverTrust, (__bridge CFArrayRef)pinnedCertificates);
264   -
265   - if (!AFServerTrustIsValid(serverTrust)) {
266   - return NO;
267   - }
268   -
269   - // obtain the chain after being validated, which *should* contain the pinned certificate in the last position (if it's the Root CA)
270   - NSArray *serverCertificates = AFCertificateTrustChainForServerTrust(serverTrust);
271   -
272   - for (NSData *trustChainCertificate in [serverCertificates reverseObjectEnumerator]) {
273   - if ([self.pinnedCertificates containsObject:trustChainCertificate]) {
274   - return YES;
275   - }
276   - }
277   -
278   - return NO;
279   - }
280   - case AFSSLPinningModePublicKey: {
281   - NSUInteger trustedPublicKeyCount = 0;
282   - NSArray *publicKeys = AFPublicKeyTrustChainForServerTrust(serverTrust);
283   -
284   - for (id trustChainPublicKey in publicKeys) {
285   - for (id pinnedPublicKey in self.pinnedPublicKeys) {
286   - if (AFSecKeyIsEqualToKey((__bridge SecKeyRef)trustChainPublicKey, (__bridge SecKeyRef)pinnedPublicKey)) {
287   - trustedPublicKeyCount += 1;
288   - }
289   - }
290   - }
291   - return trustedPublicKeyCount > 0;
292   - }
293   - }
294   -
295   - return NO;
296   -}
297   -
298   -#pragma mark - NSKeyValueObserving
299   -
300   -+ (NSSet *)keyPathsForValuesAffectingPinnedPublicKeys {
301   - return [NSSet setWithObject:@"pinnedCertificates"];
302   -}
303   -
304   -#pragma mark - NSSecureCoding
305   -
306   -+ (BOOL)supportsSecureCoding {
307   - return YES;
308   -}
309   -
310   -- (instancetype)initWithCoder:(NSCoder *)decoder {
311   -
312   - self = [self init];
313   - if (!self) {
314   - return nil;
315   - }
316   -
317   - self.SSLPinningMode = [[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(SSLPinningMode))] unsignedIntegerValue];
318   - self.allowInvalidCertificates = [decoder decodeBoolForKey:NSStringFromSelector(@selector(allowInvalidCertificates))];
319   - self.validatesDomainName = [decoder decodeBoolForKey:NSStringFromSelector(@selector(validatesDomainName))];
320   - self.pinnedCertificates = [decoder decodeObjectOfClass:[NSArray class] forKey:NSStringFromSelector(@selector(pinnedCertificates))];
321   -
322   - return self;
323   -}
324   -
325   -- (void)encodeWithCoder:(NSCoder *)coder {
326   - [coder encodeObject:[NSNumber numberWithUnsignedInteger:self.SSLPinningMode] forKey:NSStringFromSelector(@selector(SSLPinningMode))];
327   - [coder encodeBool:self.allowInvalidCertificates forKey:NSStringFromSelector(@selector(allowInvalidCertificates))];
328   - [coder encodeBool:self.validatesDomainName forKey:NSStringFromSelector(@selector(validatesDomainName))];
329   - [coder encodeObject:self.pinnedCertificates forKey:NSStringFromSelector(@selector(pinnedCertificates))];
330   -}
331   -
332   -#pragma mark - NSCopying
333   -
334   -- (instancetype)copyWithZone:(NSZone *)zone {
335   - AFSecurityPolicy *securityPolicy = [[[self class] allocWithZone:zone] init];
336   - securityPolicy.SSLPinningMode = self.SSLPinningMode;
337   - securityPolicy.allowInvalidCertificates = self.allowInvalidCertificates;
338   - securityPolicy.validatesDomainName = self.validatesDomainName;
339   - securityPolicy.pinnedCertificates = [self.pinnedCertificates copyWithZone:zone];
340   -
341   - return securityPolicy;
342   -}
343   -
344   -@end
CNPublishContent/Example/Pods/AFNetworking/AFNetworking/AFURLRequestSerialization.h deleted 100644 → 0
1   -// AFURLRequestSerialization.h
2   -// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
3   -//
4   -// Permission is hereby granted, free of charge, to any person obtaining a copy
5   -// of this software and associated documentation files (the "Software"), to deal
6   -// in the Software without restriction, including without limitation the rights
7   -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8   -// copies of the Software, and to permit persons to whom the Software is
9   -// furnished to do so, subject to the following conditions:
10   -//
11   -// The above copyright notice and this permission notice shall be included in
12   -// all copies or substantial portions of the Software.
13   -//
14   -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20   -// THE SOFTWARE.
21   -
22   -#import <Foundation/Foundation.h>
23   -#import <TargetConditionals.h>
24   -
25   -#if TARGET_OS_IOS || TARGET_OS_TV
26   -#import <UIKit/UIKit.h>
27   -#elif TARGET_OS_WATCH
28   -#import <WatchKit/WatchKit.h>
29   -#endif
30   -
31   -NS_ASSUME_NONNULL_BEGIN
32   -
33   -/**
34   - Returns a percent-escaped string following RFC 3986 for a query string key or value.
35   - RFC 3986 states that the following characters are "reserved" characters.
36   - - General Delimiters: ":", "#", "[", "]", "@", "?", "/"
37   - - Sub-Delimiters: "!", "$", "&", "'", "(", ")", "*", "+", ",", ";", "="
38   -
39   - In RFC 3986 - Section 3.4, it states that the "?" and "/" characters should not be escaped to allow
40   - query strings to include a URL. Therefore, all "reserved" characters with the exception of "?" and "/"
41   - should be percent-escaped in the query string.
42   -
43   - @param string The string to be percent-escaped.
44   -
45   - @return The percent-escaped string.
46   - */
47   -FOUNDATION_EXPORT NSString * AFPercentEscapedStringFromString(NSString *string);
48   -
49   -/**
50   - A helper method to generate encoded url query parameters for appending to the end of a URL.
51   -
52   - @param parameters A dictionary of key/values to be encoded.
53   -
54   - @return A url encoded query string
55   - */
56   -FOUNDATION_EXPORT NSString * AFQueryStringFromParameters(NSDictionary *parameters);
57   -
58   -/**
59   - The `AFURLRequestSerialization` protocol is adopted by an object that encodes parameters for a specified HTTP requests. Request serializers may encode parameters as query strings, HTTP bodies, setting the appropriate HTTP header fields as necessary.
60   -
61   - For example, a JSON request serializer may set the HTTP body of the request to a JSON representation, and set the `Content-Type` HTTP header field value to `application/json`.
62   - */
63   -@protocol AFURLRequestSerialization <NSObject, NSSecureCoding, NSCopying>
64   -
65   -/**
66   - Returns a request with the specified parameters encoded into a copy of the original request.
67   -
68   - @param request The original request.
69   - @param parameters The parameters to be encoded.
70   - @param error The error that occurred while attempting to encode the request parameters.
71   -
72   - @return A serialized request.
73   - */
74   -- (nullable NSURLRequest *)requestBySerializingRequest:(NSURLRequest *)request
75   - withParameters:(nullable id)parameters
76   - error:(NSError * _Nullable __autoreleasing *)error NS_SWIFT_NOTHROW;
77   -
78   -@end
79   -
80   -#pragma mark -
81   -
82   -/**
83   -
84   - */
85   -typedef NS_ENUM(NSUInteger, AFHTTPRequestQueryStringSerializationStyle) {
86   - AFHTTPRequestQueryStringDefaultStyle = 0,
87   -};
88   -
89   -@protocol AFMultipartFormData;
90   -
91   -/**
92   - `AFHTTPRequestSerializer` conforms to the `AFURLRequestSerialization` & `AFURLResponseSerialization` protocols, offering a concrete base implementation of query string / URL form-encoded parameter serialization and default request headers, as well as response status code and content type validation.
93   -
94   - Any request or response serializer dealing with HTTP is encouraged to subclass `AFHTTPRequestSerializer` in order to ensure consistent default behavior.
95   - */
96   -@interface AFHTTPRequestSerializer : NSObject <AFURLRequestSerialization>
97   -
98   -/**
99   - The string encoding used to serialize parameters. `NSUTF8StringEncoding` by default.
100   - */
101   -@property (nonatomic, assign) NSStringEncoding stringEncoding;
102   -
103   -/**
104   - Whether created requests can use the device’s cellular radio (if present). `YES` by default.
105   -
106   - @see NSMutableURLRequest -setAllowsCellularAccess:
107   - */
108   -@property (nonatomic, assign) BOOL allowsCellularAccess;
109   -
110   -/**
111   - The cache policy of created requests. `NSURLRequestUseProtocolCachePolicy` by default.
112   -
113   - @see NSMutableURLRequest -setCachePolicy:
114   - */
115   -@property (nonatomic, assign) NSURLRequestCachePolicy cachePolicy;
116   -
117   -/**
118   - Whether created requests should use the default cookie handling. `YES` by default.
119   -
120   - @see NSMutableURLRequest -setHTTPShouldHandleCookies:
121   - */
122   -@property (nonatomic, assign) BOOL HTTPShouldHandleCookies;
123   -
124   -/**
125   - Whether created requests can continue transmitting data before receiving a response from an earlier transmission. `NO` by default
126   -
127   - @see NSMutableURLRequest -setHTTPShouldUsePipelining:
128   - */
129   -@property (nonatomic, assign) BOOL HTTPShouldUsePipelining;
130   -
131   -/**
132   - The network service type for created requests. `NSURLNetworkServiceTypeDefault` by default.
133   -
134   - @see NSMutableURLRequest -setNetworkServiceType:
135   - */
136   -@property (nonatomic, assign) NSURLRequestNetworkServiceType networkServiceType;
137   -
138   -/**
139   - The timeout interval, in seconds, for created requests. The default timeout interval is 60 seconds.
140   -
141   - @see NSMutableURLRequest -setTimeoutInterval:
142   - */
143   -@property (nonatomic, assign) NSTimeInterval timeoutInterval;
144   -
145   -///---------------------------------------
146   -/// @name Configuring HTTP Request Headers
147   -///---------------------------------------
148   -
149   -/**
150   - Default HTTP header field values to be applied to serialized requests. By default, these include the following:
151   -
152   - - `Accept-Language` with the contents of `NSLocale +preferredLanguages`
153   - - `User-Agent` with the contents of various bundle identifiers and OS designations
154   -
155   - @discussion To add or remove default request headers, use `setValue:forHTTPHeaderField:`.
156   - */
157   -@property (readonly, nonatomic, strong) NSDictionary <NSString *, NSString *> *HTTPRequestHeaders;
158   -
159   -/**
160   - Creates and returns a serializer with default configuration.
161   - */
162   -+ (instancetype)serializer;
163   -
164   -/**
165   - Sets the value for the HTTP headers set in request objects made by the HTTP client. If `nil`, removes the existing value for that header.
166   -
167   - @param field The HTTP header to set a default value for
168   - @param value The value set as default for the specified header, or `nil`
169   - */
170   -- (void)setValue:(nullable NSString *)value
171   -forHTTPHeaderField:(NSString *)field;
172   -
173   -/**
174   - Returns the value for the HTTP headers set in the request serializer.
175   -
176   - @param field The HTTP header to retrieve the default value for
177   -
178   - @return The value set as default for the specified header, or `nil`
179   - */
180   -- (nullable NSString *)valueForHTTPHeaderField:(NSString *)field;
181   -
182   -/**
183   - Sets the "Authorization" HTTP header set in request objects made by the HTTP client to a basic authentication value with Base64-encoded username and password. This overwrites any existing value for this header.
184   -
185   - @param username The HTTP basic auth username
186   - @param password The HTTP basic auth password
187   - */
188   -- (void)setAuthorizationHeaderFieldWithUsername:(NSString *)username
189   - password:(NSString *)password;
190   -
191   -/**
192   - Clears any existing value for the "Authorization" HTTP header.
193   - */
194   -- (void)clearAuthorizationHeader;
195   -
196   -///-------------------------------------------------------
197   -/// @name Configuring Query String Parameter Serialization
198   -///-------------------------------------------------------
199   -
200   -/**
201   - HTTP methods for which serialized requests will encode parameters as a query string. `GET`, `HEAD`, and `DELETE` by default.
202   - */
203   -@property (nonatomic, strong) NSSet <NSString *> *HTTPMethodsEncodingParametersInURI;
204   -
205   -/**
206   - Set the method of query string serialization according to one of the pre-defined styles.
207   -
208   - @param style The serialization style.
209   -
210   - @see AFHTTPRequestQueryStringSerializationStyle
211   - */
212   -- (void)setQueryStringSerializationWithStyle:(AFHTTPRequestQueryStringSerializationStyle)style;
213   -
214   -/**
215   - Set the a custom method of query string serialization according to the specified block.
216   -
217   - @param block A block that defines a process of encoding parameters into a query string. This block returns the query string and takes three arguments: the request, the parameters to encode, and the error that occurred when attempting to encode parameters for the given request.
218   - */
219   -- (void)setQueryStringSerializationWithBlock:(nullable NSString * (^)(NSURLRequest *request, id parameters, NSError * __autoreleasing *error))block;
220   -
221   -///-------------------------------
222   -/// @name Creating Request Objects
223   -///-------------------------------
224   -
225   -/**
226   - Creates an `NSMutableURLRequest` object with the specified HTTP method and URL string.
227   -
228   - If the HTTP method is `GET`, `HEAD`, or `DELETE`, the parameters will be used to construct a url-encoded query string that is appended to the request's URL. Otherwise, the parameters will be encoded according to the value of the `parameterEncoding` property, and set as the request body.
229   -
230   - @param method The HTTP method for the request, such as `GET`, `POST`, `PUT`, or `DELETE`. This parameter must not be `nil`.
231   - @param URLString The URL string used to create the request URL.
232   - @param parameters The parameters to be either set as a query string for `GET` requests, or the request HTTP body.
233   - @param error The error that occurred while constructing the request.
234   -
235   - @return An `NSMutableURLRequest` object.
236   - */
237   -- (NSMutableURLRequest *)requestWithMethod:(NSString *)method
238   - URLString:(NSString *)URLString
239   - parameters:(nullable id)parameters
240   - error:(NSError * _Nullable __autoreleasing *)error;
241   -
242   -/**
243   - Creates an `NSMutableURLRequest` object with the specified HTTP method and URLString, and constructs a `multipart/form-data` HTTP body, using the specified parameters and multipart form data block. See http://www.w3.org/TR/html4/interact/forms.html#h-17.13.4.2
244   -
245   - Multipart form requests are automatically streamed, reading files directly from disk along with in-memory data in a single HTTP body. The resulting `NSMutableURLRequest` object has an `HTTPBodyStream` property, so refrain from setting `HTTPBodyStream` or `HTTPBody` on this request object, as it will clear out the multipart form body stream.
246   -
247   - @param method The HTTP method for the request. This parameter must not be `GET` or `HEAD`, or `nil`.
248   - @param URLString The URL string used to create the request URL.
249   - @param parameters The parameters to be encoded and set in the request HTTP body.
250   - @param block A block that takes a single argument and appends data to the HTTP body. The block argument is an object adopting the `AFMultipartFormData` protocol.
251   - @param error The error that occurred while constructing the request.
252   -
253   - @return An `NSMutableURLRequest` object
254   - */
255   -- (NSMutableURLRequest *)multipartFormRequestWithMethod:(NSString *)method
256   - URLString:(NSString *)URLString
257   - parameters:(nullable NSDictionary <NSString *, id> *)parameters
258   - constructingBodyWithBlock:(nullable void (^)(id <AFMultipartFormData> formData))block
259   - error:(NSError * _Nullable __autoreleasing *)error;
260   -
261   -/**
262   - Creates an `NSMutableURLRequest` by removing the `HTTPBodyStream` from a request, and asynchronously writing its contents into the specified file, invoking the completion handler when finished.
263   -
264   - @param request The multipart form request. The `HTTPBodyStream` property of `request` must not be `nil`.
265   - @param fileURL The file URL to write multipart form contents to.
266   - @param handler A handler block to execute.
267   -
268   - @discussion There is a bug in `NSURLSessionTask` that causes requests to not send a `Content-Length` header when streaming contents from an HTTP body, which is notably problematic when interacting with the Amazon S3 webservice. As a workaround, this method takes a request constructed with `multipartFormRequestWithMethod:URLString:parameters:constructingBodyWithBlock:error:`, or any other request with an `HTTPBodyStream`, writes the contents to the specified file and returns a copy of the original request with the `HTTPBodyStream` property set to `nil`. From here, the file can either be passed to `AFURLSessionManager -uploadTaskWithRequest:fromFile:progress:completionHandler:`, or have its contents read into an `NSData` that's assigned to the `HTTPBody` property of the request.
269   -
270   - @see https://github.com/AFNetworking/AFNetworking/issues/1398
271   - */
272   -- (NSMutableURLRequest *)requestWithMultipartFormRequest:(NSURLRequest *)request
273   - writingStreamContentsToFile:(NSURL *)fileURL
274   - completionHandler:(nullable void (^)(NSError * _Nullable error))handler;
275   -
276   -@end
277   -
278   -#pragma mark -
279   -
280   -/**
281   - The `AFMultipartFormData` protocol defines the methods supported by the parameter in the block argument of `AFHTTPRequestSerializer -multipartFormRequestWithMethod:URLString:parameters:constructingBodyWithBlock:`.
282   - */
283   -@protocol AFMultipartFormData
284   -
285   -/**
286   - Appends the HTTP header `Content-Disposition: file; filename=#{generated filename}; name=#{name}"` and `Content-Type: #{generated mimeType}`, followed by the encoded file data and the multipart form boundary.
287   -
288   - The filename and MIME type for this data in the form will be automatically generated, using the last path component of the `fileURL` and system associated MIME type for the `fileURL` extension, respectively.
289   -
290   - @param fileURL The URL corresponding to the file whose content will be appended to the form. This parameter must not be `nil`.
291   - @param name The name to be associated with the specified data. This parameter must not be `nil`.
292   - @param error If an error occurs, upon return contains an `NSError` object that describes the problem.
293   -
294   - @return `YES` if the file data was successfully appended, otherwise `NO`.
295   - */
296   -- (BOOL)appendPartWithFileURL:(NSURL *)fileURL
297   - name:(NSString *)name
298   - error:(NSError * _Nullable __autoreleasing *)error;
299   -
300   -/**
301   - Appends the HTTP header `Content-Disposition: file; filename=#{filename}; name=#{name}"` and `Content-Type: #{mimeType}`, followed by the encoded file data and the multipart form boundary.
302   -
303   - @param fileURL The URL corresponding to the file whose content will be appended to the form. This parameter must not be `nil`.
304   - @param name The name to be associated with the specified data. This parameter must not be `nil`.
305   - @param fileName The file name to be used in the `Content-Disposition` header. This parameter must not be `nil`.
306   - @param mimeType The declared MIME type of the file data. This parameter must not be `nil`.
307   - @param error If an error occurs, upon return contains an `NSError` object that describes the problem.
308   -
309   - @return `YES` if the file data was successfully appended otherwise `NO`.
310   - */
311   -- (BOOL)appendPartWithFileURL:(NSURL *)fileURL
312   - name:(NSString *)name
313   - fileName:(NSString *)fileName
314   - mimeType:(NSString *)mimeType
315   - error:(NSError * _Nullable __autoreleasing *)error;
316   -
317   -/**
318   - Appends the HTTP header `Content-Disposition: file; filename=#{filename}; name=#{name}"` and `Content-Type: #{mimeType}`, followed by the data from the input stream and the multipart form boundary.
319   -
320   - @param inputStream The input stream to be appended to the form data
321   - @param name The name to be associated with the specified input stream. This parameter must not be `nil`.
322   - @param fileName The filename to be associated with the specified input stream. This parameter must not be `nil`.
323   - @param length The length of the specified input stream in bytes.
324   - @param mimeType The MIME type of the specified data. (For example, the MIME type for a JPEG image is image/jpeg.) For a list of valid MIME types, see http://www.iana.org/assignments/media-types/. This parameter must not be `nil`.
325   - */
326   -- (void)appendPartWithInputStream:(nullable NSInputStream *)inputStream
327   - name:(NSString *)name
328   - fileName:(NSString *)fileName
329   - length:(int64_t)length
330   - mimeType:(NSString *)mimeType;
331   -
332   -/**
333   - Appends the HTTP header `Content-Disposition: file; filename=#{filename}; name=#{name}"` and `Content-Type: #{mimeType}`, followed by the encoded file data and the multipart form boundary.
334   -
335   - @param data The data to be encoded and appended to the form data.
336   - @param name The name to be associated with the specified data. This parameter must not be `nil`.
337   - @param fileName The filename to be associated with the specified data. This parameter must not be `nil`.
338   - @param mimeType The MIME type of the specified data. (For example, the MIME type for a JPEG image is image/jpeg.) For a list of valid MIME types, see http://www.iana.org/assignments/media-types/. This parameter must not be `nil`.
339   - */
340   -- (void)appendPartWithFileData:(NSData *)data
341   - name:(NSString *)name
342   - fileName:(NSString *)fileName
343   - mimeType:(NSString *)mimeType;
344   -
345   -/**
346   - Appends the HTTP headers `Content-Disposition: form-data; name=#{name}"`, followed by the encoded data and the multipart form boundary.
347   -
348   - @param data The data to be encoded and appended to the form data.
349   - @param name The name to be associated with the specified data. This parameter must not be `nil`.
350   - */
351   -
352   -- (void)appendPartWithFormData:(NSData *)data
353   - name:(NSString *)name;
354   -
355   -
356   -/**
357   - Appends HTTP headers, followed by the encoded data and the multipart form boundary.
358   -
359   - @param headers The HTTP headers to be appended to the form data.
360   - @param body The data to be encoded and appended to the form data. This parameter must not be `nil`.
361   - */
362   -- (void)appendPartWithHeaders:(nullable NSDictionary <NSString *, NSString *> *)headers
363   - body:(NSData *)body;
364   -
365   -/**
366   - Throttles request bandwidth by limiting the packet size and adding a delay for each chunk read from the upload stream.
367   -
368   - When uploading over a 3G or EDGE connection, requests may fail with "request body stream exhausted". Setting a maximum packet size and delay according to the recommended values (`kAFUploadStream3GSuggestedPacketSize` and `kAFUploadStream3GSuggestedDelay`) lowers the risk of the input stream exceeding its allocated bandwidth. Unfortunately, there is no definite way to distinguish between a 3G, EDGE, or LTE connection over `NSURLConnection`. As such, it is not recommended that you throttle bandwidth based solely on network reachability. Instead, you should consider checking for the "request body stream exhausted" in a failure block, and then retrying the request with throttled bandwidth.
369   -
370   - @param numberOfBytes Maximum packet size, in number of bytes. The default packet size for an input stream is 16kb.
371   - @param delay Duration of delay each time a packet is read. By default, no delay is set.
372   - */
373   -- (void)throttleBandwidthWithPacketSize:(NSUInteger)numberOfBytes
374   - delay:(NSTimeInterval)delay;
375   -
376   -@end
377   -
378   -#pragma mark -
379   -
380   -/**
381   - `AFJSONRequestSerializer` is a subclass of `AFHTTPRequestSerializer` that encodes parameters as JSON using `NSJSONSerialization`, setting the `Content-Type` of the encoded request to `application/json`.
382   - */
383   -@interface AFJSONRequestSerializer : AFHTTPRequestSerializer
384   -
385   -/**
386   - Options for writing the request JSON data from Foundation objects. For possible values, see the `NSJSONSerialization` documentation section "NSJSONWritingOptions". `0` by default.
387   - */
388   -@property (nonatomic, assign) NSJSONWritingOptions writingOptions;
389   -
390   -/**
391   - Creates and returns a JSON serializer with specified reading and writing options.
392   -
393   - @param writingOptions The specified JSON writing options.
394   - */
395   -+ (instancetype)serializerWithWritingOptions:(NSJSONWritingOptions)writingOptions;
396   -
397   -@end
398   -
399   -#pragma mark -
400   -
401   -/**
402   - `AFPropertyListRequestSerializer` is a subclass of `AFHTTPRequestSerializer` that encodes parameters as JSON using `NSPropertyListSerializer`, setting the `Content-Type` of the encoded request to `application/x-plist`.
403   - */
404   -@interface AFPropertyListRequestSerializer : AFHTTPRequestSerializer
405   -
406   -/**
407   - The property list format. Possible values are described in "NSPropertyListFormat".
408   - */
409   -@property (nonatomic, assign) NSPropertyListFormat format;
410   -
411   -/**
412   - @warning The `writeOptions` property is currently unused.
413   - */
414   -@property (nonatomic, assign) NSPropertyListWriteOptions writeOptions;
415   -
416   -/**
417   - Creates and returns a property list serializer with a specified format, read options, and write options.
418   -
419   - @param format The property list format.
420   - @param writeOptions The property list write options.
421   -
422   - @warning The `writeOptions` property is currently unused.
423   - */
424   -+ (instancetype)serializerWithFormat:(NSPropertyListFormat)format
425   - writeOptions:(NSPropertyListWriteOptions)writeOptions;
426   -
427   -@end
428   -
429   -#pragma mark -
430   -
431   -///----------------
432   -/// @name Constants
433   -///----------------
434   -
435   -/**
436   - ## Error Domains
437   -
438   - The following error domain is predefined.
439   -
440   - - `NSString * const AFURLRequestSerializationErrorDomain`
441   -
442   - ### Constants
443   -
444   - `AFURLRequestSerializationErrorDomain`
445   - AFURLRequestSerializer errors. Error codes for `AFURLRequestSerializationErrorDomain` correspond to codes in `NSURLErrorDomain`.
446   - */
447   -FOUNDATION_EXPORT NSString * const AFURLRequestSerializationErrorDomain;
448   -
449   -/**
450   - ## User info dictionary keys
451   -
452   - These keys may exist in the user info dictionary, in addition to those defined for NSError.
453   -
454   - - `NSString * const AFNetworkingOperationFailingURLRequestErrorKey`
455   -
456   - ### Constants
457   -
458   - `AFNetworkingOperationFailingURLRequestErrorKey`
459   - The corresponding value is an `NSURLRequest` containing the request of the operation associated with an error. This key is only present in the `AFURLRequestSerializationErrorDomain`.
460   - */
461   -FOUNDATION_EXPORT NSString * const AFNetworkingOperationFailingURLRequestErrorKey;
462   -
463   -/**
464   - ## Throttling Bandwidth for HTTP Request Input Streams
465   -
466   - @see -throttleBandwidthWithPacketSize:delay:
467   -
468   - ### Constants
469   -
470   - `kAFUploadStream3GSuggestedPacketSize`
471   - Maximum packet size, in number of bytes. Equal to 16kb.
472   -
473   - `kAFUploadStream3GSuggestedDelay`
474   - Duration of delay each time a packet is read. Equal to 0.2 seconds.
475   - */
476   -FOUNDATION_EXPORT NSUInteger const kAFUploadStream3GSuggestedPacketSize;
477   -FOUNDATION_EXPORT NSTimeInterval const kAFUploadStream3GSuggestedDelay;
478   -
479   -NS_ASSUME_NONNULL_END
CNPublishContent/Example/Pods/AFNetworking/AFNetworking/AFURLRequestSerialization.m deleted 100644 → 0
1   -// AFURLRequestSerialization.m
2   -// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
3   -//
4   -// Permission is hereby granted, free of charge, to any person obtaining a copy
5   -// of this software and associated documentation files (the "Software"), to deal
6   -// in the Software without restriction, including without limitation the rights
7   -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8   -// copies of the Software, and to permit persons to whom the Software is
9   -// furnished to do so, subject to the following conditions:
10   -//
11   -// The above copyright notice and this permission notice shall be included in
12   -// all copies or substantial portions of the Software.
13   -//
14   -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20   -// THE SOFTWARE.
21   -
22   -#import "AFURLRequestSerialization.h"
23   -
24   -#if TARGET_OS_IOS || TARGET_OS_WATCH || TARGET_OS_TV
25   -#import <MobileCoreServices/MobileCoreServices.h>
26   -#else
27   -#import <CoreServices/CoreServices.h>
28   -#endif
29   -
30   -NSString * const AFURLRequestSerializationErrorDomain = @"com.alamofire.error.serialization.request";
31   -NSString * const AFNetworkingOperationFailingURLRequestErrorKey = @"com.alamofire.serialization.request.error.response";
32   -
33   -typedef NSString * (^AFQueryStringSerializationBlock)(NSURLRequest *request, id parameters, NSError *__autoreleasing *error);
34   -
35   -/**
36   - Returns a percent-escaped string following RFC 3986 for a query string key or value.
37   - RFC 3986 states that the following characters are "reserved" characters.
38   - - General Delimiters: ":", "#", "[", "]", "@", "?", "/"
39   - - Sub-Delimiters: "!", "$", "&", "'", "(", ")", "*", "+", ",", ";", "="
40   -
41   - In RFC 3986 - Section 3.4, it states that the "?" and "/" characters should not be escaped to allow
42   - query strings to include a URL. Therefore, all "reserved" characters with the exception of "?" and "/"
43   - should be percent-escaped in the query string.
44   - - parameter string: The string to be percent-escaped.
45   - - returns: The percent-escaped string.
46   - */
47   -NSString * AFPercentEscapedStringFromString(NSString *string) {
48   - static NSString * const kAFCharactersGeneralDelimitersToEncode = @":#[]@"; // does not include "?" or "/" due to RFC 3986 - Section 3.4
49   - static NSString * const kAFCharactersSubDelimitersToEncode = @"!$&'()*+,;=";
50   -
51   - NSMutableCharacterSet * allowedCharacterSet = [[NSCharacterSet URLQueryAllowedCharacterSet] mutableCopy];
52   - [allowedCharacterSet removeCharactersInString:[kAFCharactersGeneralDelimitersToEncode stringByAppendingString:kAFCharactersSubDelimitersToEncode]];
53   -
54   - // FIXME: https://github.com/AFNetworking/AFNetworking/pull/3028
55   - // return [string stringByAddingPercentEncodingWithAllowedCharacters:allowedCharacterSet];
56   -
57   - static NSUInteger const batchSize = 50;
58   -
59   - NSUInteger index = 0;
60   - NSMutableString *escaped = @"".mutableCopy;
61   -
62   - while (index < string.length) {
63   - NSUInteger length = MIN(string.length - index, batchSize);
64   - NSRange range = NSMakeRange(index, length);
65   -
66   - // To avoid breaking up character sequences such as 👴🏻👮🏽
67   - range = [string rangeOfComposedCharacterSequencesForRange:range];
68   -
69   - NSString *substring = [string substringWithRange:range];
70   - NSString *encoded = [substring stringByAddingPercentEncodingWithAllowedCharacters:allowedCharacterSet];
71   - [escaped appendString:encoded];
72   -
73   - index += range.length;
74   - }
75   -
76   - return escaped;
77   -}
78   -
79   -#pragma mark -
80   -
81   -@interface AFQueryStringPair : NSObject
82   -@property (readwrite, nonatomic, strong) id field;
83   -@property (readwrite, nonatomic, strong) id value;
84   -
85   -- (instancetype)initWithField:(id)field value:(id)value;
86   -
87   -- (NSString *)URLEncodedStringValue;
88   -@end
89   -
90   -@implementation AFQueryStringPair
91   -
92   -- (instancetype)initWithField:(id)field value:(id)value {
93   - self = [super init];
94   - if (!self) {
95   - return nil;
96   - }
97   -
98   - self.field = field;
99   - self.value = value;
100   -
101   - return self;
102   -}
103   -
104   -- (NSString *)URLEncodedStringValue {
105   - if (!self.value || [self.value isEqual:[NSNull null]]) {
106   - return AFPercentEscapedStringFromString([self.field description]);
107   - } else {
108   - return [NSString stringWithFormat:@"%@=%@", AFPercentEscapedStringFromString([self.field description]), AFPercentEscapedStringFromString([self.value description])];
109   - }
110   -}
111   -
112   -@end
113   -
114   -#pragma mark -
115   -
116   -FOUNDATION_EXPORT NSArray * AFQueryStringPairsFromDictionary(NSDictionary *dictionary);
117   -FOUNDATION_EXPORT NSArray * AFQueryStringPairsFromKeyAndValue(NSString *key, id value);
118   -
119   -NSString * AFQueryStringFromParameters(NSDictionary *parameters) {
120   - NSMutableArray *mutablePairs = [NSMutableArray array];
121   - for (AFQueryStringPair *pair in AFQueryStringPairsFromDictionary(parameters)) {
122   - [mutablePairs addObject:[pair URLEncodedStringValue]];
123   - }
124   -
125   - return [mutablePairs componentsJoinedByString:@"&"];
126   -}
127   -
128   -NSArray * AFQueryStringPairsFromDictionary(NSDictionary *dictionary) {
129   - return AFQueryStringPairsFromKeyAndValue(nil, dictionary);
130   -}
131   -
132   -NSArray * AFQueryStringPairsFromKeyAndValue(NSString *key, id value) {
133   - NSMutableArray *mutableQueryStringComponents = [NSMutableArray array];
134   -
135   - NSSortDescriptor *sortDescriptor = [NSSortDescriptor sortDescriptorWithKey:@"description" ascending:YES selector:@selector(compare:)];
136   -
137   - if ([value isKindOfClass:[NSDictionary class]]) {
138   - NSDictionary *dictionary = value;
139   - // Sort dictionary keys to ensure consistent ordering in query string, which is important when deserializing potentially ambiguous sequences, such as an array of dictionaries
140   - for (id nestedKey in [dictionary.allKeys sortedArrayUsingDescriptors:@[ sortDescriptor ]]) {
141   - id nestedValue = dictionary[nestedKey];
142   - if (nestedValue) {
143   - [mutableQueryStringComponents addObjectsFromArray:AFQueryStringPairsFromKeyAndValue((key ? [NSString stringWithFormat:@"%@[%@]", key, nestedKey] : nestedKey), nestedValue)];
144   - }
145   - }
146   - } else if ([value isKindOfClass:[NSArray class]]) {
147   - NSArray *array = value;
148   - for (id nestedValue in array) {
149   - [mutableQueryStringComponents addObjectsFromArray:AFQueryStringPairsFromKeyAndValue([NSString stringWithFormat:@"%@[]", key], nestedValue)];
150   - }
151   - } else if ([value isKindOfClass:[NSSet class]]) {
152   - NSSet *set = value;
153   - for (id obj in [set sortedArrayUsingDescriptors:@[ sortDescriptor ]]) {
154   - [mutableQueryStringComponents addObjectsFromArray:AFQueryStringPairsFromKeyAndValue(key, obj)];
155   - }
156   - } else {
157   - [mutableQueryStringComponents addObject:[[AFQueryStringPair alloc] initWithField:key value:value]];
158   - }
159   -
160   - return mutableQueryStringComponents;
161   -}
162   -
163   -#pragma mark -
164   -
165   -@interface AFStreamingMultipartFormData : NSObject <AFMultipartFormData>
166   -- (instancetype)initWithURLRequest:(NSMutableURLRequest *)urlRequest
167   - stringEncoding:(NSStringEncoding)encoding;
168   -
169   -- (NSMutableURLRequest *)requestByFinalizingMultipartFormData;
170   -@end
171   -
172   -#pragma mark -
173   -
174   -static NSArray * AFHTTPRequestSerializerObservedKeyPaths() {
175   - static NSArray *_AFHTTPRequestSerializerObservedKeyPaths = nil;
176   - static dispatch_once_t onceToken;
177   - dispatch_once(&onceToken, ^{
178   - _AFHTTPRequestSerializerObservedKeyPaths = @[NSStringFromSelector(@selector(allowsCellularAccess)), NSStringFromSelector(@selector(cachePolicy)), NSStringFromSelector(@selector(HTTPShouldHandleCookies)), NSStringFromSelector(@selector(HTTPShouldUsePipelining)), NSStringFromSelector(@selector(networkServiceType)), NSStringFromSelector(@selector(timeoutInterval))];
179   - });
180   -
181   - return _AFHTTPRequestSerializerObservedKeyPaths;
182   -}
183   -
184   -static void *AFHTTPRequestSerializerObserverContext = &AFHTTPRequestSerializerObserverContext;
185   -
186   -@interface AFHTTPRequestSerializer ()
187   -@property (readwrite, nonatomic, strong) NSMutableSet *mutableObservedChangedKeyPaths;
188   -@property (readwrite, nonatomic, strong) NSMutableDictionary *mutableHTTPRequestHeaders;
189   -@property (readwrite, nonatomic, strong) dispatch_queue_t requestHeaderModificationQueue;
190   -@property (readwrite, nonatomic, assign) AFHTTPRequestQueryStringSerializationStyle queryStringSerializationStyle;
191   -@property (readwrite, nonatomic, copy) AFQueryStringSerializationBlock queryStringSerialization;
192   -@end
193   -
194   -@implementation AFHTTPRequestSerializer
195   -
196   -+ (instancetype)serializer {
197   - return [[self alloc] init];
198   -}
199   -
200   -- (instancetype)init {
201   - self = [super init];
202   - if (!self) {
203   - return nil;
204   - }
205   -
206   - self.stringEncoding = NSUTF8StringEncoding;
207   -
208   - self.mutableHTTPRequestHeaders = [NSMutableDictionary dictionary];
209   - self.requestHeaderModificationQueue = dispatch_queue_create("requestHeaderModificationQueue", DISPATCH_QUEUE_CONCURRENT);
210   -
211   - // Accept-Language HTTP Header; see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.4
212   - NSMutableArray *acceptLanguagesComponents = [NSMutableArray array];
213   - [[NSLocale preferredLanguages] enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
214   - float q = 1.0f - (idx * 0.1f);
215   - [acceptLanguagesComponents addObject:[NSString stringWithFormat:@"%@;q=%0.1g", obj, q]];
216   - *stop = q <= 0.5f;
217   - }];
218   - [self setValue:[acceptLanguagesComponents componentsJoinedByString:@", "] forHTTPHeaderField:@"Accept-Language"];
219   -
220   - NSString *userAgent = nil;
221   -#if TARGET_OS_IOS
222   - // User-Agent Header; see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.43
223   - userAgent = [NSString stringWithFormat:@"%@/%@ (%@; iOS %@; Scale/%0.2f)", [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleExecutableKey] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleIdentifierKey], [[NSBundle mainBundle] infoDictionary][@"CFBundleShortVersionString"] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleVersionKey], [[UIDevice currentDevice] model], [[UIDevice currentDevice] systemVersion], [[UIScreen mainScreen] scale]];
224   -#elif TARGET_OS_WATCH
225   - // User-Agent Header; see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.43
226   - userAgent = [NSString stringWithFormat:@"%@/%@ (%@; watchOS %@; Scale/%0.2f)", [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleExecutableKey] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleIdentifierKey], [[NSBundle mainBundle] infoDictionary][@"CFBundleShortVersionString"] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleVersionKey], [[WKInterfaceDevice currentDevice] model], [[WKInterfaceDevice currentDevice] systemVersion], [[WKInterfaceDevice currentDevice] screenScale]];
227   -#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
228   - userAgent = [NSString stringWithFormat:@"%@/%@ (Mac OS X %@)", [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleExecutableKey] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleIdentifierKey], [[NSBundle mainBundle] infoDictionary][@"CFBundleShortVersionString"] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleVersionKey], [[NSProcessInfo processInfo] operatingSystemVersionString]];
229   -#endif
230   - if (userAgent) {
231   - if (![userAgent canBeConvertedToEncoding:NSASCIIStringEncoding]) {
232   - NSMutableString *mutableUserAgent = [userAgent mutableCopy];
233   - if (CFStringTransform((__bridge CFMutableStringRef)(mutableUserAgent), NULL, (__bridge CFStringRef)@"Any-Latin; Latin-ASCII; [:^ASCII:] Remove", false)) {
234   - userAgent = mutableUserAgent;
235   - }
236   - }
237   - [self setValue:userAgent forHTTPHeaderField:@"User-Agent"];
238   - }
239   -
240   - // HTTP Method Definitions; see http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html
241   - self.HTTPMethodsEncodingParametersInURI = [NSSet setWithObjects:@"GET", @"HEAD", @"DELETE", nil];
242   -
243   - self.mutableObservedChangedKeyPaths = [NSMutableSet set];
244   - for (NSString *keyPath in AFHTTPRequestSerializerObservedKeyPaths()) {
245   - if ([self respondsToSelector:NSSelectorFromString(keyPath)]) {
246   - [self addObserver:self forKeyPath:keyPath options:NSKeyValueObservingOptionNew context:AFHTTPRequestSerializerObserverContext];
247   - }
248   - }
249   -
250   - return self;
251   -}
252   -
253   -- (void)dealloc {
254   - for (NSString *keyPath in AFHTTPRequestSerializerObservedKeyPaths()) {
255   - if ([self respondsToSelector:NSSelectorFromString(keyPath)]) {
256   - [self removeObserver:self forKeyPath:keyPath context:AFHTTPRequestSerializerObserverContext];
257   - }
258   - }
259   -}
260   -
261   -#pragma mark -
262   -
263   -// Workarounds for crashing behavior using Key-Value Observing with XCTest
264   -// See https://github.com/AFNetworking/AFNetworking/issues/2523
265   -
266   -- (void)setAllowsCellularAccess:(BOOL)allowsCellularAccess {
267   - [self willChangeValueForKey:NSStringFromSelector(@selector(allowsCellularAccess))];
268   - _allowsCellularAccess = allowsCellularAccess;
269   - [self didChangeValueForKey:NSStringFromSelector(@selector(allowsCellularAccess))];
270   -}
271   -
272   -- (void)setCachePolicy:(NSURLRequestCachePolicy)cachePolicy {
273   - [self willChangeValueForKey:NSStringFromSelector(@selector(cachePolicy))];
274   - _cachePolicy = cachePolicy;
275   - [self didChangeValueForKey:NSStringFromSelector(@selector(cachePolicy))];
276   -}
277   -
278   -- (void)setHTTPShouldHandleCookies:(BOOL)HTTPShouldHandleCookies {
279   - [self willChangeValueForKey:NSStringFromSelector(@selector(HTTPShouldHandleCookies))];
280   - _HTTPShouldHandleCookies = HTTPShouldHandleCookies;
281   - [self didChangeValueForKey:NSStringFromSelector(@selector(HTTPShouldHandleCookies))];
282   -}
283   -
284   -- (void)setHTTPShouldUsePipelining:(BOOL)HTTPShouldUsePipelining {
285   - [self willChangeValueForKey:NSStringFromSelector(@selector(HTTPShouldUsePipelining))];
286   - _HTTPShouldUsePipelining = HTTPShouldUsePipelining;
287   - [self didChangeValueForKey:NSStringFromSelector(@selector(HTTPShouldUsePipelining))];
288   -}
289   -
290   -- (void)setNetworkServiceType:(NSURLRequestNetworkServiceType)networkServiceType {
291   - [self willChangeValueForKey:NSStringFromSelector(@selector(networkServiceType))];
292   - _networkServiceType = networkServiceType;
293   - [self didChangeValueForKey:NSStringFromSelector(@selector(networkServiceType))];
294   -}
295   -
296   -- (void)setTimeoutInterval:(NSTimeInterval)timeoutInterval {
297   - [self willChangeValueForKey:NSStringFromSelector(@selector(timeoutInterval))];
298   - _timeoutInterval = timeoutInterval;
299   - [self didChangeValueForKey:NSStringFromSelector(@selector(timeoutInterval))];
300   -}
301   -
302   -#pragma mark -
303   -
304   -- (NSDictionary *)HTTPRequestHeaders {
305   - NSDictionary __block *value;
306   - dispatch_sync(self.requestHeaderModificationQueue, ^{
307   - value = [NSDictionary dictionaryWithDictionary:self.mutableHTTPRequestHeaders];
308   - });
309   - return value;
310   -}
311   -
312   -- (void)setValue:(NSString *)value
313   -forHTTPHeaderField:(NSString *)field
314   -{
315   - dispatch_barrier_async(self.requestHeaderModificationQueue, ^{
316   - [self.mutableHTTPRequestHeaders setValue:value forKey:field];
317   - });
318   -}
319   -
320   -- (NSString *)valueForHTTPHeaderField:(NSString *)field {
321   - NSString __block *value;
322   - dispatch_sync(self.requestHeaderModificationQueue, ^{
323   - value = [self.mutableHTTPRequestHeaders valueForKey:field];
324   - });
325   - return value;
326   -}
327   -
328   -- (void)setAuthorizationHeaderFieldWithUsername:(NSString *)username
329   - password:(NSString *)password
330   -{
331   - NSData *basicAuthCredentials = [[NSString stringWithFormat:@"%@:%@", username, password] dataUsingEncoding:NSUTF8StringEncoding];
332   - NSString *base64AuthCredentials = [basicAuthCredentials base64EncodedStringWithOptions:(NSDataBase64EncodingOptions)0];
333   - [self setValue:[NSString stringWithFormat:@"Basic %@", base64AuthCredentials] forHTTPHeaderField:@"Authorization"];
334   -}
335   -
336   -- (void)clearAuthorizationHeader {
337   - dispatch_barrier_async(self.requestHeaderModificationQueue, ^{
338   - [self.mutableHTTPRequestHeaders removeObjectForKey:@"Authorization"];
339   - });
340   -}
341   -
342   -#pragma mark -
343   -
344   -- (void)setQueryStringSerializationWithStyle:(AFHTTPRequestQueryStringSerializationStyle)style {
345   - self.queryStringSerializationStyle = style;
346   - self.queryStringSerialization = nil;
347   -}
348   -
349   -- (void)setQueryStringSerializationWithBlock:(NSString *(^)(NSURLRequest *, id, NSError *__autoreleasing *))block {
350   - self.queryStringSerialization = block;
351   -}
352   -
353   -#pragma mark -
354   -
355   -- (NSMutableURLRequest *)requestWithMethod:(NSString *)method
356   - URLString:(NSString *)URLString
357   - parameters:(id)parameters
358   - error:(NSError *__autoreleasing *)error
359   -{
360   - NSParameterAssert(method);
361   - NSParameterAssert(URLString);
362   -
363   - NSURL *url = [NSURL URLWithString:URLString];
364   -
365   - NSParameterAssert(url);
366   -
367   - NSMutableURLRequest *mutableRequest = [[NSMutableURLRequest alloc] initWithURL:url];
368   - mutableRequest.HTTPMethod = method;
369   -
370   - for (NSString *keyPath in AFHTTPRequestSerializerObservedKeyPaths()) {
371   - if ([self.mutableObservedChangedKeyPaths containsObject:keyPath]) {
372   - [mutableRequest setValue:[self valueForKeyPath:keyPath] forKey:keyPath];
373   - }
374   - }
375   -
376   - mutableRequest = [[self requestBySerializingRequest:mutableRequest withParameters:parameters error:error] mutableCopy];
377   -
378   - return mutableRequest;
379   -}
380   -
381   -- (NSMutableURLRequest *)multipartFormRequestWithMethod:(NSString *)method
382   - URLString:(NSString *)URLString
383   - parameters:(NSDictionary *)parameters
384   - constructingBodyWithBlock:(void (^)(id <AFMultipartFormData> formData))block
385   - error:(NSError *__autoreleasing *)error
386   -{
387   - NSParameterAssert(method);
388   - NSParameterAssert(![method isEqualToString:@"GET"] && ![method isEqualToString:@"HEAD"]);
389   -
390   - NSMutableURLRequest *mutableRequest = [self requestWithMethod:method URLString:URLString parameters:nil error:error];
391   -
392   - __block AFStreamingMultipartFormData *formData = [[AFStreamingMultipartFormData alloc] initWithURLRequest:mutableRequest stringEncoding:NSUTF8StringEncoding];
393   -
394   - if (parameters) {
395   - for (AFQueryStringPair *pair in AFQueryStringPairsFromDictionary(parameters)) {
396   - NSData *data = nil;
397   - if ([pair.value isKindOfClass:[NSData class]]) {
398   - data = pair.value;
399   - } else if ([pair.value isEqual:[NSNull null]]) {
400   - data = [NSData data];
401   - } else {
402   - data = [[pair.value description] dataUsingEncoding:self.stringEncoding];
403   - }
404   -
405   - if (data) {
406   - [formData appendPartWithFormData:data name:[pair.field description]];
407   - }
408   - }
409   - }
410   -
411   - if (block) {
412   - block(formData);
413   - }
414   -
415   - return [formData requestByFinalizingMultipartFormData];
416   -}
417   -
418   -- (NSMutableURLRequest *)requestWithMultipartFormRequest:(NSURLRequest *)request
419   - writingStreamContentsToFile:(NSURL *)fileURL
420   - completionHandler:(void (^)(NSError *error))handler
421   -{
422   - NSParameterAssert(request.HTTPBodyStream);
423   - NSParameterAssert([fileURL isFileURL]);
424   -
425   - NSInputStream *inputStream = request.HTTPBodyStream;
426   - NSOutputStream *outputStream = [[NSOutputStream alloc] initWithURL:fileURL append:NO];
427   - __block NSError *error = nil;
428   -
429   - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
430   - [inputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
431   - [outputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
432   -
433   - [inputStream open];
434   - [outputStream open];
435   -
436   - while ([inputStream hasBytesAvailable] && [outputStream hasSpaceAvailable]) {
437   - uint8_t buffer[1024];
438   -
439   - NSInteger bytesRead = [inputStream read:buffer maxLength:1024];
440   - if (inputStream.streamError || bytesRead < 0) {
441   - error = inputStream.streamError;
442   - break;
443   - }
444   -
445   - NSInteger bytesWritten = [outputStream write:buffer maxLength:(NSUInteger)bytesRead];
446   - if (outputStream.streamError || bytesWritten < 0) {
447   - error = outputStream.streamError;
448   - break;
449   - }
450   -
451   - if (bytesRead == 0 && bytesWritten == 0) {
452   - break;
453   - }
454   - }
455   -
456   - [outputStream close];
457   - [inputStream close];
458   -
459   - if (handler) {
460   - dispatch_async(dispatch_get_main_queue(), ^{
461   - handler(error);
462   - });
463   - }
464   - });
465   -
466   - NSMutableURLRequest *mutableRequest = [request mutableCopy];
467   - mutableRequest.HTTPBodyStream = nil;
468   -
469   - return mutableRequest;
470   -}
471   -
472   -#pragma mark - AFURLRequestSerialization
473   -
474   -- (NSURLRequest *)requestBySerializingRequest:(NSURLRequest *)request
475   - withParameters:(id)parameters
476   - error:(NSError *__autoreleasing *)error
477   -{
478   - NSParameterAssert(request);
479   -
480   - NSMutableURLRequest *mutableRequest = [request mutableCopy];
481   -
482   - [self.HTTPRequestHeaders enumerateKeysAndObjectsUsingBlock:^(id field, id value, BOOL * __unused stop) {
483   - if (![request valueForHTTPHeaderField:field]) {
484   - [mutableRequest setValue:value forHTTPHeaderField:field];
485   - }
486   - }];
487   -
488   - NSString *query = nil;
489   - if (parameters) {
490   - if (self.queryStringSerialization) {
491   - NSError *serializationError;
492   - query = self.queryStringSerialization(request, parameters, &serializationError);
493   -
494   - if (serializationError) {
495   - if (error) {
496   - *error = serializationError;
497   - }
498   -
499   - return nil;
500   - }
501   - } else {
502   - switch (self.queryStringSerializationStyle) {
503   - case AFHTTPRequestQueryStringDefaultStyle:
504   - query = AFQueryStringFromParameters(parameters);
505   - break;
506   - }
507   - }
508   - }
509   -
510   - if ([self.HTTPMethodsEncodingParametersInURI containsObject:[[request HTTPMethod] uppercaseString]]) {
511   - if (query && query.length > 0) {
512   - mutableRequest.URL = [NSURL URLWithString:[[mutableRequest.URL absoluteString] stringByAppendingFormat:mutableRequest.URL.query ? @"&%@" : @"?%@", query]];
513   - }
514   - } else {
515   - // #2864: an empty string is a valid x-www-form-urlencoded payload
516   - if (!query) {
517   - query = @"";
518   - }
519   - if (![mutableRequest valueForHTTPHeaderField:@"Content-Type"]) {
520   - [mutableRequest setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
521   - }
522   - [mutableRequest setHTTPBody:[query dataUsingEncoding:self.stringEncoding]];
523   - }
524   -
525   - return mutableRequest;
526   -}
527   -
528   -#pragma mark - NSKeyValueObserving
529   -
530   -+ (BOOL)automaticallyNotifiesObserversForKey:(NSString *)key {
531   - if ([AFHTTPRequestSerializerObservedKeyPaths() containsObject:key]) {
532   - return NO;
533   - }
534   -
535   - return [super automaticallyNotifiesObserversForKey:key];
536   -}
537   -
538   -- (void)observeValueForKeyPath:(NSString *)keyPath
539   - ofObject:(__unused id)object
540   - change:(NSDictionary *)change
541   - context:(void *)context
542   -{
543   - if (context == AFHTTPRequestSerializerObserverContext) {
544   - if ([change[NSKeyValueChangeNewKey] isEqual:[NSNull null]]) {
545   - [self.mutableObservedChangedKeyPaths removeObject:keyPath];
546   - } else {
547   - [self.mutableObservedChangedKeyPaths addObject:keyPath];
548   - }
549   - }
550   -}
551   -
552   -#pragma mark - NSSecureCoding
553   -
554   -+ (BOOL)supportsSecureCoding {
555   - return YES;
556   -}
557   -
558   -- (instancetype)initWithCoder:(NSCoder *)decoder {
559   - self = [self init];
560   - if (!self) {
561   - return nil;
562   - }
563   -
564   - self.mutableHTTPRequestHeaders = [[decoder decodeObjectOfClass:[NSDictionary class] forKey:NSStringFromSelector(@selector(mutableHTTPRequestHeaders))] mutableCopy];
565   - self.queryStringSerializationStyle = (AFHTTPRequestQueryStringSerializationStyle)[[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(queryStringSerializationStyle))] unsignedIntegerValue];
566   -
567   - return self;
568   -}
569   -
570   -- (void)encodeWithCoder:(NSCoder *)coder {
571   - dispatch_sync(self.requestHeaderModificationQueue, ^{
572   - [coder encodeObject:self.mutableHTTPRequestHeaders forKey:NSStringFromSelector(@selector(mutableHTTPRequestHeaders))];
573   - });
574   - [coder encodeInteger:self.queryStringSerializationStyle forKey:NSStringFromSelector(@selector(queryStringSerializationStyle))];
575   -}
576   -
577   -#pragma mark - NSCopying
578   -
579   -- (instancetype)copyWithZone:(NSZone *)zone {
580   - AFHTTPRequestSerializer *serializer = [[[self class] allocWithZone:zone] init];
581   - dispatch_sync(self.requestHeaderModificationQueue, ^{
582   - serializer.mutableHTTPRequestHeaders = [self.mutableHTTPRequestHeaders mutableCopyWithZone:zone];
583   - });
584   - serializer.queryStringSerializationStyle = self.queryStringSerializationStyle;
585   - serializer.queryStringSerialization = self.queryStringSerialization;
586   -
587   - return serializer;
588   -}
589   -
590   -@end
591   -
592   -#pragma mark -
593   -
594   -static NSString * AFCreateMultipartFormBoundary() {
595   - return [NSString stringWithFormat:@"Boundary+%08X%08X", arc4random(), arc4random()];
596   -}
597   -
598   -static NSString * const kAFMultipartFormCRLF = @"\r\n";
599   -
600   -static inline NSString * AFMultipartFormInitialBoundary(NSString *boundary) {
601   - return [NSString stringWithFormat:@"--%@%@", boundary, kAFMultipartFormCRLF];
602   -}
603   -
604   -static inline NSString * AFMultipartFormEncapsulationBoundary(NSString *boundary) {
605   - return [NSString stringWithFormat:@"%@--%@%@", kAFMultipartFormCRLF, boundary, kAFMultipartFormCRLF];
606   -}
607   -
608   -static inline NSString * AFMultipartFormFinalBoundary(NSString *boundary) {
609   - return [NSString stringWithFormat:@"%@--%@--%@", kAFMultipartFormCRLF, boundary, kAFMultipartFormCRLF];
610   -}
611   -
612   -static inline NSString * AFContentTypeForPathExtension(NSString *extension) {
613   - NSString *UTI = (__bridge_transfer NSString *)UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, (__bridge CFStringRef)extension, NULL);
614   - NSString *contentType = (__bridge_transfer NSString *)UTTypeCopyPreferredTagWithClass((__bridge CFStringRef)UTI, kUTTagClassMIMEType);
615   - if (!contentType) {
616   - return @"application/octet-stream";
617   - } else {
618   - return contentType;
619   - }
620   -}
621   -
622   -NSUInteger const kAFUploadStream3GSuggestedPacketSize = 1024 * 16;
623   -NSTimeInterval const kAFUploadStream3GSuggestedDelay = 0.2;
624   -
625   -@interface AFHTTPBodyPart : NSObject
626   -@property (nonatomic, assign) NSStringEncoding stringEncoding;
627   -@property (nonatomic, strong) NSDictionary *headers;
628   -@property (nonatomic, copy) NSString *boundary;
629   -@property (nonatomic, strong) id body;
630   -@property (nonatomic, assign) unsigned long long bodyContentLength;
631   -@property (nonatomic, strong) NSInputStream *inputStream;
632   -
633   -@property (nonatomic, assign) BOOL hasInitialBoundary;
634   -@property (nonatomic, assign) BOOL hasFinalBoundary;
635   -
636   -@property (readonly, nonatomic, assign, getter = hasBytesAvailable) BOOL bytesAvailable;
637   -@property (readonly, nonatomic, assign) unsigned long long contentLength;
638   -
639   -- (NSInteger)read:(uint8_t *)buffer
640   - maxLength:(NSUInteger)length;
641   -@end
642   -
643   -@interface AFMultipartBodyStream : NSInputStream <NSStreamDelegate>
644   -@property (nonatomic, assign) NSUInteger numberOfBytesInPacket;
645   -@property (nonatomic, assign) NSTimeInterval delay;
646   -@property (nonatomic, strong) NSInputStream *inputStream;
647   -@property (readonly, nonatomic, assign) unsigned long long contentLength;
648   -@property (readonly, nonatomic, assign, getter = isEmpty) BOOL empty;
649   -
650   -- (instancetype)initWithStringEncoding:(NSStringEncoding)encoding;
651   -- (void)setInitialAndFinalBoundaries;
652   -- (void)appendHTTPBodyPart:(AFHTTPBodyPart *)bodyPart;
653   -@end
654   -
655   -#pragma mark -
656   -
657   -@interface AFStreamingMultipartFormData ()
658   -@property (readwrite, nonatomic, copy) NSMutableURLRequest *request;
659   -@property (readwrite, nonatomic, assign) NSStringEncoding stringEncoding;
660   -@property (readwrite, nonatomic, copy) NSString *boundary;
661   -@property (readwrite, nonatomic, strong) AFMultipartBodyStream *bodyStream;
662   -@end
663   -
664   -@implementation AFStreamingMultipartFormData
665   -
666   -- (instancetype)initWithURLRequest:(NSMutableURLRequest *)urlRequest
667   - stringEncoding:(NSStringEncoding)encoding
668   -{
669   - self = [super init];
670   - if (!self) {
671   - return nil;
672   - }
673   -
674   - self.request = urlRequest;
675   - self.stringEncoding = encoding;
676   - self.boundary = AFCreateMultipartFormBoundary();
677   - self.bodyStream = [[AFMultipartBodyStream alloc] initWithStringEncoding:encoding];
678   -
679   - return self;
680   -}
681   -
682   -- (void)setRequest:(NSMutableURLRequest *)request
683   -{
684   - _request = [request mutableCopy];
685   -}
686   -
687   -- (BOOL)appendPartWithFileURL:(NSURL *)fileURL
688   - name:(NSString *)name
689   - error:(NSError * __autoreleasing *)error
690   -{
691   - NSParameterAssert(fileURL);
692   - NSParameterAssert(name);
693   -
694   - NSString *fileName = [fileURL lastPathComponent];
695   - NSString *mimeType = AFContentTypeForPathExtension([fileURL pathExtension]);
696   -
697   - return [self appendPartWithFileURL:fileURL name:name fileName:fileName mimeType:mimeType error:error];
698   -}
699   -
700   -- (BOOL)appendPartWithFileURL:(NSURL *)fileURL
701   - name:(NSString *)name
702   - fileName:(NSString *)fileName
703   - mimeType:(NSString *)mimeType
704   - error:(NSError * __autoreleasing *)error
705   -{
706   - NSParameterAssert(fileURL);
707   - NSParameterAssert(name);
708   - NSParameterAssert(fileName);
709   - NSParameterAssert(mimeType);
710   -
711   - if (![fileURL isFileURL]) {
712   - NSDictionary *userInfo = @{NSLocalizedFailureReasonErrorKey: NSLocalizedStringFromTable(@"Expected URL to be a file URL", @"AFNetworking", nil)};
713   - if (error) {
714   - *error = [[NSError alloc] initWithDomain:AFURLRequestSerializationErrorDomain code:NSURLErrorBadURL userInfo:userInfo];
715   - }
716   -
717   - return NO;
718   - } else if ([fileURL checkResourceIsReachableAndReturnError:error] == NO) {
719   - NSDictionary *userInfo = @{NSLocalizedFailureReasonErrorKey: NSLocalizedStringFromTable(@"File URL not reachable.", @"AFNetworking", nil)};
720   - if (error) {
721   - *error = [[NSError alloc] initWithDomain:AFURLRequestSerializationErrorDomain code:NSURLErrorBadURL userInfo:userInfo];
722   - }
723   -
724   - return NO;
725   - }
726   -
727   - NSDictionary *fileAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:[fileURL path] error:error];
728   - if (!fileAttributes) {
729   - return NO;
730   - }
731   -
732   - NSMutableDictionary *mutableHeaders = [NSMutableDictionary dictionary];
733   - [mutableHeaders setValue:[NSString stringWithFormat:@"form-data; name=\"%@\"; filename=\"%@\"", name, fileName] forKey:@"Content-Disposition"];
734   - [mutableHeaders setValue:mimeType forKey:@"Content-Type"];
735   -
736   - AFHTTPBodyPart *bodyPart = [[AFHTTPBodyPart alloc] init];
737   - bodyPart.stringEncoding = self.stringEncoding;
738   - bodyPart.headers = mutableHeaders;
739   - bodyPart.boundary = self.boundary;
740   - bodyPart.body = fileURL;
741   - bodyPart.bodyContentLength = [fileAttributes[NSFileSize] unsignedLongLongValue];
742   - [self.bodyStream appendHTTPBodyPart:bodyPart];
743   -
744   - return YES;
745   -}
746   -
747   -- (void)appendPartWithInputStream:(NSInputStream *)inputStream
748   - name:(NSString *)name
749   - fileName:(NSString *)fileName
750   - length:(int64_t)length
751   - mimeType:(NSString *)mimeType
752   -{
753   - NSParameterAssert(name);
754   - NSParameterAssert(fileName);
755   - NSParameterAssert(mimeType);
756   -
757   - NSMutableDictionary *mutableHeaders = [NSMutableDictionary dictionary];
758   - [mutableHeaders setValue:[NSString stringWithFormat:@"form-data; name=\"%@\"; filename=\"%@\"", name, fileName] forKey:@"Content-Disposition"];
759   - [mutableHeaders setValue:mimeType forKey:@"Content-Type"];
760   -
761   - AFHTTPBodyPart *bodyPart = [[AFHTTPBodyPart alloc] init];
762   - bodyPart.stringEncoding = self.stringEncoding;
763   - bodyPart.headers = mutableHeaders;
764   - bodyPart.boundary = self.boundary;
765   - bodyPart.body = inputStream;
766   -
767   - bodyPart.bodyContentLength = (unsigned long long)length;
768   -
769   - [self.bodyStream appendHTTPBodyPart:bodyPart];
770   -}
771   -
772   -- (void)appendPartWithFileData:(NSData *)data
773   - name:(NSString *)name
774   - fileName:(NSString *)fileName
775   - mimeType:(NSString *)mimeType
776   -{
777   - NSParameterAssert(name);
778   - NSParameterAssert(fileName);
779   - NSParameterAssert(mimeType);
780   -
781   - NSMutableDictionary *mutableHeaders = [NSMutableDictionary dictionary];
782   - [mutableHeaders setValue:[NSString stringWithFormat:@"form-data; name=\"%@\"; filename=\"%@\"", name, fileName] forKey:@"Content-Disposition"];
783   - [mutableHeaders setValue:mimeType forKey:@"Content-Type"];
784   -
785   - [self appendPartWithHeaders:mutableHeaders body:data];
786   -}
787   -
788   -- (void)appendPartWithFormData:(NSData *)data
789   - name:(NSString *)name
790   -{
791   - NSParameterAssert(name);
792   -
793   - NSMutableDictionary *mutableHeaders = [NSMutableDictionary dictionary];
794   - [mutableHeaders setValue:[NSString stringWithFormat:@"form-data; name=\"%@\"", name] forKey:@"Content-Disposition"];
795   -
796   - [self appendPartWithHeaders:mutableHeaders body:data];
797   -}
798   -
799   -- (void)appendPartWithHeaders:(NSDictionary *)headers
800   - body:(NSData *)body
801   -{
802   - NSParameterAssert(body);
803   -
804   - AFHTTPBodyPart *bodyPart = [[AFHTTPBodyPart alloc] init];
805   - bodyPart.stringEncoding = self.stringEncoding;
806   - bodyPart.headers = headers;
807   - bodyPart.boundary = self.boundary;
808   - bodyPart.bodyContentLength = [body length];
809   - bodyPart.body = body;
810   -
811   - [self.bodyStream appendHTTPBodyPart:bodyPart];
812   -}
813   -
814   -- (void)throttleBandwidthWithPacketSize:(NSUInteger)numberOfBytes
815   - delay:(NSTimeInterval)delay
816   -{
817   - self.bodyStream.numberOfBytesInPacket = numberOfBytes;
818   - self.bodyStream.delay = delay;
819   -}
820   -
821   -- (NSMutableURLRequest *)requestByFinalizingMultipartFormData {
822   - if ([self.bodyStream isEmpty]) {
823   - return self.request;
824   - }
825   -
826   - // Reset the initial and final boundaries to ensure correct Content-Length
827   - [self.bodyStream setInitialAndFinalBoundaries];
828   - [self.request setHTTPBodyStream:self.bodyStream];
829   -
830   - [self.request setValue:[NSString stringWithFormat:@"multipart/form-data; boundary=%@", self.boundary] forHTTPHeaderField:@"Content-Type"];
831   - [self.request setValue:[NSString stringWithFormat:@"%llu", [self.bodyStream contentLength]] forHTTPHeaderField:@"Content-Length"];
832   -
833   - return self.request;
834   -}
835   -
836   -@end
837   -
838   -#pragma mark -
839   -
840   -@interface NSStream ()
841   -@property (readwrite) NSStreamStatus streamStatus;
842   -@property (readwrite, copy) NSError *streamError;
843   -@end
844   -
845   -@interface AFMultipartBodyStream () <NSCopying>
846   -@property (readwrite, nonatomic, assign) NSStringEncoding stringEncoding;
847   -@property (readwrite, nonatomic, strong) NSMutableArray *HTTPBodyParts;
848   -@property (readwrite, nonatomic, strong) NSEnumerator *HTTPBodyPartEnumerator;
849   -@property (readwrite, nonatomic, strong) AFHTTPBodyPart *currentHTTPBodyPart;
850   -@property (readwrite, nonatomic, strong) NSOutputStream *outputStream;
851   -@property (readwrite, nonatomic, strong) NSMutableData *buffer;
852   -@end
853   -
854   -@implementation AFMultipartBodyStream
855   -#if (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000) || (defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 1100)
856   -@synthesize delegate;
857   -#endif
858   -@synthesize streamStatus;
859   -@synthesize streamError;
860   -
861   -- (instancetype)initWithStringEncoding:(NSStringEncoding)encoding {
862   - self = [super init];
863   - if (!self) {
864   - return nil;
865   - }
866   -
867   - self.stringEncoding = encoding;
868   - self.HTTPBodyParts = [NSMutableArray array];
869   - self.numberOfBytesInPacket = NSIntegerMax;
870   -
871   - return self;
872   -}
873   -
874   -- (void)setInitialAndFinalBoundaries {
875   - if ([self.HTTPBodyParts count] > 0) {
876   - for (AFHTTPBodyPart *bodyPart in self.HTTPBodyParts) {
877   - bodyPart.hasInitialBoundary = NO;
878   - bodyPart.hasFinalBoundary = NO;
879   - }
880   -
881   - [[self.HTTPBodyParts firstObject] setHasInitialBoundary:YES];
882   - [[self.HTTPBodyParts lastObject] setHasFinalBoundary:YES];
883   - }
884   -}
885   -
886   -- (void)appendHTTPBodyPart:(AFHTTPBodyPart *)bodyPart {
887   - [self.HTTPBodyParts addObject:bodyPart];
888   -}
889   -
890   -- (BOOL)isEmpty {
891   - return [self.HTTPBodyParts count] == 0;
892   -}
893   -
894   -#pragma mark - NSInputStream
895   -
896   -- (NSInteger)read:(uint8_t *)buffer
897   - maxLength:(NSUInteger)length
898   -{
899   - if ([self streamStatus] == NSStreamStatusClosed) {
900   - return 0;
901   - }
902   -
903   - NSInteger totalNumberOfBytesRead = 0;
904   -
905   - while ((NSUInteger)totalNumberOfBytesRead < MIN(length, self.numberOfBytesInPacket)) {
906   - if (!self.currentHTTPBodyPart || ![self.currentHTTPBodyPart hasBytesAvailable]) {
907   - if (!(self.currentHTTPBodyPart = [self.HTTPBodyPartEnumerator nextObject])) {
908   - break;
909   - }
910   - } else {
911   - NSUInteger maxLength = MIN(length, self.numberOfBytesInPacket) - (NSUInteger)totalNumberOfBytesRead;
912   - NSInteger numberOfBytesRead = [self.currentHTTPBodyPart read:&buffer[totalNumberOfBytesRead] maxLength:maxLength];
913   - if (numberOfBytesRead == -1) {
914   - self.streamError = self.currentHTTPBodyPart.inputStream.streamError;
915   - break;
916   - } else {
917   - totalNumberOfBytesRead += numberOfBytesRead;
918   -
919   - if (self.delay > 0.0f) {
920   - [NSThread sleepForTimeInterval:self.delay];
921   - }
922   - }
923   - }
924   - }
925   -
926   - return totalNumberOfBytesRead;
927   -}
928   -
929   -- (BOOL)getBuffer:(__unused uint8_t **)buffer
930   - length:(__unused NSUInteger *)len
931   -{
932   - return NO;
933   -}
934   -
935   -- (BOOL)hasBytesAvailable {
936   - return [self streamStatus] == NSStreamStatusOpen;
937   -}
938   -
939   -#pragma mark - NSStream
940   -
941   -- (void)open {
942   - if (self.streamStatus == NSStreamStatusOpen) {
943   - return;
944   - }
945   -
946   - self.streamStatus = NSStreamStatusOpen;
947   -
948   - [self setInitialAndFinalBoundaries];
949   - self.HTTPBodyPartEnumerator = [self.HTTPBodyParts objectEnumerator];
950   -}
951   -
952   -- (void)close {
953   - self.streamStatus = NSStreamStatusClosed;
954   -}
955   -
956   -- (id)propertyForKey:(__unused NSString *)key {
957   - return nil;
958   -}
959   -
960   -- (BOOL)setProperty:(__unused id)property
961   - forKey:(__unused NSString *)key
962   -{
963   - return NO;
964   -}
965   -
966   -- (void)scheduleInRunLoop:(__unused NSRunLoop *)aRunLoop
967   - forMode:(__unused NSString *)mode
968   -{}
969   -
970   -- (void)removeFromRunLoop:(__unused NSRunLoop *)aRunLoop
971   - forMode:(__unused NSString *)mode
972   -{}
973   -
974   -- (unsigned long long)contentLength {
975   - unsigned long long length = 0;
976   - for (AFHTTPBodyPart *bodyPart in self.HTTPBodyParts) {
977   - length += [bodyPart contentLength];
978   - }
979   -
980   - return length;
981   -}
982   -
983   -#pragma mark - Undocumented CFReadStream Bridged Methods
984   -
985   -- (void)_scheduleInCFRunLoop:(__unused CFRunLoopRef)aRunLoop
986   - forMode:(__unused CFStringRef)aMode
987   -{}
988   -
989   -- (void)_unscheduleFromCFRunLoop:(__unused CFRunLoopRef)aRunLoop
990   - forMode:(__unused CFStringRef)aMode
991   -{}
992   -
993   -- (BOOL)_setCFClientFlags:(__unused CFOptionFlags)inFlags
994   - callback:(__unused CFReadStreamClientCallBack)inCallback
995   - context:(__unused CFStreamClientContext *)inContext {
996   - return NO;
997   -}
998   -
999   -#pragma mark - NSCopying
1000   -
1001   -- (instancetype)copyWithZone:(NSZone *)zone {
1002   - AFMultipartBodyStream *bodyStreamCopy = [[[self class] allocWithZone:zone] initWithStringEncoding:self.stringEncoding];
1003   -
1004   - for (AFHTTPBodyPart *bodyPart in self.HTTPBodyParts) {
1005   - [bodyStreamCopy appendHTTPBodyPart:[bodyPart copy]];
1006   - }
1007   -
1008   - [bodyStreamCopy setInitialAndFinalBoundaries];
1009   -
1010   - return bodyStreamCopy;
1011   -}
1012   -
1013   -@end
1014   -
1015   -#pragma mark -
1016   -
1017   -typedef enum {
1018   - AFEncapsulationBoundaryPhase = 1,
1019   - AFHeaderPhase = 2,
1020   - AFBodyPhase = 3,
1021   - AFFinalBoundaryPhase = 4,
1022   -} AFHTTPBodyPartReadPhase;
1023   -
1024   -@interface AFHTTPBodyPart () <NSCopying> {
1025   - AFHTTPBodyPartReadPhase _phase;
1026   - NSInputStream *_inputStream;
1027   - unsigned long long _phaseReadOffset;
1028   -}
1029   -
1030   -- (BOOL)transitionToNextPhase;
1031   -- (NSInteger)readData:(NSData *)data
1032   - intoBuffer:(uint8_t *)buffer
1033   - maxLength:(NSUInteger)length;
1034   -@end
1035   -
1036   -@implementation AFHTTPBodyPart
1037   -
1038   -- (instancetype)init {
1039   - self = [super init];
1040   - if (!self) {
1041   - return nil;
1042   - }
1043   -
1044   - [self transitionToNextPhase];
1045   -
1046   - return self;
1047   -}
1048   -
1049   -- (void)dealloc {
1050   - if (_inputStream) {
1051   - [_inputStream close];
1052   - _inputStream = nil;
1053   - }
1054   -}
1055   -
1056   -- (NSInputStream *)inputStream {
1057   - if (!_inputStream) {
1058   - if ([self.body isKindOfClass:[NSData class]]) {
1059   - _inputStream = [NSInputStream inputStreamWithData:self.body];
1060   - } else if ([self.body isKindOfClass:[NSURL class]]) {
1061   - _inputStream = [NSInputStream inputStreamWithURL:self.body];
1062   - } else if ([self.body isKindOfClass:[NSInputStream class]]) {
1063   - _inputStream = self.body;
1064   - } else {
1065   - _inputStream = [NSInputStream inputStreamWithData:[NSData data]];
1066   - }
1067   - }
1068   -
1069   - return _inputStream;
1070   -}
1071   -
1072   -- (NSString *)stringForHeaders {
1073   - NSMutableString *headerString = [NSMutableString string];
1074   - for (NSString *field in [self.headers allKeys]) {
1075   - [headerString appendString:[NSString stringWithFormat:@"%@: %@%@", field, [self.headers valueForKey:field], kAFMultipartFormCRLF]];
1076   - }
1077   - [headerString appendString:kAFMultipartFormCRLF];
1078   -
1079   - return [NSString stringWithString:headerString];
1080   -}
1081   -
1082   -- (unsigned long long)contentLength {
1083   - unsigned long long length = 0;
1084   -
1085   - NSData *encapsulationBoundaryData = [([self hasInitialBoundary] ? AFMultipartFormInitialBoundary(self.boundary) : AFMultipartFormEncapsulationBoundary(self.boundary)) dataUsingEncoding:self.stringEncoding];
1086   - length += [encapsulationBoundaryData length];
1087   -
1088   - NSData *headersData = [[self stringForHeaders] dataUsingEncoding:self.stringEncoding];
1089   - length += [headersData length];
1090   -
1091   - length += _bodyContentLength;
1092   -
1093   - NSData *closingBoundaryData = ([self hasFinalBoundary] ? [AFMultipartFormFinalBoundary(self.boundary) dataUsingEncoding:self.stringEncoding] : [NSData data]);
1094   - length += [closingBoundaryData length];
1095   -
1096   - return length;
1097   -}
1098   -
1099   -- (BOOL)hasBytesAvailable {
1100   - // Allows `read:maxLength:` to be called again if `AFMultipartFormFinalBoundary` doesn't fit into the available buffer
1101   - if (_phase == AFFinalBoundaryPhase) {
1102   - return YES;
1103   - }
1104   -
1105   - switch (self.inputStream.streamStatus) {
1106   - case NSStreamStatusNotOpen:
1107   - case NSStreamStatusOpening:
1108   - case NSStreamStatusOpen:
1109   - case NSStreamStatusReading:
1110   - case NSStreamStatusWriting:
1111   - return YES;
1112   - case NSStreamStatusAtEnd:
1113   - case NSStreamStatusClosed:
1114   - case NSStreamStatusError:
1115   - default:
1116   - return NO;
1117   - }
1118   -}
1119   -
1120   -- (NSInteger)read:(uint8_t *)buffer
1121   - maxLength:(NSUInteger)length
1122   -{
1123   - NSInteger totalNumberOfBytesRead = 0;
1124   -
1125   - if (_phase == AFEncapsulationBoundaryPhase) {
1126   - NSData *encapsulationBoundaryData = [([self hasInitialBoundary] ? AFMultipartFormInitialBoundary(self.boundary) : AFMultipartFormEncapsulationBoundary(self.boundary)) dataUsingEncoding:self.stringEncoding];
1127   - totalNumberOfBytesRead += [self readData:encapsulationBoundaryData intoBuffer:&buffer[totalNumberOfBytesRead] maxLength:(length - (NSUInteger)totalNumberOfBytesRead)];
1128   - }
1129   -
1130   - if (_phase == AFHeaderPhase) {
1131   - NSData *headersData = [[self stringForHeaders] dataUsingEncoding:self.stringEncoding];
1132   - totalNumberOfBytesRead += [self readData:headersData intoBuffer:&buffer[totalNumberOfBytesRead] maxLength:(length - (NSUInteger)totalNumberOfBytesRead)];
1133   - }
1134   -
1135   - if (_phase == AFBodyPhase) {
1136   - NSInteger numberOfBytesRead = 0;
1137   -
1138   - numberOfBytesRead = [self.inputStream read:&buffer[totalNumberOfBytesRead] maxLength:(length - (NSUInteger)totalNumberOfBytesRead)];
1139   - if (numberOfBytesRead == -1) {
1140   - return -1;
1141   - } else {
1142   - totalNumberOfBytesRead += numberOfBytesRead;
1143   -
1144   - if ([self.inputStream streamStatus] >= NSStreamStatusAtEnd) {
1145   - [self transitionToNextPhase];
1146   - }
1147   - }
1148   - }
1149   -
1150   - if (_phase == AFFinalBoundaryPhase) {
1151   - NSData *closingBoundaryData = ([self hasFinalBoundary] ? [AFMultipartFormFinalBoundary(self.boundary) dataUsingEncoding:self.stringEncoding] : [NSData data]);
1152   - totalNumberOfBytesRead += [self readData:closingBoundaryData intoBuffer:&buffer[totalNumberOfBytesRead] maxLength:(length - (NSUInteger)totalNumberOfBytesRead)];
1153   - }
1154   -
1155   - return totalNumberOfBytesRead;
1156   -}
1157   -
1158   -- (NSInteger)readData:(NSData *)data
1159   - intoBuffer:(uint8_t *)buffer
1160   - maxLength:(NSUInteger)length
1161   -{
1162   - NSRange range = NSMakeRange((NSUInteger)_phaseReadOffset, MIN([data length] - ((NSUInteger)_phaseReadOffset), length));
1163   - [data getBytes:buffer range:range];
1164   -
1165   - _phaseReadOffset += range.length;
1166   -
1167   - if (((NSUInteger)_phaseReadOffset) >= [data length]) {
1168   - [self transitionToNextPhase];
1169   - }
1170   -
1171   - return (NSInteger)range.length;
1172   -}
1173   -
1174   -- (BOOL)transitionToNextPhase {
1175   - if (![[NSThread currentThread] isMainThread]) {
1176   - dispatch_sync(dispatch_get_main_queue(), ^{
1177   - [self transitionToNextPhase];
1178   - });
1179   - return YES;
1180   - }
1181   -
1182   - switch (_phase) {
1183   - case AFEncapsulationBoundaryPhase:
1184   - _phase = AFHeaderPhase;
1185   - break;
1186   - case AFHeaderPhase:
1187   - [self.inputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSRunLoopCommonModes];
1188   - [self.inputStream open];
1189   - _phase = AFBodyPhase;
1190   - break;
1191   - case AFBodyPhase:
1192   - [self.inputStream close];
1193   - _phase = AFFinalBoundaryPhase;
1194   - break;
1195   - case AFFinalBoundaryPhase:
1196   - default:
1197   - _phase = AFEncapsulationBoundaryPhase;
1198   - break;
1199   - }
1200   - _phaseReadOffset = 0;
1201   -
1202   - return YES;
1203   -}
1204   -
1205   -#pragma mark - NSCopying
1206   -
1207   -- (instancetype)copyWithZone:(NSZone *)zone {
1208   - AFHTTPBodyPart *bodyPart = [[[self class] allocWithZone:zone] init];
1209   -
1210   - bodyPart.stringEncoding = self.stringEncoding;
1211   - bodyPart.headers = self.headers;
1212   - bodyPart.bodyContentLength = self.bodyContentLength;
1213   - bodyPart.body = self.body;
1214   - bodyPart.boundary = self.boundary;
1215   -
1216   - return bodyPart;
1217   -}
1218   -
1219   -@end
1220   -
1221   -#pragma mark -
1222   -
1223   -@implementation AFJSONRequestSerializer
1224   -
1225   -+ (instancetype)serializer {
1226   - return [self serializerWithWritingOptions:(NSJSONWritingOptions)0];
1227   -}
1228   -
1229   -+ (instancetype)serializerWithWritingOptions:(NSJSONWritingOptions)writingOptions
1230   -{
1231   - AFJSONRequestSerializer *serializer = [[self alloc] init];
1232   - serializer.writingOptions = writingOptions;
1233   -
1234   - return serializer;
1235   -}
1236   -
1237   -#pragma mark - AFURLRequestSerialization
1238   -
1239   -- (NSURLRequest *)requestBySerializingRequest:(NSURLRequest *)request
1240   - withParameters:(id)parameters
1241   - error:(NSError *__autoreleasing *)error
1242   -{
1243   - NSParameterAssert(request);
1244   -
1245   - if ([self.HTTPMethodsEncodingParametersInURI containsObject:[[request HTTPMethod] uppercaseString]]) {
1246   - return [super requestBySerializingRequest:request withParameters:parameters error:error];
1247   - }
1248   -
1249   - NSMutableURLRequest *mutableRequest = [request mutableCopy];
1250   -
1251   - [self.HTTPRequestHeaders enumerateKeysAndObjectsUsingBlock:^(id field, id value, BOOL * __unused stop) {
1252   - if (![request valueForHTTPHeaderField:field]) {
1253   - [mutableRequest setValue:value forHTTPHeaderField:field];
1254   - }
1255   - }];
1256   -
1257   - if (parameters) {
1258   - if (![mutableRequest valueForHTTPHeaderField:@"Content-Type"]) {
1259   - [mutableRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
1260   - }
1261   -
1262   - if (![NSJSONSerialization isValidJSONObject:parameters]) {
1263   - if (error) {
1264   - NSDictionary *userInfo = @{NSLocalizedFailureReasonErrorKey: NSLocalizedStringFromTable(@"The `parameters` argument is not valid JSON.", @"AFNetworking", nil)};
1265   - *error = [[NSError alloc] initWithDomain:AFURLRequestSerializationErrorDomain code:NSURLErrorCannotDecodeContentData userInfo:userInfo];
1266   - }
1267   - return nil;
1268   - }
1269   -
1270   - NSData *jsonData = [NSJSONSerialization dataWithJSONObject:parameters options:self.writingOptions error:error];
1271   -
1272   - if (!jsonData) {
1273   - return nil;
1274   - }
1275   -
1276   - [mutableRequest setHTTPBody:jsonData];
1277   - }
1278   -
1279   - return mutableRequest;
1280   -}
1281   -
1282   -#pragma mark - NSSecureCoding
1283   -
1284   -- (instancetype)initWithCoder:(NSCoder *)decoder {
1285   - self = [super initWithCoder:decoder];
1286   - if (!self) {
1287   - return nil;
1288   - }
1289   -
1290   - self.writingOptions = [[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(writingOptions))] unsignedIntegerValue];
1291   -
1292   - return self;
1293   -}
1294   -
1295   -- (void)encodeWithCoder:(NSCoder *)coder {
1296   - [super encodeWithCoder:coder];
1297   -
1298   - [coder encodeInteger:self.writingOptions forKey:NSStringFromSelector(@selector(writingOptions))];
1299   -}
1300   -
1301   -#pragma mark - NSCopying
1302   -
1303   -- (instancetype)copyWithZone:(NSZone *)zone {
1304   - AFJSONRequestSerializer *serializer = [super copyWithZone:zone];
1305   - serializer.writingOptions = self.writingOptions;
1306   -
1307   - return serializer;
1308   -}
1309   -
1310   -@end
1311   -
1312   -#pragma mark -
1313   -
1314   -@implementation AFPropertyListRequestSerializer
1315   -
1316   -+ (instancetype)serializer {
1317   - return [self serializerWithFormat:NSPropertyListXMLFormat_v1_0 writeOptions:0];
1318   -}
1319   -
1320   -+ (instancetype)serializerWithFormat:(NSPropertyListFormat)format
1321   - writeOptions:(NSPropertyListWriteOptions)writeOptions
1322   -{
1323   - AFPropertyListRequestSerializer *serializer = [[self alloc] init];
1324   - serializer.format = format;
1325   - serializer.writeOptions = writeOptions;
1326   -
1327   - return serializer;
1328   -}
1329   -
1330   -#pragma mark - AFURLRequestSerializer
1331   -
1332   -- (NSURLRequest *)requestBySerializingRequest:(NSURLRequest *)request
1333   - withParameters:(id)parameters
1334   - error:(NSError *__autoreleasing *)error
1335   -{
1336   - NSParameterAssert(request);
1337   -
1338   - if ([self.HTTPMethodsEncodingParametersInURI containsObject:[[request HTTPMethod] uppercaseString]]) {
1339   - return [super requestBySerializingRequest:request withParameters:parameters error:error];
1340   - }
1341   -
1342   - NSMutableURLRequest *mutableRequest = [request mutableCopy];
1343   -
1344   - [self.HTTPRequestHeaders enumerateKeysAndObjectsUsingBlock:^(id field, id value, BOOL * __unused stop) {
1345   - if (![request valueForHTTPHeaderField:field]) {
1346   - [mutableRequest setValue:value forHTTPHeaderField:field];
1347   - }
1348   - }];
1349   -
1350   - if (parameters) {
1351   - if (![mutableRequest valueForHTTPHeaderField:@"Content-Type"]) {
1352   - [mutableRequest setValue:@"application/x-plist" forHTTPHeaderField:@"Content-Type"];
1353   - }
1354   -
1355   - NSData *plistData = [NSPropertyListSerialization dataWithPropertyList:parameters format:self.format options:self.writeOptions error:error];
1356   -
1357   - if (!plistData) {
1358   - return nil;
1359   - }
1360   -
1361   - [mutableRequest setHTTPBody:plistData];
1362   - }
1363   -
1364   - return mutableRequest;
1365   -}
1366   -
1367   -#pragma mark - NSSecureCoding
1368   -
1369   -- (instancetype)initWithCoder:(NSCoder *)decoder {
1370   - self = [super initWithCoder:decoder];
1371   - if (!self) {
1372   - return nil;
1373   - }
1374   -
1375   - self.format = (NSPropertyListFormat)[[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(format))] unsignedIntegerValue];
1376   - self.writeOptions = [[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(writeOptions))] unsignedIntegerValue];
1377   -
1378   - return self;
1379   -}
1380   -
1381   -- (void)encodeWithCoder:(NSCoder *)coder {
1382   - [super encodeWithCoder:coder];
1383   -
1384   - [coder encodeInteger:self.format forKey:NSStringFromSelector(@selector(format))];
1385   - [coder encodeObject:@(self.writeOptions) forKey:NSStringFromSelector(@selector(writeOptions))];
1386   -}
1387   -
1388   -#pragma mark - NSCopying
1389   -
1390   -- (instancetype)copyWithZone:(NSZone *)zone {
1391   - AFPropertyListRequestSerializer *serializer = [super copyWithZone:zone];
1392   - serializer.format = self.format;
1393   - serializer.writeOptions = self.writeOptions;
1394   -
1395   - return serializer;
1396   -}
1397   -
1398   -@end