Latest 0.3.0
License MIT
Platforms ios 8.0
Dependencies AFNetworking, RealReachability
Frameworks UIKit, Foundation, ImageIO, MobileCoreServices



  • 支持iOS 8及以上



  • cocoapod
pod 'MFNetworkManager'


  • 导入

    #import "MFNetworkManager.h"
  • 在 appDelegate 里设置网络监听
  • (BOOL)application:(UIApplication )application didFinishLaunchingWithOptions:(NSDictionary )launchOptions {
    [MFNETWROK startMonitorNetworkType];

  • 处理网络连接的两种情况的代理方法(推荐使用MFHUDManager)
  • (void)networkManager:(MFNetworkManager )manager didConnectedWithPrompt:(NSString )prompt;
  • (void)networkManager:(MFNetworkManager )manager disDisConnectedWithPrompt:(NSString )prompt;

  • 调用MFNETWORK的 get,post,upload,download方法即可
  • (NSURLSessionDataTask )get:(NSString )url params:(id)params success:(MFNetworkSuccessHandle)success failure:(MFNetworkFailureHandle)failure;


  • (NSURLSessionDataTask )post:(NSString )url params:(id)params success:(MFNetworkSuccessHandle)success failure:(MFNetworkFailureHandle)failure;

//upload with images

  • (NSURLSessionDataTask )upload:(NSString )url params:(id)params name:(NSString )name images:(NSArray<UIImage > *)images imageScale:(CGFloat)imageScale imageType:(MFImageType)imageType progress:(MFProgress)progress success:(MFNetworkSuccessHandle)success failure:(MFNetworkFailureHandle)failure;

//upload with datas

  • (NSURLSessionDataTask )upload:(NSString )url params:(id)params name:(NSString )name imageDatas:(NSArray<NSData > *)imageDatas progress:(MFProgress)progress success:(MFNetworkSuccessHandle)success failure:(MFNetworkFailureHandle)failure;


  • (NSURLSessionDownloadTask )download:(NSString )url fileDir:(NSString )fileDir progress:(MFProgress)progress success:(void(^)(NSString ))success failure:(MFNetworkFailureHandle)failure;

  • 取消请求
  • (void)cancelAllRequest;

  • (void)cancelRequestWithURL:(NSString *)url;

  • 其他配置
    @property (nonatomic, weak) id<MFNetworkManagerDelegate> delegate;


@property (nonatomic, strong) NSString *baseURL;

timeoutInterval 30 default
@property (nonatomic, assign) NSTimeInterval requestTimeoutInterval;

sets the common parameter of the HTTP client. if value is nil, removes the existing value which associated to the field.
@param value – the value of the parameter
@param field – the parameter, or nil

  • (void)setValue:(id)value forParameterField:(NSString *)field;

sets the common headerField of the HTTP client. if value is nil, removes the existing value which associated to the field.
@param value – the value of the HTTP header
@param field – the HTTP header, or nil

  • (void)setValue:(NSString )value forHTTPHeaderField:(NSString )field;

request serialization MFHTTPRequestSerialization default
@property (nonatomic, assign) MFRequestSerialization requestSerialization;

response serialization MFJSONResponseSerialization default
@property (nonatomic, assign) MFResponseSerialization responseSerialization;

## License

Latest podspec

    "name": "MFNetworkManager",
    "version": "0.3.0",
    "summary": "MFNetworkManager is a high level request util based on AFNetworking..",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "GodzzZZZ": "[email protected]"
    "source": {
        "git": "",
        "tag": "0.3.0"
    "platforms": {
        "ios": "8.0"
    "source_files": "MFNetworkManagerDemo/MFNetworkManagerDemo/MFNetworkManager/*.{h,m}",
    "frameworks": [
    "dependencies": {
        "AFNetworking": [],
        "RealReachability": []

Pin It on Pinterest

Share This