<p align="center" >
<img src="https://raw.github.com/AFNetworking/AFNetworking/assets/afnetworking-logo.png" alt="AFNetworking" title="AFNetworking">
</p>
[![Build Status](https://travis-ci.org/AFNetworking/AFNetworking.svg)](https://travis-ci.org/AFNetworking/AFNetworking)
AFNetworking is a delightful networking library for iOS and Mac OS X. It's built on top of the [Foundation URL Loading System](http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/URLLoadingSystem/URLLoadingSystem.html), extending the powerful high-level networking abstractions built into Cocoa. It has a modular architecture with well-designed, feature-rich APIs that are a joy to use.
Perhaps the most important feature of all, however, is the amazing community of developers who use and contribute to AFNetworking every day. AFNetworking powers some of the most popular and critically-acclaimed apps on the iPhone, iPad, and Mac.
Choose AFNetworking for your next project, or migrate over your existing projects—you'll be happy you did!
## How To Get Started
- [Download AFNetworking](https://github.com/AFNetworking/AFNetworking/archive/master.zip) and try out the included Mac and iPhone example apps
- Read the ["Getting Started" guide](https://github.com/AFNetworking/AFNetworking/wiki/Getting-Started-with-AFNetworking), [FAQ](https://github.com/AFNetworking/AFNetworking/wiki/AFNetworking-FAQ), or [other articles on the Wiki](https://github.com/AFNetworking/AFNetworking/wiki)
- Check out the [documentation](http://cocoadocs.org/docsets/AFNetworking/) for a comprehensive look at all of the APIs available in AFNetworking
- Read the [AFNetworking 2.0 Migration Guide](https://github.com/AFNetworking/AFNetworking/wiki/AFNetworking-2.0-Migration-Guide) for an overview of the architectural changes from 1.0.
## Communication
- If you **need help**, use [Stack Overflow](http://stackoverflow.com/questions/tagged/afnetworking). (Tag 'afnetworking')
- If you'd like to **ask a general question**, use [Stack Overflow](http://stackoverflow.com/questions/tagged/afnetworking).
- If you **found a bug**, _and can provide steps to reliably reproduce it_, open an issue.
- If you **have a feature request**, open an issue.
- If you **want to contribute**, submit a pull request.
### Installation with CocoaPods
[CocoaPods](http://cocoapods.org) is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries like AFNetworking in your projects. See the ["Getting Started" guide for more information](https://github.com/AFNetworking/AFNetworking/wiki/Getting-Started-with-AFNetworking).
#### Podfile
```ruby
platform :ios, '7.0'
pod "AFNetworking", "~> 2.0"
```
## Requirements
| AFNetworking Version | Minimum iOS Target | Minimum OS X Target | Notes |
|:--------------------:|:---------------------------:|:----------------------------:|:-------------------------------------------------------------------------:|
| 2.x | iOS 6 | OS X 10.8 | Xcode 5 is required. `NSURLSession` subspec requires iOS 7 or OS X 10.9. |
| [1.x](https://github.com/AFNetworking/AFNetworking/tree/1.x) | iOS 5 | Mac OS X 10.7 | |
| [0.10.x](https://github.com/AFNetworking/AFNetworking/tree/0.10.x) | iOS 4 | Mac OS X 10.6 | |
(OS X projects must support [64-bit with modern Cocoa runtime](https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/ObjCRuntimeGuide/Articles/ocrtVersionsPlatforms.html)).
> Programming in Swift? Try [Alamofire](https://github.com/Alamofire/Alamofire) for a more conventional set of APIs.
## Architecture
### NSURLConnection
- `AFURLConnectionOperation`
- `AFHTTPRequestOperation`
- `AFHTTPRequestOperationManager`
### NSURLSession _(iOS 7 / Mac OS X 10.9)_
- `AFURLSessionManager`
- `AFHTTPSessionManager`
### Serialization
* `<AFURLRequestSerialization>`
- `AFHTTPRequestSerializer`
- `AFJSONRequestSerializer`
- `AFPropertyListRequestSerializer`
* `<AFURLResponseSerialization>`
- `AFHTTPResponseSerializer`
- `AFJSONResponseSerializer`
- `AFXMLParserResponseSerializer`
- `AFXMLDocumentResponseSerializer` _(Mac OS X)_
- `AFPropertyListResponseSerializer`
- `AFImageResponseSerializer`
- `AFCompoundResponseSerializer`
### Additional Functionality
- `AFSecurityPolicy`
- `AFNetworkReachabilityManager`
## Usage
### HTTP Request Operation Manager
`AFHTTPRequestOperationManager` encapsulates the common patterns of communicating with a web application over HTTP, including request creation, response serialization, network reachability monitoring, and security, as well as request operation management.
#### `GET` Request
```objective-c
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
[manager GET:@"http://example.com/resources.json" parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) {
NSLog(@"JSON: %@", responseObject);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"Error: %@", error);
}];
```
#### `POST` URL-Form-Encoded Request
```objective-c
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
NSDictionary *parameters = @{@"foo": @"bar"};
[manager POST:@"http://example.com/resources.json" parameters:parameters success:^(AFHTTPRequestOperation *operation, id responseObject) {
NSLog(@"JSON: %@", responseObject);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"Error: %@", error);
}];
```
#### `POST` Multi-Part Request
```objective-c
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
NSDictionary *parameters = @{@"foo": @"bar"};
NSURL *filePath = [NSURL fileURLWithPath:@"file://path/to/image.png"];
[manager POST:@"http://example.com/resources.json" parameters:parameters constructingBodyWithBlock:^(id<AFMultipartFormData> formData) {
[formData appendPartWithFileURL:filePath name:@"image" error:nil];
} success:^(AFHTTPRequestOperation *operation, id responseObject) {
NSLog(@"Success: %@", responseObject);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"Error: %@", error);
}];
```
---
### AFURLSessionManager
`AFURLSessionManager` creates and manages an `NSURLSession` object based on a specified `NSURLSessionConfiguration` object, which conforms to `<NSURLSessionTaskDelegate>`, `<NSURLSessionDataDelegate>`, `<NSURLSessionDownloadDelegate>`, and `<NSURLSessionDelegate>`.
#### Creating a Download Task
```objective-c
NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
AFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfiguration:configuration];
NSURL *URL = [NSURL URLWithString:@"http://example.com/download.zip"];
NSURLRequest *request = [NSURLRequest requestWithURL:URL];
NSURLSessionDownloadTask *downloadTask = [manager downloadTaskWithRequest:request progress:nil destination:^NSURL *(NSURL *targetPath, NSURLResponse *response) {
NSURL *documentsDirectoryURL = [[NSFileManager defaultManager] URLForDirectory:NSDocumentDirectory inDomain:NSUserDomainMask appropriateForURL:nil create:NO error:nil];
return [documentsDirectoryURL URLByAppendingPathComponent:[response suggestedFilename]];
} completionHandler:^(NSURLResponse *response, NSURL *filePath, NSError *error) {
NSLog(@"File downloaded to: %@", filePath);
}];
[downloadTask resume];
```
#### Creating an Upload Task
```objective-c
NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
AFURLSessionManager *manager = [[AFURLSessio
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
ios ESTMusicPlayer音乐播放器源码 (438个子文件)
.DS_Store 6KB
.DS_Store 6KB
.gitignore 835B
metamacros.h 30KB
AFURLSessionManager.h 30KB
AFURLRequestSerialization.h 22KB
AFHTTPRequestOperationManager.h 19KB
AFURLConnectionOperation.h 17KB
MBProgressHUD.h 17KB
AFHTTPSessionManager.h 15KB
UIButton+WebCache.h 13KB
AFURLResponseSerialization.h 12KB
SDWebImageManager.h 11KB
UIImageView+WebCache.h 10KB
UIButton+AFNetworking.h 9KB
MTLManagedObjectAdapter.h 9KB
SDImageCache.h 8KB
AFNetworkReachabilityManager.h 8KB
UIImageView+AFNetworking.h 7KB
MTLJSONAdapter.h 7KB
SDWebImageDownloader.h 7KB
UIWebView+AFNetworking.h 6KB
MTLModel.h 5KB
MTLModel+NSCoding.h 5KB
UIAlertView+AFNetworking.h 5KB
UIImageView+HighlightedWebCache.h 5KB
AFSecurityPolicy.h 5KB
AFHTTPRequestOperation.h 4KB
NSValueTransformer+MTLPredefinedTransformerAdditions.h 4KB
AFNetworkActivityIndicatorManager.h 4KB
SDWebImagePrefetcher.h 4KB
EXTScope.h 3KB
UIProgressView+AFNetworking.h 3KB
EXTRuntimeExtensions.h 3KB
SDWebImageDownloaderOperation.h 3KB
NAKPlaybackIndicatorView.h 3KB
UIActivityIndicatorView+AFNetworking.h 2KB
UIRefreshControl+AFNetworking.h 2KB
EXTKeyPathCoding.h 2KB
DOUAudioStreamer.h 2KB
AFNetworking.h 2KB
DOUSimpleHTTPRequest.h 2KB
SDWebImageCompat.h 2KB
UIKit+AFNetworking.h 2KB
DOUAudioFileProvider.h 1KB
DOUAudioPlaybackItem.h 1KB
DOUAudioDecoder.h 1KB
UIConstant.h 1KB
MTLReflection.h 1KB
DOUAudioStreamer_Private.h 1KB
DOUMPMediaLibraryAssetLoader.h 1KB
DOUAudioRenderer.h 1KB
MusicViewController.h 1KB
DOUAudioStreamer+Options.h 1KB
MTLValueTransformer.h 991B
UIView+WebCacheOperation.h 970B
NSArray+MTLManipulationAdditions.h 873B
Mantle.h 832B
DOUAudioVisualizer.h 824B
DOUAudioEventLoop.h 810B
MusicListEntity.h 807B
NSDictionary+MTLManipulationAdditions.h 807B
NSData+DOUMappedFile.h 797B
DOUAudioAnalyzer.h 794B
DOUEAGLView.h 784B
GVUserDefaults+Properties.h 713B
DOUAudioLPCM.h 666B
Track.h 666B
DOUAudioAnalyzer_Private.h 662B
BaseEntity.h 645B
MusicListCell.h 627B
DOUAudioFile.h 617B
NSError+MTLModelException.h 604B
NSData+ImageContentType.h 565B
DOUAudioFilePreprocessor.h 560B
NSValueTransformer+MTLInversionAdditions.h 553B
DOUAudioAnalyzer+Default.h 549B
DOUAudioBase.h 534B
NSString+Additions.h 524B
BaseHelper.h 523B
MusicEntity.h 515B
DOUAudioFrequencyAnalyzer.h 498B
DOUAudioSpatialAnalyzer.h 496B
NAKPlaybackIndicatorContentView.h 478B
SDWebImageDecoder.h 453B
MusicListViewController.h 419B
NSObject+MTLComparisonAdditions.h 406B
UIImage+GIF.h 382B
MusicHandler.h 337B
SDWebImageOperation.h 329B
AppDelegate.h 275B
GVUserDefaults.h 264B
UIImage+MultiFormat.h 263B
MusicIndicator.h 252B
UIView+Animations.h 250B
MusicSlider.h 196B
UIActivityIndicatorView+AFNetworking.h 79B
UIActivityIndicatorView+AFNetworking.h 79B
NSValueTransformer+MTLPredefinedTransformerAdditions.h 77B
NSValueTransformer+MTLPredefinedTransformerAdditions.h 77B
共 438 条
- 1
- 2
- 3
- 4
- 5
资源评论
水桶前辈
- 粉丝: 3231
- 资源: 33
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 细胞的奇迹:吃出来的免疫力(美亚畅销书!作者的TED演讲播放量超300万次!《谷物大脑》作者、《三联生活周刊》推荐!吃下对的食物,改善你的... (Z-Library).azw3
- 智能手机产品拆解,使用mindmaster打开
- 11111111111111
- 统信系统ARM64依赖openssl-1.0.2版本的libssl.so.10和libcrypto.so.10文件
- 奥比中光python sdk
- 冯超楠17.py
- OCR识别-基于视觉注意力机制Attention实现的OCR识别算法-附项目源码-优质项目实战.zip
- Java 使用蒙特卡洛方法估算PI的近似值(源代码)
- main.cpp
- 电子木鱼小程序源码电子木鱼小程序源码
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功