网络工具类
2016-01-31 09:49
316 查看
#import "AFHTTPRequestOperationManager.h" @interface NetworkTools : AFHTTPRequestOperationManager + (instancetype)shareNetworkTools; @end #import "NetworkTools.h" @implementation NetworkTools + (instancetype)shareNetworkTools { static id instance; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ NSURL *url = [NSURL URLWithString:@"http://xxxxxxx/"]; instance = [[self alloc] initWithBaseURL:url]; }); return instance; } @end #import "AFHTTPSessionManager.h" @interface NetworkTools2 : AFHTTPSessionManager + (instancetype)shareNetworkTools; @end #import "NetworkTools2.h" @implementation NetworkTools2 + (instancetype)shareNetworkTools { static id instance; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ // 注意: 在指定baseURL的时候, 后面需要加上/ NSURL *url = [NSURL URLWithString:@"http://xxxxxxxxx/"]; instance = [[self alloc] initWithBaseURL:url sessionConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]]; }); return instance; } @end
相关文章推荐
- 2016太原网络营销师郭文军分享网站中如何合理布局关键词?
- 【NYOJ】[199]无线网络覆盖
- ntpdate同步网络时间
- DNS分别在什么情况下使用UDP和TCP
- java32.HTTP通信------使用Http的Get方式读取网络数据
- 神经网络及卷积神经网络的训练——反向传播算法
- TCP显示冲突通告(ECN)
- SACK信息
- 【Android】【笔记】《Android 入门经典》part 13 网络通信技术
- BestCoder Round #70 Jam's store(网络流)
- 千兆以太网 TCP, UDP协议, FPGA实现
- 黑马程序员——Java网络编程
- tcp为什要三次握手
- 部署OpenStack问题汇总(七)--解决apache启动错误"httpd:Could not reliably determine..."
- 使用httpClient
- IOS-网络(发送JSON数据给服务器和多值参数)
- windows下apache配置https
- 计算机网络-UDP协议
- IOS-网络(GET请求和POST请求、HTTP通信过程、请求超时、URL转码)
- winpcap实现从TCP三次握手到发送http请求