<commit_before>---
layout:     post
title:      "AFNETworking A memory leak"
subtitle:   "Bug，iOS"
date:       2017-01-19
author:     "oragekk"
header-img: "img/post-bg-unix-linux.jpg"
tags:

    - iOS
    - Bug录 
---

>细心的你是否也发现了AFN的内存泄漏的问题了呢.

### 解决方法
    + (AFHTTPSessionManager *)sharedHTTPSession{
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        manager = [AFHTTPSessionManager manager];
        manager.requestSerializer.timeoutInterval = 30;
        [manager.requestSerializer  setValue:@"XMLHttpRequest" forHTTPHeaderField:@"X-Requested-With"];
    });
    return manager;
    }

    + (AFURLSessionManager *)sharedURLSession{<commit_msg>额，刚刚名字写错了<commit_after>---
layout:     post
title:      "AFNetworking A memory leak"
subtitle:   "Bug，iOS"
date:       2017-01-19
author:     "oragekk"
header-img: "img/post-bg-unix-linux.jpg"
tags:

    - iOS
    - Bug录 
---

>细心的你是否也发现了AFN的内存泄漏的问题了呢.

### 解决方法
    + (AFHTTPSessionManager *)sharedHTTPSession{
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        manager = [AFHTTPSessionManager manager];
        manager.requestSerializer.timeoutInterval = 30;
        [manager.requestSerializer  setValue:@"XMLHttpRequest" forHTTPHeaderField:@"X-Requested-With"];
    });
    return manager;
    }

    + (AFURLSessionManager *)sharedURLSession{
{'fraction_non_alphanumeric': 0.1235207100591716, 'fraction_numerical': 0.014792899408284023, 'mean_word_length': 3.2681388012618298, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6431430', 'n_tokens_mistral': 505, 'n_tokens_neox': 495, 'n_words': 77}