123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- //
- // DataCenter.h
- // FirstLink
- //
- // Created by unicode on 14-9-15.
- // Copyright (c) 2014年 FirstLink. All rights reserved.
- //
- #import <Foundation/Foundation.h>
- #import "FLLocalStorage.h"
- #import <AFNetworking.h>
- @protocol FLNetworkDelegate <NSObject>
- @optional
- - (void)networkNotReachable;
- - (void)networkDidReceiveError:(NSError*)error identify:(int)identify header:(MSGHeader*)header;
- - (void)networkDidSuccessResponse:(NSDictionary*)response identify:(int)identify header:(MSGHeader*)header;
- - (void)networkDidSuccessResponse:(NSDictionary*)response identify:(int)identify header:(MSGHeader*)header userInfo:(NSDictionary *)userInfo;
- @end
- @interface FLDataCenter : NSObject
- +(FLDataCenter*)sharedDataCenter;
- #pragma mark - Network Block API
- - (void)POST:(NSString *)URLString
- parameters:(NSDictionary *)parameters
- success:(void (^)(MSGHeader *header, id responseObject))success
- failure:(void (^)(MSGHeader *header, NSError *error))failure;
- - (void)POSTData:(NSData*)data
- name:(NSString*)name
- fileName:(NSString*)fileName
- mimeType:(NSString*)miniType
- url:(NSURL*)url
- parameters:(NSDictionary *)parameters
- success:(void (^)(MSGHeader *header, id responseObject))success
- progress:(void (^)(NSUInteger bytesWritten, NSInteger totalBytesWritten, NSInteger totalBytesExpectedToWrite))progress
- failure:(void (^)(MSGHeader *header, NSError *error))failure;
- #pragma mark - Network Delegate API
- - (void)POST:(NSString *)url
- para:(NSDictionary *)para
- identify:(int)identify
- delegate:(id<FLNetworkDelegate>)delegate;
- - (void)POST:(NSString *)url
- para:(NSDictionary *)para
- identify:(int)identify
- delegate:(id<FLNetworkDelegate>)delegate
- userInfo:(NSDictionary *)userInfo;
- #pragma mark - Local DataBase API
- + (FMDatabase *)defaultDatabase;
- @end
|