当前位置: 首页 > news >正文

做网站建设的网络公司经营范围怎样填财务公司网站模板

做网站建设的网络公司经营范围怎样填,财务公司网站模板,wordpress 去掉分页,cms wordpress 企业AFNetworking是一个为 iOS 和 Mac OSX 制作的令人愉快的网络库,它建立在URL 装载系统框架的顶层,内置在Cocoa里,扩展了强有力的高级网络抽象。它的模块架构被良好的设计,拥有丰富的功能,因此,使用起来&…

AFNetworking是一个为 iOS 和 Mac OSX 制作的令人愉快的网络库,它建立在URL 装载系统框架的顶层,内置在Cocoa里,扩展了强有力的高级网络抽象。它的模块架构被良好的设计,拥有丰富的功能,因此,使用起来,必定赏心悦目。

       @原文链接https://github.com/AFNetworking/AFNetworking,我在此基础上了点配置修改

       @介绍

  1.支持HTTP请求和基于REST的网络服务(包括GET、POST、 PUT、DELETE等)
  2.支持ARC
  3.要求iOS 5.0及以上版本

  4.UIKit扩展


       @配置

       1.下载AFNetworking,将2个文件夹:AFNetworking和UIKit+AFNetworking拖入工程

       2.导入以下库文件:CFNetwork、Security、SystemConfiguration、MobileCoreServices

       3.如果你以前用的是1.0版本,那么AFNetworking 2.0 Migration Guide能帮助你

       4.如果你是用CocoaPods配置的,那么

           platform:ios,'7.0'

           pod"AFNetworking","~>2.0"


           @使用

           1.HTTP请求操作

           AFHTTPRequestOperationManager封装的共同模式与web应用程序通过HTTP通信,包括创建请求,响应序列化,网络可达性监控、运营管理和安全,以及请求。

           *GET请求

 

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请求

 

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请求(多表)

 

 

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 formData) {    [formData appendPartWithFileURL:filePath name:@"image" error:nil];} success:^(AFHTTPRequestOperation *operation, id responseObject) {    NSLog(@"Success: %@", responseObject);} failure:^(AFHTTPRequestOperation *operation, NSError *error) {    NSLog(@"Error: %@", error);}];
             

 

             2.AFURLSessionManager(NSURLSession详细见网络编程(6))

             创建和管理制定的NSURLSession对象NSURLSessionConfiguration对象必须实现, , , 协议

              *创建一个下载任务

 

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];
                 *创建一个上传任务

 

 

NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];AFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfiguration:configuration];NSURL *URL = [NSURL URLWithString:@"http://example.com/upload"];NSURLRequest *request = [NSURLRequest requestWithURL:URL];NSURL *filePath = [NSURL fileURLWithPath:@"file://path/to/image.png"];NSURLSessionUploadTask *uploadTask = [manager uploadTaskWithRequest:request fromFile:filePath progress:nil completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) {    if (error) {        NSLog(@"Error: %@", error);    } else {        NSLog(@"Success: %@ %@", response, responseObject);    }}];[uploadTask resume];
              *创建一个带多表,进度的上传任务

 

 

NSMutableURLRequest *request = [[AFHTTPRequestSerializer serializer] multipartFormRequestWithMethod:@"POST" URLString:@"http://example.com/upload" parameters:nil constructingBodyWithBlock:^(id formData) {        [formData appendPartWithFileURL:[NSURL fileURLWithPath:@"file://path/to/image.jpg"] name:@"file" fileName:@"filename.jpg" mimeType:@"image/jpeg" error:nil];    } error:nil];AFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]];NSProgress *progress = nil;NSURLSessionUploadTask *uploadTask = [manager uploadTaskWithStreamedRequest:request progress:&progress completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) {    if (error) {        NSLog(@"Error: %@", error);    } else {        NSLog(@"%@ %@", response, responseObject);    }}];[uploadTask resume];
               *创建一个数据流Data任务

 

 

NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];AFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfiguration:configuration];NSURL *URL = [NSURL URLWithString:@"http://example.com/upload"];NSURLRequest *request = [NSURLRequest requestWithURL:URL];NSURLSessionDataTask *dataTask = [manager dataTaskWithRequest:request completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) {    if (error) {        NSLog(@"Error: %@", error);    } else {        NSLog(@"%@ %@", response, responseObject);    }}];[dataTask resume];
              

 

                3.网络监测(一般会用另一个网络监测类,Reachability,还有JSON解析方法,反正我也一般不用,自行脑补)

                AFNetworkReachabilityManager监控网络领域的可达性,WWAN地址和WiFi接口.

                *当前网络状态

 

