zoukankan      html  css  js  c++  java
  • 网络工具类

    #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
    
  • 相关阅读:
    招标问什么
    其他房产
    长沙
    flume kafka
    http://www.zhihu.com/question/24301047
    38.NOW() 函数
    35.MID() 函数
    36.LEN() 函数
    34.UCASE() LCASE() 函数
    33.HAVING 子句
  • 原文地址:https://www.cnblogs.com/yedayi/p/5172871.html
Copyright © 2011-2022 走看看