// AFURLSessionManager.h
// Copyright (c) 2011–2015 Alamofire Software Foundation (http://alamofire.org/)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <Foundation/Foundation.h>
#import "AFURLResponseSerialization.h"
#import "AFURLRequestSerialization.h"
#import "AFSecurityPolicy.h"
#import "AFNetworkReachabilityManager.h"
#ifndef NS_DESIGNATED_INITIALIZER
#if __has_attribute(objc_designated_initializer)
#define NS_DESIGNATED_INITIALIZER __attribute__((objc_designated_initializer))
#else
#define NS_DESIGNATED_INITIALIZER
#endif
#endif
/**
`AFURLSessionManager` creates and manages an `NSURLSession` object based on a specified `NSURLSessionConfiguration` object, which conforms to `<NSURLSessionTaskDelegate>`, `<NSURLSessionDataDelegate>`, `<NSURLSessionDownloadDelegate>`, and `<NSURLSessionDelegate>`.
## Subclassing Notes
This is the base class for `AFHTTPSessionManager`, which adds functionality specific to making HTTP requests. If you are looking to extend `AFURLSessionManager` specifically for HTTP, consider subclassing `AFHTTPSessionManager` instead.
## NSURLSession & NSURLSessionTask Delegate Methods
`AFURLSessionManager` implements the following delegate methods:
### `NSURLSessionDelegate`
- `URLSession:didBecomeInvalidWithError:`
- `URLSession:didReceiveChallenge:completionHandler:`
- `URLSessionDidFinishEventsForBackgroundURLSession:`
### `NSURLSessionTaskDelegate`
- `URLSession:willPerformHTTPRedirection:newRequest:completionHandler:`
- `URLSession:task:didReceiveChallenge:completionHandler:`
- `URLSession:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:`
- `URLSession:task:didCompleteWithError:`
### `NSURLSessionDataDelegate`
- `URLSession:dataTask:didReceiveResponse:completionHandler:`
- `URLSession:dataTask:didBecomeDownloadTask:`
- `URLSession:dataTask:didReceiveData:`
- `URLSession:dataTask:willCacheResponse:completionHandler:`
### `NSURLSessionDownloadDelegate`
- `URLSession:downloadTask:didFinishDownloadingToURL:`
- `URLSession:downloadTask:didWriteData:totalBytesWritten:totalBytesWritten:totalBytesExpectedToWrite:`
- `URLSession:downloadTask:didResumeAtOffset:expectedTotalBytes:`
If any of these methods are overridden in a subclass, they _must_ call the `super` implementation first.
## Network Reachability Monitoring
Network reachability status and change monitoring is available through the `reachabilityManager` property. Applications may choose to monitor network reachability conditions in order to prevent or suspend any outbound requests. See `AFNetworkReachabilityManager` for more details.
## NSCoding Caveats
- Encoded managers do not include any block properties. Be sure to set delegate callback blocks when using `-initWithCoder:` or `NSKeyedUnarchiver`.
## NSCopying Caveats
- `-copy` and `-copyWithZone:` return a new manager with a new `NSURLSession` created from the configuration of the original.
- Operation copies do not include any delegate callback blocks, as they often strongly captures a reference to `self`, which would otherwise have the unintuitive side-effect of pointing to the _original_ session manager when copied.
@warning Managers for background sessions must be owned for the duration of their use. This can be accomplished by creating an application-wide or shared singleton instance.
*/
NS_ASSUME_NONNULL_BEGIN
#if (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000) || (defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 1090)
@interface AFURLSessionManager : NSObject <NSURLSessionDelegate, NSURLSessionTaskDelegate, NSURLSessionDataDelegate, NSURLSessionDownloadDelegate, NSSecureCoding, NSCopying>
/**
The managed session.
*/
@property (readonly, nonatomic, strong) NSURLSession *session;
/**
The operation queue on which delegate callbacks are run.
*/
@property (readonly, nonatomic, strong) NSOperationQueue *operationQueue;
/**
Responses sent from the server in data tasks created with `dataTaskWithRequest:success:failure:` and run using the `GET` / `POST` / et al. convenience methods are automatically validated and serialized by the response serializer. By default, this property is set to an instance of `AFJSONResponseSerializer`.
@warning `responseSerializer` must not be `nil`.
*/
@property (nonatomic, strong) id <AFURLResponseSerialization> responseSerializer;
///-------------------------------
/// @name Managing Security Policy
///-------------------------------
/**
The security policy used by created request operations to evaluate server trust for secure connections. `AFURLSessionManager` uses the `defaultPolicy` unless otherwise specified.
*/
@property (nonatomic, strong) AFSecurityPolicy *securityPolicy;
///--------------------------------------
/// @name Monitoring Network Reachability
///--------------------------------------
/**
The network reachability manager. `AFURLSessionManager` uses the `sharedManager` by default.
*/
@property (readwrite, nonatomic, strong) AFNetworkReachabilityManager *reachabilityManager;
///----------------------------
/// @name Getting Session Tasks
///----------------------------
/**
The data, upload, and download tasks currently run by the managed session.
*/
@property (readonly, nonatomic, strong) NSArray *tasks;
/**
The data tasks currently run by the managed session.
*/
@property (readonly, nonatomic, strong) NSArray *dataTasks;
/**
The upload tasks currently run by the managed session.
*/
@property (readonly, nonatomic, strong) NSArray *uploadTasks;
/**
The download tasks currently run by the managed session.
*/
@property (readonly, nonatomic, strong) NSArray *downloadTasks;
///-------------------------------
/// @name Managing Callback Queues
///-------------------------------
/**
The dispatch queue for `completionBlock`. If `NULL` (default), the main queue is used.
*/
#if OS_OBJECT_HAVE_OBJC_SUPPORT
@property (nonatomic, strong, nullable) dispatch_queue_t completionQueue;
#else
@property (nonatomic, assign, nullable) dispatch_queue_t completionQueue;
#endif
/**
The dispatch group for `completionBlock`. If `NULL` (default), a private dispatch group is used.
*/
#if OS_OBJECT_HAVE_OBJC_SUPPORT
@property (nonatomic, strong, nullable) dispatch_group_t completionGroup;
#else
@property (nonatomic, assign, nullable) dispatch_group_t completionGroup;
#endif
///---------------------------------
/// @name Working Around System Bugs
///---------------------------------
/**
Whether to attempt to retry creation of upload tasks for background sessions when initial call returns `nil`. `NO` by default.
@bug As of iOS 7.0, there is a bug where upload tasks created for background tasks are sometimes `nil`. As a workaround, if this property is `YES`, AFNetworking will follow Apple's recommendation to try creating the task again.
@see https://github.com/AFNetworking/AFNetworking/issues/1675
*/
@propert
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
webView----京东支付.zip (98个子文件)
webView----京东支付
FormCommit
.DS_Store 6KB
FormCommit
ViewController.m 4KB
Info.plist 1KB
main.m 341B
Base.lproj
LaunchScreen.storyboard 2KB
Main.storyboard 4KB
FormCommit.xcdatamodeld
FormCommit.xcdatamodel
contents 347B
.xccurrentversion 263B
ViewController.h 222B
AppDelegate.h 645B
Assets.xcassets
AppIcon.appiconset
Contents.json 585B
AppDelegate.m 6KB
FormCommitTests
Info.plist 733B
FormCommitTests.m 915B
FormCommitUITests
Info.plist 733B
FormCommitUITests.m 1KB
AFN
UIKit+AFNetworking
UIProgressView+AFNetworking.h 3KB
UIActivityIndicatorView+AFNetworking.m 7KB
UIKit+AFNetworking.h 2KB
UIAlertView+AFNetworking.m 7KB
UIImageView+AFNetworking.m 8KB
UIImage+AFNetworking.h 1KB
UIActivityIndicatorView+AFNetworking.h 2KB
AFNetworkActivityIndicatorManager.m 6KB
UIProgressView+AFNetworking.m 8KB
UIRefreshControl+AFNetworking.h 2KB
UIRefreshControl+AFNetworking.m 7KB
UIAlertView+AFNetworking.h 5KB
AFNetworkActivityIndicatorManager.h 4KB
UIButton+AFNetworking.h 9KB
UIButton+AFNetworking.m 11KB
UIImageView+AFNetworking.h 7KB
UIWebView+AFNetworking.m 7KB
UIWebView+AFNetworking.h 6KB
AFNetworking
AFURLSessionManager.h 30KB
AFSecurityPolicy.h 5KB
AFSecurityPolicy.m 11KB
AFHTTPRequestOperation.h 4KB
AFNetworking.h 2KB
AFNetworkReachabilityManager.h 8KB
AFURLResponseSerialization.h 12KB
AFHTTPRequestOperationManager.m 11KB
AFNetworkReachabilityManager.m 10KB
AFURLConnectionOperation.m 27KB
AFHTTPRequestOperationManager.h 19KB
AFURLSessionManager.m 50KB
AFURLResponseSerialization.m 28KB
AFHTTPSessionManager.m 12KB
AFURLConnectionOperation.h 17KB
AFURLRequestSerialization.h 22KB
AFURLRequestSerialization.m 50KB
AFHTTPRequestOperation.m 7KB
AFHTTPSessionManager.h 15KB
.git
info
exclude 40B
index 3KB
COMMIT_EDITMSG 15B
objects
ab
b3bded52db3bb6874feb0efbc98778273b70a6 109B
pack
2c
5a84dfc078571117f743eb33c02b21f92c7019 144B
b8
4f15e3facfb211c235b76645976e0b380e09e9 96B
info
7e
93548383a646a7098193a255857f512819203b 357B
f8
c34a25a16550bc7f7269895aaea6f66357311a 4KB
9c
defb3dbe87d6911b907e1ccc9f8b00049fdb5c 69B
11
8c98f7461bf98b2bc7e061150d8021121ad277 161B
2e
721e1833f03bb0e1b962a84491d7e43e3fef9c 753B
9d
afc9c594e1ed35264e3d0ac65e44c0dcd7f366 643B
5e
462df4c44de4aa56a20cc4a2499adf4ec508b1 464B
9b
720a734445c809109600effa1de39b622a66b8 324B
1f
bce9ce7cd8541818bd419abcac76ab5c274927 2KB
c6
02215220d23ec6bfb7cb34dcebdc9b3ed375ff 944B
327ffe75f5de61d27d1b7fbd945632c07f4480 221B
69
05cc67bbf738499f2accb4b56f5f1ddc8ce444 506B
c2
b01c3701b5209b2cd864cff384cd445a7c5d2d 182B
f5
6d2f3bb56e8474d49393008be744986bd41c3c 719B
d5
f1dba332cfb0027869ca11260fa7ada9b5353b 268B
54
8be297029868413991b7e0290282b3de1fa2dd 95B
09
71d1123f9a6e30429ed5c5ca1cb2db434a6d1e 53B
95
bf7f42b7757b3076a7d2f5afc476488f6613e0 59B
fe
70d67e86c2cfc048e42c34cfdf207b4a8f6194 51B
39
be4778712642f7957eb12d8834497e0b8b8eed 62B
0d
14e444d665ba1feb693eee392b68d6fe7a3a31 136B
ba
72822e8728ef2951005e49b6c27a2f1da6572d 353B
28
15a734b99c50bd45e3cda93961c17be535cda7 131B
19
3f33c9c4d16eebd8625dddbf41eeb223330042 231B
7c
8b6ce0348cede7b4e2c9367f7298fe12324348 98B
a0
dbd9e8696e8bb13e45455e33307b9d2efa1c89 332B
ea
b616f0e8f4487791d50e620e6df67037c621da 57B
6a
d7ed4ce33118350b8877cfa9f061b6519f5d5b 321B
17
4f14c2ee25869f8bb6184873b39ed8ffbea141 105B
HEAD 23B
config 137B
refs
heads
tags
hooks
README.sample 177B
description 73B
FormCommit.xcodeproj
project.xcworkspace
contents.xcworkspacedata 155B
xcuserdata
svendson.xcuserdatad
UserInterfaceState.xcuserstate 32KB
xcuserdata
svendson.xcuserdatad
xcdebugger
Breakpoints_v2.xcbkptlist 1KB
xcschemes
xcschememanagement.plist 662B
FormCommit.xcscheme 4KB
project.pbxproj 35KB
共 98 条
- 1
搬砖程序员
- 粉丝: 23
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页