[[AFNetworkReachabilityManager sharedManager] setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) {    NSLog(@"Reachability: %@", AFStringFromNetworkReachabilityStatus(status));}];

                             *HTTP Manager 可达性

 

 

NSURL *baseURL = [NSURL URLWithString:@"http://example.com/"];AFHTTPRequestOperationManager *manager = [[AFHTTPRequestOperationManager alloc] initWithBaseURL:baseURL];NSOperationQueue *operationQueue = manager.operationQueue;[manager.reachabilityManager setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) {    switch (status) {        case AFNetworkReachabilityStatusReachableViaWWAN:        case AFNetworkReachabilityStatusReachableViaWiFi:            [operationQueue setSuspended:NO];            break;        case AFNetworkReachabilityStatusNotReachable:        default:            [operationQueue setSuspended:YES];            break;    }}];
                       

 

                  4.AFHTTPRequestOperation

                  AFHTTPRequestOperation是使用HTTP或HTTPS协议的AFURLConnectionOperation的子类。
它封装的获取后的HTTP状态和类型将决定请求的成功与否。虽然AFHTTPRequestOperationManager通常是最好的去请求的方式,但是AFHTTPRequestOpersion也能够单独使用。

                               *GET请求

 

NSURL *URL = [NSURL URLWithString:@"http://example.com/resources/123.json"];NSURLRequest *request = [NSURLRequest requestWithURL:URL];AFHTTPRequestOperation *op = [[AFHTTPRequestOperation alloc] initWithRequest:request];op.responseSerializer = [AFJSONResponseSerializer serializer];[op setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {    NSLog(@"JSON: %@", responseObject);} failure:^(AFHTTPRequestOperation *operation, NSError *error) {    NSLog(@"Error: %@", error);}];[[NSOperationQueue mainQueue] addOperation:op];
 
                              *批量多请求

 

 

NSMutableArray *mutableOperations = [NSMutableArray array];for (NSURL *fileURL in filesToUpload) {    NSURLRequest *request = [[AFHTTPRequestSerializer serializer] multipartFormRequestWithMethod:@"POST" URLString:@"http://example.com/upload" parameters:nil constructingBodyWithBlock:^(id formData) {        [formData appendPartWithFileURL:fileURL name:@"images[]" error:nil];    }];    AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request];    [mutableOperations addObject:operation];}NSArray *operations = [AFURLConnectionOperation batchOfRequestOperations:@[...] progressBlock:^(NSUInteger numberOfFinishedOperations, NSUInteger totalNumberOfOperations) {    NSLog(@"%lu of %lu complete", numberOfFinishedOperations, totalNumberOfOperations);} completionBlock:^(NSArray *operations) {    NSLog(@"All operations in batch complete");}];[[NSOperationQueue mainQueue] addOperations:operations waitUntilFinished:NO];

http://www.yayakq.cn/news/937783/

相关文章:

  • 网站反链接wordpress数据库版本号
  • 图书拍卖网站开发过程的问题用模板快速建站
  • dz论坛识别手机网站自动跳转网站建设行业发展史
  • 济南市网站建设互联网网站如何做流量统计
  • 网页设计与网站建设考试热点wordpress查看访问ip
  • 一家只做直购的网站销售管理系统实验报告
  • 唐山教育平台网站建设公众号 转 wordpress
  • 城阳建网站免费云服务器
  • 网站建设教程下载wordpress上传主题提示要ftp
  • 焦作网站建设哪家正规大连模板建站代理
  • 免费html模板素材网站职高动漫设计毕业后干什么
  • 淘宝客怎么做的网站推广广州网站建设公司乐云seo598
  • 织梦网站怎么关闭中国五大网络运营商
  • 图书馆网站建设请示led灯 东莞网站建设
  • 金湖网站设计wordpress 主题详解
  • 网站备案证书怎么下载不了wordpress最近文章
  • 网站期刊怎么做app编辑软件
  • 网站有关于我们的好处公司建站模版
  • 帝国cms做网站wordpress主题 视频教程
  • 访问一个网站的过程flash做网站轮播图
  • 网站上线前准备方案虚拟主机的概念和功能
  • wordpress子站点404群晖nas建设网站
  • 在阿里巴巴上怎样做网站宠物美容师宠物美容培训学校
  • 大连手机自适应网站制作费用网站全是乱码
  • 蓝田县住房与城乡建设局网站网站开发安全文档
  • 成品网站怎么被百度收录什么样的网站利于优化
  • 本溪建设银行网站企业文化建设的重要性
  • 精品课程网站源码用手机做免费自助网站
  • 企业展示型网站php卫浴洁具公司网站模板
  • 毕业设计做网站答辩会问什么手机软件开发网站