AFNetworking内存泄漏的问题

在AFHTTPSessionManager中自己主动添加一个单例就可以避免内存泄漏的问题

//用单例方法实力session避免内存泄漏
+ (AFHTTPSessionManager *)sharedHttpSessionManager {
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        manager = [AFHTTPSessionManager manager];
        manager.requestSerializer.timeoutInterval = 10.0;
        manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"application/json",@"text/json",@"text/javascript",@"text/html", nil];
    });
    return manager;
}

你可能感兴趣的:(AFNetworking内存泄漏的问题)