├── .gitignore ├── AFNetworkingMeter.png ├── AFNetworkingMeter.podspec ├── AFNetworkingMeter ├── AFHTTPRequestOperation+AFNM.h ├── AFHTTPRequestOperation+AFNM.m ├── AFNetworkingMeter.h ├── AFNetworkingMeter.m ├── AFNetworkingMeterConstants.h ├── AFNetworkingMeterData.h ├── AFNetworkingMeterData.m ├── AFNetworkingMeterReportGenerator.h └── AFNetworkingMeterReportGenerator.m ├── AFNetworkingMeterApp ├── .gitignore ├── AFNetworkingMeterApp.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcuserdata │ │ │ └── Stanislaw.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── Stanislaw.xcuserdatad │ │ └── xcschemes │ │ ├── AFNetworkingMeterApp.xcscheme │ │ └── xcschememanagement.plist ├── AFNetworkingMeterApp │ ├── AFNetworkingMeterApp-Info.plist │ ├── AFNetworkingMeterApp-Prefix.pch │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Default-568h@2x.png │ ├── Default.png │ ├── Default@2x.png │ ├── ViewController.h │ ├── ViewController.m │ ├── en.lproj │ │ ├── InfoPlist.strings │ │ ├── MainStoryboard_iPad.storyboard │ │ └── MainStoryboard_iPhone.storyboard │ └── main.m ├── AFNetworkingMeterAppTests │ ├── AFNetworkingMeterAppTests-Info.plist │ ├── AFNetworkingMeterAppTests.m │ ├── TestHelpers.h │ ├── apple.jpg │ └── en.lproj │ │ └── InfoPlist.strings └── Podfile ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | .DS_Store 3 | -------------------------------------------------------------------------------- /AFNetworkingMeter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stanislaw/AFNetworkingMeter/145ccca7f6e9483bf08a47868b86f4ab928295d5/AFNetworkingMeter.png -------------------------------------------------------------------------------- /AFNetworkingMeter.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = 'AFNetworkingMeter' 3 | s.version = '0.0.11' 4 | 5 | # s.license = 'MIT' 6 | # s.summary = '' 7 | s.homepage = 'https://github.com/stanislaw/AFNetworkingMeter' 8 | # s.authors = { 'Mattt Thompson' => 'm@mattt.me' } 9 | s.source = { :git => 'https://github.com/stanislaw/AFNetworkingMeter.git', :tag => s.version.to_s } 10 | s.source_files = 'AFNetworkingMeter/*.{h,m}' 11 | s.private_header_files = 'AFNetworkingMeter/AFNetworkingMeterData.h, AFNetworkingMeter/AFHTTPRequestOperation+StartDate.h' 12 | 13 | s.requires_arc = true 14 | 15 | s.ios.deployment_target = '6.0' 16 | 17 | s.osx.deployment_target = '10.8' 18 | 19 | s.dependency 'AFNetworking' 20 | end 21 | -------------------------------------------------------------------------------- /AFNetworkingMeter/AFHTTPRequestOperation+AFNM.h: -------------------------------------------------------------------------------- 1 | // 2 | // AFHTTPRequestOperation+StartDate.h 3 | // AFNetworkingMeterApp 4 | // 5 | // Created by Stanislaw Pankevich on 8/21/13. 6 | // Copyright (c) 2013 Stanislaw Pankevich. All rights reserved. 7 | // 8 | 9 | #import "AFHTTPRequestOperation.h" 10 | 11 | @interface AFHTTPRequestOperation (AFNM) 12 | 13 | - (NSDate *)AFNMStartDate; 14 | - (void)setAFNMStartDate:(NSDate *)date; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /AFNetworkingMeter/AFHTTPRequestOperation+AFNM.m: -------------------------------------------------------------------------------- 1 | // 2 | // AFHTTPRequestOperation+StartDate.m 3 | // AFNetworkingMeterApp 4 | // 5 | // Created by Stanislaw Pankevich on 8/21/13. 6 | // Copyright (c) 2013 Stanislaw Pankevich. All rights reserved. 7 | // 8 | 9 | #import "AFHTTPRequestOperation+AFNM.h" 10 | #import 11 | 12 | void * AFNMHTTPRequestOperationStartDate = &AFNMHTTPRequestOperationStartDate; 13 | 14 | @implementation AFHTTPRequestOperation (AFNM) 15 | 16 | - (NSDate *)AFNMStartDate { 17 | return objc_getAssociatedObject(self, AFNMHTTPRequestOperationStartDate); 18 | } 19 | 20 | - (void)setAFNMStartDate:(NSDate *)date { 21 | objc_setAssociatedObject(self, AFNMHTTPRequestOperationStartDate, date, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 22 | } 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /AFNetworkingMeter/AFNetworkingMeter.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import "AFNetworkingMeterData.h" 4 | 5 | @interface AFNetworkingMeter : NSObject 6 | 7 | @property (nonatomic, strong) AFNetworkingMeterData *data; 8 | @property (nonatomic, strong) NSPredicate *filterPredicate; 9 | 10 | + (AFNetworkingMeter *)sharedMeter; 11 | 12 | - (void)startMeter; 13 | - (void)stopMeter; 14 | 15 | @property BOOL lazyReporting; 16 | @property BOOL includesHTTPHeadersSize; 17 | 18 | // TODO 19 | // @property BOOL includesImageTrafficIntoOverallTraffic; 20 | 21 | @property (readonly) NSString *formattedReport; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /AFNetworkingMeter/AFNetworkingMeter.m: -------------------------------------------------------------------------------- 1 | #import "AFNetworkingMeter.h" 2 | #import "AFNetworkingMeterReportGenerator.h" 3 | #import "AFNetworkingMeterConstants.h" 4 | 5 | #import 6 | 7 | #import "AFHTTPRequestOperation+AFNM.h" 8 | 9 | extern void * AFNMHTTPRequestOperationStartDate; 10 | 11 | #import 12 | 13 | #if !__has_feature(objc_arc) 14 | #error AFNetworkingMeter must be built with ARC. 15 | // You can turn on ARC for only AFNetworkingMeter files by adding -fobjc-arc to the build phase for each of its files. 16 | #endif 17 | 18 | @interface AFNetworkingMeter () 19 | @property (strong, nonatomic) AFNetworkingMeterReportGenerator *reportGenerator; 20 | @end 21 | 22 | @implementation AFNetworkingMeter 23 | 24 | + (AFNetworkingMeter *)sharedMeter { 25 | static AFNetworkingMeter *_sharedMeter = nil; 26 | 27 | static dispatch_once_t onceToken; 28 | dispatch_once(&onceToken, ^{ 29 | _sharedMeter = [[self alloc] init]; 30 | }); 31 | 32 | return _sharedMeter; 33 | } 34 | 35 | - (id)init { 36 | self = [super init]; 37 | 38 | if (self == nil) return nil; 39 | 40 | self.data = [[AFNetworkingMeterData alloc] init]; 41 | 42 | self.includesHTTPHeadersSize = YES; 43 | self.lazyReporting = NO; 44 | 45 | return self; 46 | } 47 | 48 | - (void)dealloc { 49 | [self stopMeter]; 50 | } 51 | 52 | - (void)startMeter { 53 | [self stopMeter]; 54 | 55 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(HTTPOperationDidStart:) name:AFNetworkingOperationDidStartNotification object:nil]; 56 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(HTTPOperationDidFinish:) name:AFNetworkingOperationDidFinishNotification object:nil]; 57 | } 58 | 59 | - (void)stopMeter { 60 | [[NSNotificationCenter defaultCenter] removeObserver:self]; 61 | } 62 | 63 | - (AFNetworkingMeterReportGenerator *)reportGenerator { 64 | if (_reportGenerator == nil) { 65 | _reportGenerator = [[AFNetworkingMeterReportGenerator alloc] init]; 66 | } 67 | 68 | return _reportGenerator; 69 | } 70 | 71 | - (NSString *)formattedReport { 72 | NSMutableDictionary *reportOptions = [NSMutableDictionary dictionary]; 73 | 74 | if (self.includesHTTPHeadersSize) { 75 | [reportOptions setValue:@(YES) forKey:AFNetworkingMeterOptionIncludesHTTPHeadersSize]; 76 | } 77 | 78 | if (self.lazyReporting) { 79 | [reportOptions setValue:@(YES) forKey:AFNetworkingMeterOptionLazyReporting]; 80 | } 81 | 82 | NSString *formattedReport = [self.reportGenerator generateFormattedReportForData:self.data options:reportOptions]; 83 | 84 | return formattedReport; 85 | } 86 | 87 | #pragma mark - NSNotification 88 | 89 | - (void)HTTPOperationDidStart:(NSNotification *)notification { 90 | AFHTTPRequestOperation *operation = (AFHTTPRequestOperation *)[notification object]; 91 | 92 | if ([operation isKindOfClass:[AFHTTPRequestOperation class]] == NO) { 93 | return; 94 | } 95 | 96 | if (self.filterPredicate && [self.filterPredicate evaluateWithObject:operation]) { 97 | return; 98 | } 99 | 100 | [operation setAFNMStartDate:[NSDate date]]; 101 | 102 | [self.data collectRequestDataFromAFHTTPRequestOperation:operation]; 103 | } 104 | 105 | - (void)HTTPOperationDidFinish:(NSNotification *)notification { 106 | AFHTTPRequestOperation *operation = (AFHTTPRequestOperation *)[notification object]; 107 | 108 | if ([operation isKindOfClass:[AFHTTPRequestOperation class]] == NO) { 109 | return; 110 | } 111 | 112 | if (self.filterPredicate && [self.filterPredicate evaluateWithObject:operation]) { 113 | return; 114 | } 115 | 116 | [self.data collectResponseDataFromAFHTTPRequestOperation:operation]; 117 | } 118 | 119 | @end 120 | -------------------------------------------------------------------------------- /AFNetworkingMeter/AFNetworkingMeterConstants.h: -------------------------------------------------------------------------------- 1 | // 2 | // AFNetworkingMeterConstants.h 3 | // 4 | // 5 | // Created by Stanislaw Pankevich on 9/9/13. 6 | // Copyright (c) 2013 Stanislaw Pankevich. All rights reserved. 7 | // 8 | 9 | #ifndef AFNetworkingMeterApp_AFNetworkingMeterConstants_h 10 | #define AFNetworkingMeterApp_AFNetworkingMeterConstants_h 11 | 12 | #pragma mark 13 | #pragma mark AFNetworkingMeter options 14 | 15 | static NSString * const AFNetworkingMeterOptionIncludesHTTPHeadersSize = @"AFNetworkingMeterOptionIncludesHTTPHeadersSize"; 16 | static NSString * const AFNetworkingMeterOptionLazyReporting = @"AFNetworkingMeterOptionLazyReporting"; 17 | 18 | #pragma mark 19 | #pragma mark AFNetworkingMeter data 20 | 21 | static NSString * const AFNetworkingMeterDataKeyRequests = @"AFNetworkingMeterDataKeyRequests"; 22 | static NSString * const AFNetworkingMeterDataKeyResponses = @"AFNetworkingMeterDataKeyResponses"; 23 | 24 | 25 | static NSString * const AFNetworkingMeterDataKeyHeaderBytesReceived = @"AFNetworkingMeterDataKeyHeaderBytesReceived"; 26 | static NSString * const AFNetworkingMeterDataKeyHeaderBytesSent = @"AFNetworkingMeterDataKeyHeaderBytesSent"; 27 | 28 | 29 | static NSString * const AFNetworkingMeterDataKeyBodyBytesReceived = @"AFNetworkingMeterDataKeyBodyBytesReceived"; 30 | static NSString * const AFNetworkingMeterDataKeyBodyBytesSent = @"AFNetworkingMeterDataKeyBodyBytesSent"; 31 | 32 | 33 | static NSString * const AFNetworkingMeterDataKeyBytesReceived = @"AFNetworkingMeterDataKeyBytesReceived"; 34 | static NSString * const AFNetworkingMeterDataKeyBytesSent = @"AFNetworkingMeterDataKeyBytesSent"; 35 | 36 | 37 | static NSString * const AFNetworkingMeterDataKeyMinimalElapsedTimeForRequest = @"AFNetworkingMeterDataKeyMinimalElapsedTimeForRequest"; 38 | static NSString * const AFNetworkingMeterDataKeyMaximalElapsedTimeForRequest = @"AFNetworkingMeterDataKeyMaximalElapsedTimeForRequest"; 39 | 40 | 41 | static NSString * const AFNetworkingMeterDataKeyTotalServerErrors = @"AFNetworkingMeterDataKeyTotalServerErrors"; 42 | static NSString * const AFNetworkingMeterDataKeyServerErrors = @"AFNetworkingMeterDataKeyServerErrors"; 43 | 44 | 45 | static NSString * const AFNetworkingMeterDataKeyTotalConnectionErrors = @"AFNetworkingMeterDataKeyTotalConnectionErrors"; 46 | static NSString * const AFNetworkingMeterDataKeyConnectionErrors = @"AFNetworkingMeterDataKeyConnectionErrors"; 47 | 48 | 49 | static NSString * const AFNetworkingMeterDataKeyImageRequests = @"AFNetworkingMeterDataKeyImageRequests"; 50 | static NSString * const AFNetworkingMeterDataKeyImageResponses = @"AFNetworkingMeterDataKeyImageResponses"; 51 | static NSString * const AFNetworkingMeterDataKeyImageBytesReceived = @"AFNetworkingMeterDataKeyImageBytesReceived"; 52 | 53 | #pragma mark 54 | #pragma mark RFC 2616 HTTP status codes and reason phrases 55 | 56 | static inline NSDictionary * AFNM_RFC2616_HTTPStatusCodesAndReasonPhrases() { 57 | static NSDictionary * RFC2616_HTTPStatusCodesAndReasonPhrases; 58 | 59 | static dispatch_once_t onceToken; 60 | dispatch_once(&onceToken, ^{ 61 | RFC2616_HTTPStatusCodesAndReasonPhrases = @{ 62 | @(100): @"Continue", 63 | @(101): @"Switching Protocols", 64 | 65 | @(200): @"OK", 66 | @(201): @"Created", 67 | @(202): @"Accepted", 68 | @(203): @"Non-Authoritative Information", 69 | @(204): @"No Content", 70 | @(205): @"Reset Content", 71 | @(206): @"Partial Content", 72 | 73 | @(300): @"Multiple Choices", 74 | @(301): @"Moved Permanently", 75 | @(302): @"Found", 76 | @(303): @"See Other", 77 | @(304): @"Not Modified", 78 | @(305): @"Use Proxy", 79 | @(307): @"Temporary Redirect", 80 | 81 | @(400): @"Bad Request", 82 | @(401): @"Unauthorized", 83 | @(402): @"Payment Required", 84 | @(403): @"Forbidden", 85 | @(404): @"Not Found", 86 | @(405): @"Method Not Allowed", 87 | @(406): @"Not Acceptable", 88 | @(407): @"Proxy Authentication Required", 89 | @(408): @"Request Time-out", 90 | @(409): @"Conflict", 91 | @(410): @"Gone", 92 | @(411): @"Length Required", 93 | @(412): @"Precondition Failed", 94 | @(413): @"Request Entity Too Large", 95 | @(414): @"Request-URI Too Large", 96 | @(415): @"Unsupported Media Type", 97 | @(416): @"Requested range not satisfiable", 98 | @(417): @"Expectation Failed", 99 | 100 | @(500): @"Internal Server Error", 101 | @(501): @"Not Implemented", 102 | @(502): @"Bad Gateway", 103 | @(503): @"Service Unavailable", 104 | @(504): @"Gateway Time-out", 105 | @(505): @"HTTP Version not supported" 106 | }; 107 | }); 108 | 109 | return RFC2616_HTTPStatusCodesAndReasonPhrases; 110 | }; 111 | 112 | #pragma mark 113 | #pragma mark NSURLError humanized codes 114 | 115 | // https://github.com/stanislaw/FoundationExtensions/blob/master/FoundationExtensions/NSObjCRuntime.h 116 | #define AFNM_NSStringFromMethodForEnumType(_name, _type, _components...) static inline NSString *AFNM_NSStringFrom##_name(_type value) { \ 117 | NSArray *componentsStrings = [@(#_components) componentsSeparatedByString:@", "]; \ 118 | \ 119 | int N = (sizeof((_type[]){0, ##_components})/sizeof(_type) - 1); \ 120 | _type componentsCArray[] = { _components }; \ 121 | \ 122 | for (int i = 0; i < N; i++) { \ 123 | if (componentsCArray[i] == value) return [componentsStrings objectAtIndex:i]; \ 124 | } \ 125 | \ 126 | return nil; \ 127 | } 128 | 129 | AFNM_NSStringFromMethodForEnumType(NSURLErrorCode, 130 | NSInteger, 131 | 132 | NSURLErrorCancelled, 133 | NSURLErrorBadURL, 134 | NSURLErrorTimedOut, 135 | NSURLErrorUnsupportedURL, 136 | NSURLErrorCannotFindHost, 137 | NSURLErrorCannotConnectToHost, 138 | NSURLErrorNetworkConnectionLost, 139 | NSURLErrorDNSLookupFailed, 140 | NSURLErrorHTTPTooManyRedirects, 141 | NSURLErrorResourceUnavailable, 142 | NSURLErrorNotConnectedToInternet, 143 | NSURLErrorRedirectToNonExistentLocation, 144 | NSURLErrorBadServerResponse, 145 | NSURLErrorUserCancelledAuthentication, 146 | NSURLErrorUserAuthenticationRequired, 147 | NSURLErrorZeroByteResource, 148 | NSURLErrorCannotDecodeRawData, 149 | NSURLErrorCannotDecodeContentData, 150 | NSURLErrorCannotParseResponse, 151 | NSURLErrorFileIsDirectory, 152 | NSURLErrorFileDoesNotExist, 153 | NSURLErrorNoPermissionsToReadFile, 154 | NSURLErrorDataLengthExceedsMaximum); 155 | 156 | static inline NSString * AFNM_NSStringFromNSURLError(NSError *error) { 157 | return AFNM_NSStringFromNSURLErrorCode(error.code); 158 | } 159 | 160 | #endif 161 | -------------------------------------------------------------------------------- /AFNetworkingMeter/AFNetworkingMeterData.h: -------------------------------------------------------------------------------- 1 | // 2 | // AFNetworkingMeterData.h 3 | // AFNetworkingMeterApp 4 | // 5 | // Created by Stanislaw Pankevich on 8/21/13. 6 | // Copyright (c) 2013 Stanislaw Pankevich. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import 12 | 13 | @interface AFNetworkingMeterData : NSObject 14 | 15 | - (void)collectRequestDataFromAFHTTPRequestOperation:(AFHTTPRequestOperation *)operation; 16 | - (void)collectResponseDataFromAFHTTPRequestOperation:(AFHTTPRequestOperation *)operation; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /AFNetworkingMeter/AFNetworkingMeterData.m: -------------------------------------------------------------------------------- 1 | // 2 | // AFNetworkingMeterData.m 3 | // AFNetworkingMeterApp 4 | // 5 | // Created by Stanislaw Pankevich on 8/21/13. 6 | // Copyright (c) 2013 Stanislaw Pankevich. All rights reserved. 7 | // 8 | 9 | #import "AFNetworkingMeterData.h" 10 | #import "AFNetworkingMeterConstants.h" 11 | 12 | #import "AFHTTPRequestOperation+AFNM.h" 13 | 14 | @interface AFNetworkingMeterData () { 15 | NSMutableDictionary * _data; 16 | } 17 | 18 | @end 19 | 20 | @implementation AFNetworkingMeterData 21 | 22 | - (id)init { 23 | self = [super init]; 24 | 25 | if (self == nil) return nil; 26 | 27 | _data = [[NSMutableDictionary alloc] init]; 28 | 29 | return self; 30 | } 31 | 32 | #pragma mark 33 | #pragma mark AFHTTPRequestOperation 34 | 35 | - (void)collectRequestDataFromAFHTTPRequestOperation:(AFHTTPRequestOperation *)operation { 36 | [self addNumberValue:@(1) forKey:AFNetworkingMeterDataKeyRequests]; 37 | 38 | NSDictionary *HTTPHeaders; 39 | if ((HTTPHeaders = operation.request.allHTTPHeaderFields)) { 40 | NSData *HTTPHeadersData = [NSPropertyListSerialization dataFromPropertyList:HTTPHeaders 41 | format:NSPropertyListBinaryFormat_v1_0 errorDescription:NULL]; 42 | 43 | [self addNumberValue:@(HTTPHeadersData.length) forKey:AFNetworkingMeterDataKeyHeaderBytesSent]; 44 | } 45 | 46 | NSData *HTTPBody; 47 | if ((HTTPBody = [operation.request HTTPBody])) { 48 | [self addNumberValue:@(HTTPBody.length) forKey:AFNetworkingMeterDataKeyBodyBytesSent]; 49 | } 50 | } 51 | 52 | - (void)collectResponseDataFromAFHTTPRequestOperation:(AFHTTPRequestOperation *)operation { 53 | [self addNumberValue:@(1) forKey:AFNetworkingMeterDataKeyResponses]; 54 | 55 | NSTimeInterval elapsedTime = [[NSDate date] timeIntervalSinceDate:[operation AFNMStartDate]]; 56 | 57 | [self setMinimalNumberValue:@(elapsedTime) forKey:AFNetworkingMeterDataKeyMinimalElapsedTimeForRequest]; 58 | [self setMaximalNumberValue:@(elapsedTime) forKey:AFNetworkingMeterDataKeyMaximalElapsedTimeForRequest]; 59 | 60 | if (operation.error) { 61 | NSError *error = operation.error; 62 | if ([error.domain isEqualToString:AFNetworkingErrorDomain]) { 63 | [self addNumberValue:@(1) forKey:AFNetworkingMeterDataKeyTotalServerErrors]; 64 | 65 | NSString *statusCode = [NSString stringWithFormat:@"%@", @(operation.response.statusCode)]; 66 | 67 | NSString *reasonPhrase = AFNM_RFC2616_HTTPStatusCodesAndReasonPhrases()[@(operation.response.statusCode)]; 68 | if (reasonPhrase) statusCode = [statusCode stringByAppendingFormat:@" %@", reasonPhrase]; 69 | 70 | [self incrementValueOfDictionaryKey:statusCode forKey:AFNetworkingMeterDataKeyServerErrors]; 71 | 72 | } else if ([error.domain isEqualToString:NSURLErrorDomain]) { 73 | [self addNumberValue:@(1) forKey:AFNetworkingMeterDataKeyTotalConnectionErrors]; 74 | 75 | NSString *errorCode = AFNM_NSStringFromNSURLError(error); 76 | if (errorCode == nil) errorCode = @"Unknown NSURLError"; 77 | 78 | [self incrementValueOfDictionaryKey:errorCode forKey:AFNetworkingMeterDataKeyConnectionErrors]; 79 | 80 | return; 81 | } 82 | } else { 83 | } 84 | 85 | NSDictionary *HTTPHeaders; 86 | if ((HTTPHeaders = operation.response.allHeaderFields)) { 87 | NSData *HTTPHeadersData = [NSPropertyListSerialization dataFromPropertyList:HTTPHeaders 88 | format:NSPropertyListBinaryFormat_v1_0 errorDescription:NULL]; 89 | 90 | [self addNumberValue:@(HTTPHeadersData.length) forKey:AFNetworkingMeterDataKeyHeaderBytesReceived]; 91 | } 92 | 93 | [self addNumberValue:@(operation.responseData.length) forKey:AFNetworkingMeterDataKeyBodyBytesReceived]; 94 | } 95 | 96 | #pragma mark 97 | #pragma mark Private API ... 98 | 99 | - (void)addNumberValue:(NSNumber *)numberValue forKey:(NSString *)key { 100 | NSNumber *currentValue = [self valueForKey:key]; 101 | 102 | if (currentValue) { 103 | currentValue = @(currentValue.unsignedIntegerValue + numberValue.unsignedIntegerValue); 104 | } else { 105 | currentValue = numberValue; 106 | } 107 | 108 | [self setValue:currentValue forKey:key]; 109 | } 110 | 111 | - (void)setMinimalNumberValue:(NSNumber *)numberValue forKey:(NSString *)key { 112 | NSNumber *currentValue = [self valueForKey:key]; 113 | 114 | if (currentValue) { 115 | if (numberValue.doubleValue < currentValue.doubleValue) { 116 | currentValue = numberValue; 117 | } 118 | } else { 119 | currentValue = numberValue; 120 | } 121 | 122 | [self setValue:currentValue forKey:key]; 123 | } 124 | 125 | - (void)setMaximalNumberValue:(NSNumber *)numberValue forKey:(NSString *)key { 126 | NSNumber *currentValue = [self valueForKey:key]; 127 | 128 | if (currentValue) { 129 | if (numberValue.doubleValue > currentValue.doubleValue) { 130 | currentValue = numberValue; 131 | } 132 | } else { 133 | currentValue = numberValue; 134 | } 135 | 136 | [self setValue:currentValue forKey:key]; 137 | } 138 | 139 | - (void)incrementValueOfDictionaryKey:(NSString *)dictionaryKey forKey:(NSString *)key { 140 | 141 | NSMutableDictionary *dictionary = [self valueForKey:key]; 142 | 143 | if (dictionary == nil) dictionary = [NSMutableDictionary dictionary]; 144 | 145 | NSNumber *currentValue = [dictionary valueForKey:dictionaryKey]; 146 | 147 | if (currentValue) { 148 | currentValue = @(currentValue.unsignedIntegerValue + 1); 149 | } else { 150 | currentValue = @(1); 151 | } 152 | 153 | [dictionary setValue:currentValue forKey:dictionaryKey]; 154 | 155 | [self setValue:dictionary forKey:key]; 156 | } 157 | 158 | #pragma mark 159 | #pragma mark Private API - accessing data 160 | 161 | - (id)valueForKey:(NSString *)key { 162 | return [_data valueForKey:key]; 163 | } 164 | 165 | - (void)setValue:(id)value forKey:(NSString *)key { 166 | [_data setValue:value forKeyPath:key]; 167 | } 168 | 169 | @end 170 | -------------------------------------------------------------------------------- /AFNetworkingMeter/AFNetworkingMeterReportGenerator.h: -------------------------------------------------------------------------------- 1 | // 2 | // AFNetworkingMeterReportGenerator.h 3 | // AFNetworkingMeterApp 4 | // 5 | // Created by Stanislaw Pankevich on 9/9/13. 6 | // Copyright (c) 2013 Stanislaw Pankevich. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AFNetworkingMeterData.h" 11 | 12 | @interface AFNetworkingMeterReportGenerator : NSObject 13 | 14 | - (NSString *)generateFormattedReportForData:(AFNetworkingMeterData *)data options:(NSDictionary *)options; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /AFNetworkingMeter/AFNetworkingMeterReportGenerator.m: -------------------------------------------------------------------------------- 1 | // 2 | // AFNetworkingMeterReportGenerator.m 3 | // AFNetworkingMeterApp 4 | // 5 | // Created by Stanislaw Pankevich on 9/9/13. 6 | // Copyright (c) 2013 Stanislaw Pankevich. All rights reserved. 7 | // 8 | 9 | #import "AFNetworkingMeterReportGenerator.h" 10 | #import "AFNetworkingMeterConstants.h" 11 | 12 | #define REPORT_WIDTH 44 13 | 14 | NSString *NSStringFromCharacterAndLength(NSString *character, NSUInteger length) { 15 | return [@"" stringByPaddingToLength:length withString:character startingAtIndex:0]; 16 | } 17 | 18 | @interface AFNetworkingMeterReportGenerator () 19 | @property (readonly) NSDictionary *dataKeysMapping; 20 | @end 21 | 22 | @implementation AFNetworkingMeterReportGenerator 23 | 24 | @synthesize dataKeysMapping = _dataKeysMapping; 25 | 26 | - (NSString *)generateFormattedReportForData:(AFNetworkingMeterData *)data options:(NSDictionary *)options { 27 | BOOL includeHTTPHeadersSize = [options.allKeys containsObject:AFNetworkingMeterOptionIncludesHTTPHeadersSize]; 28 | 29 | NSMutableArray *formattedDataComponents = [NSMutableArray array]; 30 | 31 | NSString *stringWithLengthEqualToReportWidthAndFilledWithSpaces = NSStringFromCharacterAndLength(@" ", REPORT_WIDTH); 32 | 33 | NSMutableString *requestsString, 34 | *responsesString, 35 | *minimalElapsedTimeString, 36 | *maximalElapsedTimeString, 37 | *totalConnectionErrorsString, 38 | *connectionErrorsString, 39 | *serverErrorsString; 40 | 41 | #pragma mark Summary 42 | 43 | NSDecimalNumber *requestsNumber = [NSDecimalNumber decimalNumberWithDecimal:[[data valueForKey:AFNetworkingMeterDataKeyRequests] decimalValue]]; 44 | NSDecimalNumber *responsesNumber = [NSDecimalNumber decimalNumberWithDecimal:[[data valueForKey:AFNetworkingMeterDataKeyResponses] decimalValue]]; 45 | 46 | BOOL atLeastOneRequestHasBeenMade = [requestsNumber compare:[NSDecimalNumber zero]] == NSOrderedDescending; 47 | 48 | NSString *requestsValue = [requestsNumber stringValue]; 49 | NSString *responsesValue = [responsesNumber stringValue]; 50 | 51 | 52 | NSDecimalNumber *bodyBytesSentNumber = [NSDecimalNumber decimalNumberWithDecimal:[[data valueForKey:AFNetworkingMeterDataKeyBodyBytesSent] decimalValue]]; 53 | NSDecimalNumber *bodyBytesReceivedNumber = [NSDecimalNumber decimalNumberWithDecimal:[[data valueForKey:AFNetworkingMeterDataKeyBodyBytesSent] decimalValue]]; 54 | 55 | NSDecimalNumber *bytesSentNumber = [bodyBytesSentNumber copy]; 56 | NSDecimalNumber *bytesReceivedNumber = [bodyBytesReceivedNumber copy]; 57 | 58 | if (includeHTTPHeadersSize) { 59 | NSDecimalNumber *headerBytesSentNumber = [NSDecimalNumber decimalNumberWithDecimal:[[data valueForKey:AFNetworkingMeterDataKeyHeaderBytesSent] decimalValue]]; 60 | NSDecimalNumber *headerBytesReceivedNumber = [NSDecimalNumber decimalNumberWithDecimal:[[data valueForKey:AFNetworkingMeterDataKeyHeaderBytesSent] decimalValue]]; 61 | 62 | bytesSentNumber = [bytesSentNumber decimalNumberByAdding:headerBytesSentNumber]; 63 | bytesReceivedNumber = [bytesReceivedNumber decimalNumberByAdding:headerBytesReceivedNumber]; 64 | } 65 | 66 | NSString *bytesSentValue = [bytesSentNumber stringValue]; 67 | NSString *bytesReceivedValue = [bytesReceivedNumber stringValue]; 68 | 69 | 70 | NSString *requestsKey = self.dataKeysMapping[AFNetworkingMeterDataKeyRequests]; 71 | NSString *responsesKey = self.dataKeysMapping[AFNetworkingMeterDataKeyResponses]; 72 | NSString *bytesSentKey = self.dataKeysMapping[AFNetworkingMeterDataKeyBytesSent]; 73 | NSString *bytesReceivedKey = self.dataKeysMapping[AFNetworkingMeterDataKeyBytesReceived]; 74 | 75 | 76 | requestsString = [stringWithLengthEqualToReportWidthAndFilledWithSpaces mutableCopy]; 77 | [requestsString replaceCharactersInRange:NSMakeRange(0, requestsKey.length) withString:requestsKey]; 78 | [requestsString replaceCharactersInRange:NSMakeRange(REPORT_WIDTH - requestsValue.length, requestsValue.length) withString:requestsValue]; 79 | 80 | 81 | responsesString = [stringWithLengthEqualToReportWidthAndFilledWithSpaces mutableCopy]; 82 | [responsesString replaceCharactersInRange:NSMakeRange(0, responsesKey.length) withString:responsesKey]; 83 | [responsesString replaceCharactersInRange:NSMakeRange(REPORT_WIDTH - responsesValue.length, responsesValue.length) withString:responsesValue]; 84 | 85 | 86 | NSMutableString *bytesSentString = [stringWithLengthEqualToReportWidthAndFilledWithSpaces mutableCopy]; 87 | [bytesSentString replaceCharactersInRange:NSMakeRange(0, bytesSentKey.length) withString:bytesSentKey]; 88 | [bytesSentString replaceCharactersInRange:NSMakeRange(REPORT_WIDTH - bytesSentValue.length, bytesSentValue.length) withString:bytesSentValue]; 89 | 90 | 91 | NSMutableString *bytesReceivedString = [stringWithLengthEqualToReportWidthAndFilledWithSpaces mutableCopy]; 92 | [bytesReceivedString replaceCharactersInRange:NSMakeRange(0, bytesReceivedKey.length) withString:bytesReceivedKey]; 93 | [bytesReceivedString replaceCharactersInRange:NSMakeRange(REPORT_WIDTH - bytesReceivedValue.length, bytesReceivedValue.length) withString:bytesReceivedValue]; 94 | 95 | #pragma mark Elapsed time 96 | 97 | if (atLeastOneRequestHasBeenMade) { 98 | NSNumberFormatter * numberFormatter = [[NSNumberFormatter alloc] init]; 99 | numberFormatter.numberStyle = NSNumberFormatterDecimalStyle; 100 | numberFormatter.minimumFractionDigits = 0; 101 | numberFormatter.maximumFractionDigits = 7; 102 | numberFormatter.minimumIntegerDigits = 1; 103 | 104 | 105 | NSString *minimalElapsedTimeKey = self.dataKeysMapping[AFNetworkingMeterDataKeyMinimalElapsedTimeForRequest]; 106 | NSString *maximalElapsedTimeKey = self.dataKeysMapping[AFNetworkingMeterDataKeyMaximalElapsedTimeForRequest]; 107 | 108 | 109 | NSString *minimalElapsedTimeValue = [numberFormatter stringFromNumber:[data valueForKey:AFNetworkingMeterDataKeyMinimalElapsedTimeForRequest]]; 110 | NSString *maximalElapsedTimeValue = [numberFormatter stringFromNumber:[data valueForKey:AFNetworkingMeterDataKeyMaximalElapsedTimeForRequest]]; 111 | 112 | 113 | minimalElapsedTimeString = [stringWithLengthEqualToReportWidthAndFilledWithSpaces mutableCopy]; 114 | [minimalElapsedTimeString replaceCharactersInRange:NSMakeRange(0, minimalElapsedTimeKey.length) withString:minimalElapsedTimeKey]; 115 | [minimalElapsedTimeString replaceCharactersInRange:NSMakeRange(REPORT_WIDTH - minimalElapsedTimeValue.length, minimalElapsedTimeValue.length) withString:minimalElapsedTimeValue]; 116 | 117 | 118 | maximalElapsedTimeString = [stringWithLengthEqualToReportWidthAndFilledWithSpaces mutableCopy]; 119 | [maximalElapsedTimeString replaceCharactersInRange:NSMakeRange(0, maximalElapsedTimeKey.length) withString:maximalElapsedTimeKey]; 120 | [maximalElapsedTimeString replaceCharactersInRange:NSMakeRange(REPORT_WIDTH - maximalElapsedTimeValue.length, maximalElapsedTimeValue.length) withString:maximalElapsedTimeValue]; 121 | } 122 | 123 | #pragma mark Server errors 124 | 125 | NSDecimalNumber *totalServerErrorsNumber = [NSDecimalNumber decimalNumberWithDecimal:[[data valueForKey:AFNetworkingMeterDataKeyTotalServerErrors] decimalValue]]; 126 | NSString *totalServerErrorsValue = [totalServerErrorsNumber stringValue]; 127 | BOOL atLeastOneServerErrorHasOccured = [totalServerErrorsNumber compare:[NSDecimalNumber zero]] == NSOrderedDescending; 128 | 129 | 130 | NSString *totalServerErrorsKey = self.dataKeysMapping[AFNetworkingMeterDataKeyTotalServerErrors]; 131 | NSMutableString *totalServerErrorsString = [stringWithLengthEqualToReportWidthAndFilledWithSpaces mutableCopy]; 132 | [totalServerErrorsString replaceCharactersInRange:NSMakeRange(0, totalServerErrorsKey.length) withString:totalServerErrorsKey]; 133 | [totalServerErrorsString replaceCharactersInRange:NSMakeRange(REPORT_WIDTH - totalServerErrorsValue.length, totalServerErrorsValue.length) withString:totalServerErrorsValue]; 134 | 135 | 136 | if (atLeastOneServerErrorHasOccured) { 137 | NSDictionary *serverErrorsValue = [data valueForKey:AFNetworkingMeterDataKeyServerErrors]; 138 | 139 | NSMutableArray *serverErrorsStringsArray = [NSMutableArray array]; 140 | 141 | [serverErrorsValue enumerateKeysAndObjectsUsingBlock:^(NSString *statusCodeString, NSNumber *quantity, BOOL *stop) { 142 | NSString *quantityString = [quantity stringValue]; 143 | 144 | NSMutableString *errorString = [stringWithLengthEqualToReportWidthAndFilledWithSpaces mutableCopy]; 145 | 146 | [errorString replaceCharactersInRange:NSMakeRange(0, statusCodeString.length) withString:statusCodeString]; 147 | [errorString replaceCharactersInRange:NSMakeRange(REPORT_WIDTH - quantityString.length, quantityString.length) withString:quantityString]; 148 | 149 | [serverErrorsStringsArray addObject:errorString]; 150 | }]; 151 | 152 | serverErrorsString = [[serverErrorsStringsArray componentsJoinedByString:@"\n"] mutableCopy]; 153 | } 154 | 155 | #pragma mark Connection errors 156 | 157 | NSNumber *totalConnectionErrorsNumber = [NSDecimalNumber decimalNumberWithDecimal:[[data valueForKey:AFNetworkingMeterDataKeyTotalConnectionErrors] decimalValue]]; 158 | 159 | NSString *totalConnectionErrorsValue = [totalConnectionErrorsNumber stringValue]; 160 | BOOL atLeastOneConnectionErrorHasOccured = [totalConnectionErrorsNumber compare:[NSDecimalNumber zero]] == NSOrderedDescending;; 161 | 162 | NSString *totalConnectionErrorsKey = self.dataKeysMapping[AFNetworkingMeterDataKeyTotalConnectionErrors]; 163 | totalConnectionErrorsString = [stringWithLengthEqualToReportWidthAndFilledWithSpaces mutableCopy]; 164 | [totalConnectionErrorsString replaceCharactersInRange:NSMakeRange(0, totalConnectionErrorsKey.length) withString:totalConnectionErrorsKey]; 165 | [totalConnectionErrorsString replaceCharactersInRange:NSMakeRange(REPORT_WIDTH - totalConnectionErrorsValue.length, totalConnectionErrorsValue.length) withString:totalConnectionErrorsValue]; 166 | 167 | 168 | if (atLeastOneConnectionErrorHasOccured) { 169 | NSDictionary *connectionErrorsValue = [data valueForKey:AFNetworkingMeterDataKeyConnectionErrors]; 170 | 171 | NSMutableArray *connectionErrorsStringsArray = [NSMutableArray array]; 172 | 173 | [connectionErrorsValue enumerateKeysAndObjectsUsingBlock:^(NSString *NSURLErrorString, NSNumber *quantity, BOOL *stop) { 174 | NSString *quantityString = [quantity stringValue]; 175 | 176 | NSMutableString *errorString = [stringWithLengthEqualToReportWidthAndFilledWithSpaces mutableCopy]; 177 | 178 | [errorString replaceCharactersInRange:NSMakeRange(0, NSURLErrorString.length) withString:NSURLErrorString]; 179 | [errorString replaceCharactersInRange:NSMakeRange(REPORT_WIDTH - quantityString.length, quantityString.length) withString:quantityString]; 180 | 181 | [connectionErrorsStringsArray addObject:errorString]; 182 | }]; 183 | 184 | connectionErrorsString = [[connectionErrorsStringsArray componentsJoinedByString:@"\n"] mutableCopy]; 185 | } 186 | 187 | #pragma mark Aggregation of a formatted report 188 | 189 | BOOL lazyReporting = [options.allKeys containsObject:AFNetworkingMeterOptionLazyReporting]; 190 | 191 | NSString *headerTop = NSStringFromCharacterAndLength(@"=", REPORT_WIDTH); 192 | NSString *headerTitle = @" AFNetworkingMeter - formatted report "; 193 | NSString *headerBottom = NSStringFromCharacterAndLength(@"-", REPORT_WIDTH); 194 | 195 | NSString *headerString = [@[headerTop, headerTitle, headerBottom] componentsJoinedByString:@"\n"]; 196 | 197 | [formattedDataComponents addObject:@"\n\n"]; 198 | [formattedDataComponents addObject:headerString]; 199 | 200 | [formattedDataComponents addObject:@"\n\n"]; 201 | 202 | [formattedDataComponents addObject:requestsString]; 203 | [formattedDataComponents addObject:@"\n"]; 204 | [formattedDataComponents addObject:responsesString]; 205 | 206 | [formattedDataComponents addObject:@"\n\n"]; 207 | 208 | [formattedDataComponents addObject:bytesSentString]; 209 | [formattedDataComponents addObject:@"\n"]; 210 | 211 | [formattedDataComponents addObject:bytesReceivedString]; 212 | [formattedDataComponents addObject:@"\n"]; 213 | 214 | if (atLeastOneRequestHasBeenMade) { 215 | [formattedDataComponents addObject:@"\n"]; 216 | [formattedDataComponents addObject:@"Elapsed time for request ..................."]; 217 | [formattedDataComponents addObject:@"\n\n"]; 218 | 219 | [formattedDataComponents addObject:minimalElapsedTimeString]; 220 | [formattedDataComponents addObject:@"\n"]; 221 | 222 | [formattedDataComponents addObject:maximalElapsedTimeString]; 223 | [formattedDataComponents addObject:@"\n"]; 224 | } 225 | 226 | if (atLeastOneServerErrorHasOccured || lazyReporting == NO) { 227 | [formattedDataComponents addObject:@"\n"]; 228 | [formattedDataComponents addObject:@"Server errors .............................."]; 229 | [formattedDataComponents addObject:@"\n\n"]; 230 | 231 | [formattedDataComponents addObject:totalServerErrorsString]; 232 | [formattedDataComponents addObject:@"\n"]; 233 | 234 | if (atLeastOneServerErrorHasOccured) { 235 | [formattedDataComponents addObject:serverErrorsString]; 236 | [formattedDataComponents addObject:@"\n"]; 237 | } 238 | } 239 | 240 | if (atLeastOneConnectionErrorHasOccured || lazyReporting == NO) { 241 | [formattedDataComponents addObject:@"\n"]; 242 | [formattedDataComponents addObject:@"Connection errors (NSURLError) ............."]; 243 | [formattedDataComponents addObject:@"\n\n"]; 244 | 245 | [formattedDataComponents addObject:totalConnectionErrorsString]; 246 | [formattedDataComponents addObject:@"\n"]; 247 | 248 | if (atLeastOneConnectionErrorHasOccured) { 249 | [formattedDataComponents addObject:connectionErrorsString]; 250 | [formattedDataComponents addObject:@"\n"]; 251 | } 252 | } 253 | 254 | [formattedDataComponents addObject:@"\n"]; 255 | [formattedDataComponents addObject:@"============================================"]; 256 | [formattedDataComponents addObject:@"\n\n"]; 257 | 258 | return [formattedDataComponents componentsJoinedByString:@""]; 259 | } 260 | 261 | - (NSDictionary *)dataKeysMapping { 262 | if (_dataKeysMapping == nil) { 263 | _dataKeysMapping = @{ 264 | AFNetworkingMeterDataKeyRequests : @"Requests:", 265 | AFNetworkingMeterDataKeyResponses : @"Responses:", 266 | 267 | AFNetworkingMeterDataKeyBytesReceived : @"Received (bytes):", 268 | AFNetworkingMeterDataKeyBytesSent : @"Sent (bytes):", 269 | 270 | AFNetworkingMeterDataKeyMinimalElapsedTimeForRequest : @"Min (seconds):", 271 | AFNetworkingMeterDataKeyMaximalElapsedTimeForRequest : @"Max (seconds):", 272 | 273 | AFNetworkingMeterDataKeyTotalServerErrors : @"Total:", 274 | 275 | AFNetworkingMeterDataKeyTotalConnectionErrors : @"Total:", 276 | 277 | AFNetworkingMeterDataKeyImageRequests : @"Requests:", 278 | AFNetworkingMeterDataKeyImageResponses : @"Responses:", 279 | AFNetworkingMeterDataKeyImageBytesReceived : @"Data received (bytes):" 280 | }; 281 | } 282 | 283 | return _dataKeysMapping; 284 | } 285 | 286 | @end 287 | -------------------------------------------------------------------------------- /AFNetworkingMeterApp/.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | .DS_Store 3 | */build/* 4 | *.xcworkspace 5 | !default.xcworkspace 6 | *.pbxuser 7 | !default.pbxuser 8 | *.mode1v3 9 | !default.mode1v3 10 | *.mode2v3 11 | !default.mode2v3 12 | *.perspectivev3 13 | !default.perspectivev3 14 | xcuserdata 15 | !*.xcscheme 16 | profile 17 | *.moved-aside 18 | DerivedData 19 | .idea/ 20 | *.hmapods/* 21 | Podfile.lock 22 | Pods/ 23 | Build/ 24 | -------------------------------------------------------------------------------- /AFNetworkingMeterApp/AFNetworkingMeterApp.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 0B163FA9B3F5408E84B4467B /* libPods-AFNetworkingMeterAppTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 07C5326899754554B9FEA1B4 /* libPods-AFNetworkingMeterAppTests.a */; }; 11 | 861F363317CC47710028D579 /* apple.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 861F363217CC47710028D579 /* apple.jpg */; }; 12 | 868AE28717DE4B1500B499BC /* AFNetworkingMeterReportGenerator.m in Sources */ = {isa = PBXBuildFile; fileRef = 868AE28617DE4B1500B499BC /* AFNetworkingMeterReportGenerator.m */; }; 13 | 868AE28B17DE4E6A00B499BC /* AFNetworkingMeterReportGenerator.m in Sources */ = {isa = PBXBuildFile; fileRef = 868AE28617DE4B1500B499BC /* AFNetworkingMeterReportGenerator.m */; }; 14 | 86C6442C17C4FEF200570DFB /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 86C6442B17C4FEF200570DFB /* UIKit.framework */; }; 15 | 86C6442E17C4FEF200570DFB /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 86C6442D17C4FEF200570DFB /* Foundation.framework */; }; 16 | 86C6443017C4FEF200570DFB /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 86C6442F17C4FEF200570DFB /* CoreGraphics.framework */; }; 17 | 86C6443617C4FEF200570DFB /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 86C6443417C4FEF200570DFB /* InfoPlist.strings */; }; 18 | 86C6443817C4FEF200570DFB /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 86C6443717C4FEF200570DFB /* main.m */; }; 19 | 86C6443C17C4FEF200570DFB /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 86C6443B17C4FEF200570DFB /* AppDelegate.m */; }; 20 | 86C6443E17C4FEF200570DFB /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = 86C6443D17C4FEF200570DFB /* Default.png */; }; 21 | 86C6444017C4FEF200570DFB /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 86C6443F17C4FEF200570DFB /* Default@2x.png */; }; 22 | 86C6444217C4FEF200570DFB /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 86C6444117C4FEF200570DFB /* Default-568h@2x.png */; }; 23 | 86C6444517C4FEF200570DFB /* MainStoryboard_iPhone.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 86C6444317C4FEF200570DFB /* MainStoryboard_iPhone.storyboard */; }; 24 | 86C6444817C4FEF200570DFB /* MainStoryboard_iPad.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 86C6444617C4FEF200570DFB /* MainStoryboard_iPad.storyboard */; }; 25 | 86C6444B17C4FEF200570DFB /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 86C6444A17C4FEF200570DFB /* ViewController.m */; }; 26 | 86C6445317C4FEF300570DFB /* SenTestingKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 86C6445217C4FEF300570DFB /* SenTestingKit.framework */; }; 27 | 86C6445417C4FEF300570DFB /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 86C6442B17C4FEF200570DFB /* UIKit.framework */; }; 28 | 86C6445517C4FEF300570DFB /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 86C6442D17C4FEF200570DFB /* Foundation.framework */; }; 29 | 86C6445D17C4FEF300570DFB /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 86C6445B17C4FEF300570DFB /* InfoPlist.strings */; }; 30 | 86C6446017C4FEF300570DFB /* AFNetworkingMeterAppTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 86C6445F17C4FEF300570DFB /* AFNetworkingMeterAppTests.m */; }; 31 | 86C6446C17C4FEFD00570DFB /* AFNetworkingMeter.m in Sources */ = {isa = PBXBuildFile; fileRef = 86C6446B17C4FEFD00570DFB /* AFNetworkingMeter.m */; }; 32 | 86C6447017C518B600570DFB /* AFNetworkingMeter.m in Sources */ = {isa = PBXBuildFile; fileRef = 86C6446B17C4FEFD00570DFB /* AFNetworkingMeter.m */; }; 33 | 86C6447317C524D100570DFB /* AFNetworkingMeterData.m in Sources */ = {isa = PBXBuildFile; fileRef = 86C6447217C524D100570DFB /* AFNetworkingMeterData.m */; }; 34 | 86C6447417C5298A00570DFB /* AFNetworkingMeterData.m in Sources */ = {isa = PBXBuildFile; fileRef = 86C6447217C524D100570DFB /* AFNetworkingMeterData.m */; }; 35 | 86C6447817C550CC00570DFB /* AFHTTPRequestOperation+AFNM.m in Sources */ = {isa = PBXBuildFile; fileRef = 86C6447717C550CB00570DFB /* AFHTTPRequestOperation+AFNM.m */; }; 36 | 86C6447917C5521900570DFB /* AFHTTPRequestOperation+AFNM.m in Sources */ = {isa = PBXBuildFile; fileRef = 86C6447717C550CB00570DFB /* AFHTTPRequestOperation+AFNM.m */; }; 37 | ADABB829E0AD4426812BA12E /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BF9F0842D6E4486C867BBA7A /* libPods.a */; }; 38 | /* End PBXBuildFile section */ 39 | 40 | /* Begin PBXContainerItemProxy section */ 41 | 86C6445617C4FEF300570DFB /* PBXContainerItemProxy */ = { 42 | isa = PBXContainerItemProxy; 43 | containerPortal = 86C6442017C4FEF200570DFB /* Project object */; 44 | proxyType = 1; 45 | remoteGlobalIDString = 86C6442717C4FEF200570DFB; 46 | remoteInfo = AFNetworkingMeterApp; 47 | }; 48 | /* End PBXContainerItemProxy section */ 49 | 50 | /* Begin PBXFileReference section */ 51 | 07C5326899754554B9FEA1B4 /* libPods-AFNetworkingMeterAppTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-AFNetworkingMeterAppTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 52 | 484BC3D3A6E343E0A896479E /* Pods-AFNetworkingMeterAppTests.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AFNetworkingMeterAppTests.xcconfig"; path = "Pods/Pods-AFNetworkingMeterAppTests.xcconfig"; sourceTree = SOURCE_ROOT; }; 53 | 4EF07AB9A03A42B2BB3BE7CF /* Pods.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.xcconfig; path = Pods/Pods.xcconfig; sourceTree = SOURCE_ROOT; }; 54 | 861F363217CC47710028D579 /* apple.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = apple.jpg; sourceTree = ""; }; 55 | 868AE28517DE4B1500B499BC /* AFNetworkingMeterReportGenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AFNetworkingMeterReportGenerator.h; sourceTree = ""; }; 56 | 868AE28617DE4B1500B499BC /* AFNetworkingMeterReportGenerator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFNetworkingMeterReportGenerator.m; sourceTree = ""; }; 57 | 868AE28817DE4D1A00B499BC /* AFNetworkingMeterConstants.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AFNetworkingMeterConstants.h; sourceTree = ""; }; 58 | 86C6442817C4FEF200570DFB /* AFNetworkingMeterApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AFNetworkingMeterApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; 59 | 86C6442B17C4FEF200570DFB /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 60 | 86C6442D17C4FEF200570DFB /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 61 | 86C6442F17C4FEF200570DFB /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 62 | 86C6443317C4FEF200570DFB /* AFNetworkingMeterApp-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "AFNetworkingMeterApp-Info.plist"; sourceTree = ""; }; 63 | 86C6443517C4FEF200570DFB /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 64 | 86C6443717C4FEF200570DFB /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 65 | 86C6443917C4FEF200570DFB /* AFNetworkingMeterApp-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "AFNetworkingMeterApp-Prefix.pch"; sourceTree = ""; }; 66 | 86C6443A17C4FEF200570DFB /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 67 | 86C6443B17C4FEF200570DFB /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 68 | 86C6443D17C4FEF200570DFB /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = ""; }; 69 | 86C6443F17C4FEF200570DFB /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default@2x.png"; sourceTree = ""; }; 70 | 86C6444117C4FEF200570DFB /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = ""; }; 71 | 86C6444417C4FEF200570DFB /* en */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = en; path = en.lproj/MainStoryboard_iPhone.storyboard; sourceTree = ""; }; 72 | 86C6444717C4FEF200570DFB /* en */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = en; path = en.lproj/MainStoryboard_iPad.storyboard; sourceTree = ""; }; 73 | 86C6444917C4FEF200570DFB /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 74 | 86C6444A17C4FEF200570DFB /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 75 | 86C6445117C4FEF300570DFB /* AFNetworkingMeterAppTests.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AFNetworkingMeterAppTests.octest; sourceTree = BUILT_PRODUCTS_DIR; }; 76 | 86C6445217C4FEF300570DFB /* SenTestingKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SenTestingKit.framework; path = Library/Frameworks/SenTestingKit.framework; sourceTree = DEVELOPER_DIR; }; 77 | 86C6445A17C4FEF300570DFB /* AFNetworkingMeterAppTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "AFNetworkingMeterAppTests-Info.plist"; sourceTree = ""; }; 78 | 86C6445C17C4FEF300570DFB /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 79 | 86C6445F17C4FEF300570DFB /* AFNetworkingMeterAppTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AFNetworkingMeterAppTests.m; sourceTree = ""; }; 80 | 86C6446A17C4FEFD00570DFB /* AFNetworkingMeter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AFNetworkingMeter.h; sourceTree = ""; }; 81 | 86C6446B17C4FEFD00570DFB /* AFNetworkingMeter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFNetworkingMeter.m; sourceTree = ""; }; 82 | 86C6446D17C507EE00570DFB /* TestHelpers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestHelpers.h; sourceTree = ""; }; 83 | 86C6446E17C518A400570DFB /* libPods.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libPods.a; path = "Pods/build/Release-iphoneos/libPods.a"; sourceTree = ""; }; 84 | 86C6447117C524D100570DFB /* AFNetworkingMeterData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AFNetworkingMeterData.h; sourceTree = ""; }; 85 | 86C6447217C524D100570DFB /* AFNetworkingMeterData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFNetworkingMeterData.m; sourceTree = ""; }; 86 | 86C6447617C550CB00570DFB /* AFHTTPRequestOperation+AFNM.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "AFHTTPRequestOperation+AFNM.h"; sourceTree = ""; }; 87 | 86C6447717C550CB00570DFB /* AFHTTPRequestOperation+AFNM.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "AFHTTPRequestOperation+AFNM.m"; sourceTree = ""; }; 88 | BF9F0842D6E4486C867BBA7A /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; }; 89 | /* End PBXFileReference section */ 90 | 91 | /* Begin PBXFrameworksBuildPhase section */ 92 | 86C6442517C4FEF200570DFB /* Frameworks */ = { 93 | isa = PBXFrameworksBuildPhase; 94 | buildActionMask = 2147483647; 95 | files = ( 96 | 86C6442C17C4FEF200570DFB /* UIKit.framework in Frameworks */, 97 | 86C6442E17C4FEF200570DFB /* Foundation.framework in Frameworks */, 98 | 86C6443017C4FEF200570DFB /* CoreGraphics.framework in Frameworks */, 99 | ADABB829E0AD4426812BA12E /* libPods.a in Frameworks */, 100 | ); 101 | runOnlyForDeploymentPostprocessing = 0; 102 | }; 103 | 86C6444D17C4FEF300570DFB /* Frameworks */ = { 104 | isa = PBXFrameworksBuildPhase; 105 | buildActionMask = 2147483647; 106 | files = ( 107 | 86C6445317C4FEF300570DFB /* SenTestingKit.framework in Frameworks */, 108 | 86C6445417C4FEF300570DFB /* UIKit.framework in Frameworks */, 109 | 86C6445517C4FEF300570DFB /* Foundation.framework in Frameworks */, 110 | 0B163FA9B3F5408E84B4467B /* libPods-AFNetworkingMeterAppTests.a in Frameworks */, 111 | ); 112 | runOnlyForDeploymentPostprocessing = 0; 113 | }; 114 | /* End PBXFrameworksBuildPhase section */ 115 | 116 | /* Begin PBXGroup section */ 117 | 86C6441F17C4FEF200570DFB = { 118 | isa = PBXGroup; 119 | children = ( 120 | 86C6446917C4FEFD00570DFB /* AFNetworkingMeter */, 121 | 86C6443117C4FEF200570DFB /* AFNetworkingMeterApp */, 122 | 86C6445817C4FEF300570DFB /* AFNetworkingMeterAppTests */, 123 | 86C6442A17C4FEF200570DFB /* Frameworks */, 124 | 86C6442917C4FEF200570DFB /* Products */, 125 | 4EF07AB9A03A42B2BB3BE7CF /* Pods.xcconfig */, 126 | 484BC3D3A6E343E0A896479E /* Pods-AFNetworkingMeterAppTests.xcconfig */, 127 | ); 128 | sourceTree = ""; 129 | }; 130 | 86C6442917C4FEF200570DFB /* Products */ = { 131 | isa = PBXGroup; 132 | children = ( 133 | 86C6442817C4FEF200570DFB /* AFNetworkingMeterApp.app */, 134 | 86C6445117C4FEF300570DFB /* AFNetworkingMeterAppTests.octest */, 135 | ); 136 | name = Products; 137 | sourceTree = ""; 138 | }; 139 | 86C6442A17C4FEF200570DFB /* Frameworks */ = { 140 | isa = PBXGroup; 141 | children = ( 142 | 86C6446E17C518A400570DFB /* libPods.a */, 143 | 86C6442B17C4FEF200570DFB /* UIKit.framework */, 144 | 86C6442D17C4FEF200570DFB /* Foundation.framework */, 145 | 86C6442F17C4FEF200570DFB /* CoreGraphics.framework */, 146 | 86C6445217C4FEF300570DFB /* SenTestingKit.framework */, 147 | BF9F0842D6E4486C867BBA7A /* libPods.a */, 148 | 07C5326899754554B9FEA1B4 /* libPods-AFNetworkingMeterAppTests.a */, 149 | ); 150 | name = Frameworks; 151 | sourceTree = ""; 152 | }; 153 | 86C6443117C4FEF200570DFB /* AFNetworkingMeterApp */ = { 154 | isa = PBXGroup; 155 | children = ( 156 | 86C6443A17C4FEF200570DFB /* AppDelegate.h */, 157 | 86C6443B17C4FEF200570DFB /* AppDelegate.m */, 158 | 86C6444317C4FEF200570DFB /* MainStoryboard_iPhone.storyboard */, 159 | 86C6444617C4FEF200570DFB /* MainStoryboard_iPad.storyboard */, 160 | 86C6444917C4FEF200570DFB /* ViewController.h */, 161 | 86C6444A17C4FEF200570DFB /* ViewController.m */, 162 | 86C6443217C4FEF200570DFB /* Supporting Files */, 163 | ); 164 | path = AFNetworkingMeterApp; 165 | sourceTree = ""; 166 | }; 167 | 86C6443217C4FEF200570DFB /* Supporting Files */ = { 168 | isa = PBXGroup; 169 | children = ( 170 | 86C6443317C4FEF200570DFB /* AFNetworkingMeterApp-Info.plist */, 171 | 86C6443417C4FEF200570DFB /* InfoPlist.strings */, 172 | 86C6443717C4FEF200570DFB /* main.m */, 173 | 86C6443917C4FEF200570DFB /* AFNetworkingMeterApp-Prefix.pch */, 174 | 86C6443D17C4FEF200570DFB /* Default.png */, 175 | 86C6443F17C4FEF200570DFB /* Default@2x.png */, 176 | 86C6444117C4FEF200570DFB /* Default-568h@2x.png */, 177 | ); 178 | name = "Supporting Files"; 179 | sourceTree = ""; 180 | }; 181 | 86C6445817C4FEF300570DFB /* AFNetworkingMeterAppTests */ = { 182 | isa = PBXGroup; 183 | children = ( 184 | 86C6445F17C4FEF300570DFB /* AFNetworkingMeterAppTests.m */, 185 | 86C6445917C4FEF300570DFB /* Supporting Files */, 186 | 86C6446D17C507EE00570DFB /* TestHelpers.h */, 187 | ); 188 | path = AFNetworkingMeterAppTests; 189 | sourceTree = ""; 190 | }; 191 | 86C6445917C4FEF300570DFB /* Supporting Files */ = { 192 | isa = PBXGroup; 193 | children = ( 194 | 861F363217CC47710028D579 /* apple.jpg */, 195 | 86C6445A17C4FEF300570DFB /* AFNetworkingMeterAppTests-Info.plist */, 196 | 86C6445B17C4FEF300570DFB /* InfoPlist.strings */, 197 | ); 198 | name = "Supporting Files"; 199 | sourceTree = ""; 200 | }; 201 | 86C6446917C4FEFD00570DFB /* AFNetworkingMeter */ = { 202 | isa = PBXGroup; 203 | children = ( 204 | 86C6446A17C4FEFD00570DFB /* AFNetworkingMeter.h */, 205 | 86C6446B17C4FEFD00570DFB /* AFNetworkingMeter.m */, 206 | 86C6447117C524D100570DFB /* AFNetworkingMeterData.h */, 207 | 86C6447217C524D100570DFB /* AFNetworkingMeterData.m */, 208 | 86C6447617C550CB00570DFB /* AFHTTPRequestOperation+AFNM.h */, 209 | 86C6447717C550CB00570DFB /* AFHTTPRequestOperation+AFNM.m */, 210 | 868AE28517DE4B1500B499BC /* AFNetworkingMeterReportGenerator.h */, 211 | 868AE28617DE4B1500B499BC /* AFNetworkingMeterReportGenerator.m */, 212 | 868AE28817DE4D1A00B499BC /* AFNetworkingMeterConstants.h */, 213 | ); 214 | name = AFNetworkingMeter; 215 | path = ../AFNetworkingMeter; 216 | sourceTree = ""; 217 | }; 218 | /* End PBXGroup section */ 219 | 220 | /* Begin PBXNativeTarget section */ 221 | 86C6442717C4FEF200570DFB /* AFNetworkingMeterApp */ = { 222 | isa = PBXNativeTarget; 223 | buildConfigurationList = 86C6446317C4FEF300570DFB /* Build configuration list for PBXNativeTarget "AFNetworkingMeterApp" */; 224 | buildPhases = ( 225 | 0E6813DFBA6A410EA9A4FAF0 /* Check Pods Manifest.lock */, 226 | 86C6442417C4FEF200570DFB /* Sources */, 227 | 86C6442517C4FEF200570DFB /* Frameworks */, 228 | 86C6442617C4FEF200570DFB /* Resources */, 229 | 4E4315783E774988AF852010 /* Copy Pods Resources */, 230 | ); 231 | buildRules = ( 232 | ); 233 | dependencies = ( 234 | ); 235 | name = AFNetworkingMeterApp; 236 | productName = AFNetworkingMeterApp; 237 | productReference = 86C6442817C4FEF200570DFB /* AFNetworkingMeterApp.app */; 238 | productType = "com.apple.product-type.application"; 239 | }; 240 | 86C6445017C4FEF300570DFB /* AFNetworkingMeterAppTests */ = { 241 | isa = PBXNativeTarget; 242 | buildConfigurationList = 86C6446617C4FEF300570DFB /* Build configuration list for PBXNativeTarget "AFNetworkingMeterAppTests" */; 243 | buildPhases = ( 244 | B35A2F418BB04EA3BEFF88B6 /* Check Pods Manifest.lock */, 245 | 86C6444C17C4FEF300570DFB /* Sources */, 246 | 86C6444D17C4FEF300570DFB /* Frameworks */, 247 | 86C6444E17C4FEF300570DFB /* Resources */, 248 | 86C6444F17C4FEF300570DFB /* ShellScript */, 249 | 24847BF546D4432A9E9F4DBF /* Copy Pods Resources */, 250 | ); 251 | buildRules = ( 252 | ); 253 | dependencies = ( 254 | 86C6445717C4FEF300570DFB /* PBXTargetDependency */, 255 | ); 256 | name = AFNetworkingMeterAppTests; 257 | productName = AFNetworkingMeterAppTests; 258 | productReference = 86C6445117C4FEF300570DFB /* AFNetworkingMeterAppTests.octest */; 259 | productType = "com.apple.product-type.bundle"; 260 | }; 261 | /* End PBXNativeTarget section */ 262 | 263 | /* Begin PBXProject section */ 264 | 86C6442017C4FEF200570DFB /* Project object */ = { 265 | isa = PBXProject; 266 | attributes = { 267 | LastUpgradeCheck = 0460; 268 | ORGANIZATIONNAME = "Stanislaw Pankevich"; 269 | }; 270 | buildConfigurationList = 86C6442317C4FEF200570DFB /* Build configuration list for PBXProject "AFNetworkingMeterApp" */; 271 | compatibilityVersion = "Xcode 3.2"; 272 | developmentRegion = English; 273 | hasScannedForEncodings = 0; 274 | knownRegions = ( 275 | en, 276 | ); 277 | mainGroup = 86C6441F17C4FEF200570DFB; 278 | productRefGroup = 86C6442917C4FEF200570DFB /* Products */; 279 | projectDirPath = ""; 280 | projectRoot = ""; 281 | targets = ( 282 | 86C6442717C4FEF200570DFB /* AFNetworkingMeterApp */, 283 | 86C6445017C4FEF300570DFB /* AFNetworkingMeterAppTests */, 284 | ); 285 | }; 286 | /* End PBXProject section */ 287 | 288 | /* Begin PBXResourcesBuildPhase section */ 289 | 86C6442617C4FEF200570DFB /* Resources */ = { 290 | isa = PBXResourcesBuildPhase; 291 | buildActionMask = 2147483647; 292 | files = ( 293 | 86C6443617C4FEF200570DFB /* InfoPlist.strings in Resources */, 294 | 86C6443E17C4FEF200570DFB /* Default.png in Resources */, 295 | 86C6444017C4FEF200570DFB /* Default@2x.png in Resources */, 296 | 86C6444217C4FEF200570DFB /* Default-568h@2x.png in Resources */, 297 | 86C6444517C4FEF200570DFB /* MainStoryboard_iPhone.storyboard in Resources */, 298 | 86C6444817C4FEF200570DFB /* MainStoryboard_iPad.storyboard in Resources */, 299 | ); 300 | runOnlyForDeploymentPostprocessing = 0; 301 | }; 302 | 86C6444E17C4FEF300570DFB /* Resources */ = { 303 | isa = PBXResourcesBuildPhase; 304 | buildActionMask = 2147483647; 305 | files = ( 306 | 86C6445D17C4FEF300570DFB /* InfoPlist.strings in Resources */, 307 | 861F363317CC47710028D579 /* apple.jpg in Resources */, 308 | ); 309 | runOnlyForDeploymentPostprocessing = 0; 310 | }; 311 | /* End PBXResourcesBuildPhase section */ 312 | 313 | /* Begin PBXShellScriptBuildPhase section */ 314 | 0E6813DFBA6A410EA9A4FAF0 /* Check Pods Manifest.lock */ = { 315 | isa = PBXShellScriptBuildPhase; 316 | buildActionMask = 2147483647; 317 | files = ( 318 | ); 319 | inputPaths = ( 320 | ); 321 | name = "Check Pods Manifest.lock"; 322 | outputPaths = ( 323 | ); 324 | runOnlyForDeploymentPostprocessing = 0; 325 | shellPath = /bin/sh; 326 | shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; 327 | showEnvVarsInLog = 0; 328 | }; 329 | 24847BF546D4432A9E9F4DBF /* Copy Pods Resources */ = { 330 | isa = PBXShellScriptBuildPhase; 331 | buildActionMask = 2147483647; 332 | files = ( 333 | ); 334 | inputPaths = ( 335 | ); 336 | name = "Copy Pods Resources"; 337 | outputPaths = ( 338 | ); 339 | runOnlyForDeploymentPostprocessing = 0; 340 | shellPath = /bin/sh; 341 | shellScript = "\"${SRCROOT}/Pods/Pods-AFNetworkingMeterAppTests-resources.sh\"\n"; 342 | showEnvVarsInLog = 0; 343 | }; 344 | 4E4315783E774988AF852010 /* Copy Pods Resources */ = { 345 | isa = PBXShellScriptBuildPhase; 346 | buildActionMask = 2147483647; 347 | files = ( 348 | ); 349 | inputPaths = ( 350 | ); 351 | name = "Copy Pods Resources"; 352 | outputPaths = ( 353 | ); 354 | runOnlyForDeploymentPostprocessing = 0; 355 | shellPath = /bin/sh; 356 | shellScript = "\"${SRCROOT}/Pods/Pods-resources.sh\"\n"; 357 | showEnvVarsInLog = 0; 358 | }; 359 | 86C6444F17C4FEF300570DFB /* ShellScript */ = { 360 | isa = PBXShellScriptBuildPhase; 361 | buildActionMask = 2147483647; 362 | files = ( 363 | ); 364 | inputPaths = ( 365 | ); 366 | outputPaths = ( 367 | ); 368 | runOnlyForDeploymentPostprocessing = 0; 369 | shellPath = /bin/sh; 370 | shellScript = "# Run the unit tests in this test bundle.\n\"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests\"\n"; 371 | }; 372 | B35A2F418BB04EA3BEFF88B6 /* Check Pods Manifest.lock */ = { 373 | isa = PBXShellScriptBuildPhase; 374 | buildActionMask = 2147483647; 375 | files = ( 376 | ); 377 | inputPaths = ( 378 | ); 379 | name = "Check Pods Manifest.lock"; 380 | outputPaths = ( 381 | ); 382 | runOnlyForDeploymentPostprocessing = 0; 383 | shellPath = /bin/sh; 384 | shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; 385 | showEnvVarsInLog = 0; 386 | }; 387 | /* End PBXShellScriptBuildPhase section */ 388 | 389 | /* Begin PBXSourcesBuildPhase section */ 390 | 86C6442417C4FEF200570DFB /* Sources */ = { 391 | isa = PBXSourcesBuildPhase; 392 | buildActionMask = 2147483647; 393 | files = ( 394 | 86C6443817C4FEF200570DFB /* main.m in Sources */, 395 | 86C6443C17C4FEF200570DFB /* AppDelegate.m in Sources */, 396 | 868AE28717DE4B1500B499BC /* AFNetworkingMeterReportGenerator.m in Sources */, 397 | 86C6444B17C4FEF200570DFB /* ViewController.m in Sources */, 398 | 86C6446C17C4FEFD00570DFB /* AFNetworkingMeter.m in Sources */, 399 | 86C6447317C524D100570DFB /* AFNetworkingMeterData.m in Sources */, 400 | 86C6447817C550CC00570DFB /* AFHTTPRequestOperation+AFNM.m in Sources */, 401 | ); 402 | runOnlyForDeploymentPostprocessing = 0; 403 | }; 404 | 86C6444C17C4FEF300570DFB /* Sources */ = { 405 | isa = PBXSourcesBuildPhase; 406 | buildActionMask = 2147483647; 407 | files = ( 408 | 86C6446017C4FEF300570DFB /* AFNetworkingMeterAppTests.m in Sources */, 409 | 86C6447017C518B600570DFB /* AFNetworkingMeter.m in Sources */, 410 | 86C6447417C5298A00570DFB /* AFNetworkingMeterData.m in Sources */, 411 | 868AE28B17DE4E6A00B499BC /* AFNetworkingMeterReportGenerator.m in Sources */, 412 | 86C6447917C5521900570DFB /* AFHTTPRequestOperation+AFNM.m in Sources */, 413 | ); 414 | runOnlyForDeploymentPostprocessing = 0; 415 | }; 416 | /* End PBXSourcesBuildPhase section */ 417 | 418 | /* Begin PBXTargetDependency section */ 419 | 86C6445717C4FEF300570DFB /* PBXTargetDependency */ = { 420 | isa = PBXTargetDependency; 421 | target = 86C6442717C4FEF200570DFB /* AFNetworkingMeterApp */; 422 | targetProxy = 86C6445617C4FEF300570DFB /* PBXContainerItemProxy */; 423 | }; 424 | /* End PBXTargetDependency section */ 425 | 426 | /* Begin PBXVariantGroup section */ 427 | 86C6443417C4FEF200570DFB /* InfoPlist.strings */ = { 428 | isa = PBXVariantGroup; 429 | children = ( 430 | 86C6443517C4FEF200570DFB /* en */, 431 | ); 432 | name = InfoPlist.strings; 433 | sourceTree = ""; 434 | }; 435 | 86C6444317C4FEF200570DFB /* MainStoryboard_iPhone.storyboard */ = { 436 | isa = PBXVariantGroup; 437 | children = ( 438 | 86C6444417C4FEF200570DFB /* en */, 439 | ); 440 | name = MainStoryboard_iPhone.storyboard; 441 | sourceTree = ""; 442 | }; 443 | 86C6444617C4FEF200570DFB /* MainStoryboard_iPad.storyboard */ = { 444 | isa = PBXVariantGroup; 445 | children = ( 446 | 86C6444717C4FEF200570DFB /* en */, 447 | ); 448 | name = MainStoryboard_iPad.storyboard; 449 | sourceTree = ""; 450 | }; 451 | 86C6445B17C4FEF300570DFB /* InfoPlist.strings */ = { 452 | isa = PBXVariantGroup; 453 | children = ( 454 | 86C6445C17C4FEF300570DFB /* en */, 455 | ); 456 | name = InfoPlist.strings; 457 | sourceTree = ""; 458 | }; 459 | /* End PBXVariantGroup section */ 460 | 461 | /* Begin XCBuildConfiguration section */ 462 | 86C6446117C4FEF300570DFB /* Debug */ = { 463 | isa = XCBuildConfiguration; 464 | buildSettings = { 465 | ALWAYS_SEARCH_USER_PATHS = NO; 466 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 467 | CLANG_CXX_LIBRARY = "libc++"; 468 | CLANG_ENABLE_OBJC_ARC = YES; 469 | CLANG_WARN_CONSTANT_CONVERSION = YES; 470 | CLANG_WARN_EMPTY_BODY = YES; 471 | CLANG_WARN_ENUM_CONVERSION = YES; 472 | CLANG_WARN_INT_CONVERSION = YES; 473 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 474 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 475 | COPY_PHASE_STRIP = NO; 476 | GCC_C_LANGUAGE_STANDARD = gnu99; 477 | GCC_DYNAMIC_NO_PIC = NO; 478 | GCC_OPTIMIZATION_LEVEL = 0; 479 | GCC_PREPROCESSOR_DEFINITIONS = ( 480 | "DEBUG=1", 481 | "$(inherited)", 482 | ); 483 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 484 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 485 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 486 | GCC_WARN_UNUSED_VARIABLE = YES; 487 | IPHONEOS_DEPLOYMENT_TARGET = 6.1; 488 | ONLY_ACTIVE_ARCH = YES; 489 | SDKROOT = iphoneos; 490 | TARGETED_DEVICE_FAMILY = "1,2"; 491 | }; 492 | name = Debug; 493 | }; 494 | 86C6446217C4FEF300570DFB /* Release */ = { 495 | isa = XCBuildConfiguration; 496 | buildSettings = { 497 | ALWAYS_SEARCH_USER_PATHS = NO; 498 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 499 | CLANG_CXX_LIBRARY = "libc++"; 500 | CLANG_ENABLE_OBJC_ARC = YES; 501 | CLANG_WARN_CONSTANT_CONVERSION = YES; 502 | CLANG_WARN_EMPTY_BODY = YES; 503 | CLANG_WARN_ENUM_CONVERSION = YES; 504 | CLANG_WARN_INT_CONVERSION = YES; 505 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 506 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 507 | COPY_PHASE_STRIP = YES; 508 | GCC_C_LANGUAGE_STANDARD = gnu99; 509 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 510 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 511 | GCC_WARN_UNUSED_VARIABLE = YES; 512 | IPHONEOS_DEPLOYMENT_TARGET = 6.1; 513 | OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; 514 | SDKROOT = iphoneos; 515 | TARGETED_DEVICE_FAMILY = "1,2"; 516 | VALIDATE_PRODUCT = YES; 517 | }; 518 | name = Release; 519 | }; 520 | 86C6446417C4FEF300570DFB /* Debug */ = { 521 | isa = XCBuildConfiguration; 522 | baseConfigurationReference = 4EF07AB9A03A42B2BB3BE7CF /* Pods.xcconfig */; 523 | buildSettings = { 524 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 525 | GCC_PREFIX_HEADER = "AFNetworkingMeterApp/AFNetworkingMeterApp-Prefix.pch"; 526 | INFOPLIST_FILE = "AFNetworkingMeterApp/AFNetworkingMeterApp-Info.plist"; 527 | PRODUCT_NAME = "$(TARGET_NAME)"; 528 | WRAPPER_EXTENSION = app; 529 | }; 530 | name = Debug; 531 | }; 532 | 86C6446517C4FEF300570DFB /* Release */ = { 533 | isa = XCBuildConfiguration; 534 | baseConfigurationReference = 4EF07AB9A03A42B2BB3BE7CF /* Pods.xcconfig */; 535 | buildSettings = { 536 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 537 | GCC_PREFIX_HEADER = "AFNetworkingMeterApp/AFNetworkingMeterApp-Prefix.pch"; 538 | INFOPLIST_FILE = "AFNetworkingMeterApp/AFNetworkingMeterApp-Info.plist"; 539 | PRODUCT_NAME = "$(TARGET_NAME)"; 540 | WRAPPER_EXTENSION = app; 541 | }; 542 | name = Release; 543 | }; 544 | 86C6446717C4FEF300570DFB /* Debug */ = { 545 | isa = XCBuildConfiguration; 546 | baseConfigurationReference = 484BC3D3A6E343E0A896479E /* Pods-AFNetworkingMeterAppTests.xcconfig */; 547 | buildSettings = { 548 | BUNDLE_LOADER = ""; 549 | FRAMEWORK_SEARCH_PATHS = ( 550 | "\"$(SDKROOT)/Developer/Library/Frameworks\"", 551 | "\"$(DEVELOPER_LIBRARY_DIR)/Frameworks\"", 552 | ); 553 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 554 | GCC_PREFIX_HEADER = "AFNetworkingMeterApp/AFNetworkingMeterApp-Prefix.pch"; 555 | INFOPLIST_FILE = "AFNetworkingMeterAppTests/AFNetworkingMeterAppTests-Info.plist"; 556 | PRODUCT_NAME = "$(TARGET_NAME)"; 557 | TEST_HOST = ""; 558 | WRAPPER_EXTENSION = octest; 559 | }; 560 | name = Debug; 561 | }; 562 | 86C6446817C4FEF300570DFB /* Release */ = { 563 | isa = XCBuildConfiguration; 564 | baseConfigurationReference = 484BC3D3A6E343E0A896479E /* Pods-AFNetworkingMeterAppTests.xcconfig */; 565 | buildSettings = { 566 | BUNDLE_LOADER = ""; 567 | FRAMEWORK_SEARCH_PATHS = ( 568 | "\"$(SDKROOT)/Developer/Library/Frameworks\"", 569 | "\"$(DEVELOPER_LIBRARY_DIR)/Frameworks\"", 570 | ); 571 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 572 | GCC_PREFIX_HEADER = "AFNetworkingMeterApp/AFNetworkingMeterApp-Prefix.pch"; 573 | INFOPLIST_FILE = "AFNetworkingMeterAppTests/AFNetworkingMeterAppTests-Info.plist"; 574 | PRODUCT_NAME = "$(TARGET_NAME)"; 575 | TEST_HOST = ""; 576 | WRAPPER_EXTENSION = octest; 577 | }; 578 | name = Release; 579 | }; 580 | /* End XCBuildConfiguration section */ 581 | 582 | /* Begin XCConfigurationList section */ 583 | 86C6442317C4FEF200570DFB /* Build configuration list for PBXProject "AFNetworkingMeterApp" */ = { 584 | isa = XCConfigurationList; 585 | buildConfigurations = ( 586 | 86C6446117C4FEF300570DFB /* Debug */, 587 | 86C6446217C4FEF300570DFB /* Release */, 588 | ); 589 | defaultConfigurationIsVisible = 0; 590 | defaultConfigurationName = Release; 591 | }; 592 | 86C6446317C4FEF300570DFB /* Build configuration list for PBXNativeTarget "AFNetworkingMeterApp" */ = { 593 | isa = XCConfigurationList; 594 | buildConfigurations = ( 595 | 86C6446417C4FEF300570DFB /* Debug */, 596 | 86C6446517C4FEF300570DFB /* Release */, 597 | ); 598 | defaultConfigurationIsVisible = 0; 599 | defaultConfigurationName = Release; 600 | }; 601 | 86C6446617C4FEF300570DFB /* Build configuration list for PBXNativeTarget "AFNetworkingMeterAppTests" */ = { 602 | isa = XCConfigurationList; 603 | buildConfigurations = ( 604 | 86C6446717C4FEF300570DFB /* Debug */, 605 | 86C6446817C4FEF300570DFB /* Release */, 606 | ); 607 | defaultConfigurationIsVisible = 0; 608 | defaultConfigurationName = Release; 609 | }; 610 | /* End XCConfigurationList section */ 611 | }; 612 | rootObject = 86C6442017C4FEF200570DFB /* Project object */; 613 | } 614 | -------------------------------------------------------------------------------- /AFNetworkingMeterApp/AFNetworkingMeterApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /AFNetworkingMeterApp/AFNetworkingMeterApp.xcodeproj/project.xcworkspace/xcuserdata/Stanislaw.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stanislaw/AFNetworkingMeter/145ccca7f6e9483bf08a47868b86f4ab928295d5/AFNetworkingMeterApp/AFNetworkingMeterApp.xcodeproj/project.xcworkspace/xcuserdata/Stanislaw.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /AFNetworkingMeterApp/AFNetworkingMeterApp.xcodeproj/xcuserdata/Stanislaw.xcuserdatad/xcschemes/AFNetworkingMeterApp.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 61 | 62 | 68 | 69 | 70 | 71 | 72 | 73 | 79 | 80 | 86 | 87 | 88 | 89 | 91 | 92 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /AFNetworkingMeterApp/AFNetworkingMeterApp.xcodeproj/xcuserdata/Stanislaw.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | AFNetworkingMeterApp.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 86C6442717C4FEF200570DFB 16 | 17 | primary 18 | 19 | 20 | 86C6445017C4FEF300570DFB 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /AFNetworkingMeterApp/AFNetworkingMeterApp/AFNetworkingMeterApp-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | com.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIMainStoryboardFile 28 | MainStoryboard_iPhone 29 | UIMainStoryboardFile~ipad 30 | MainStoryboard_iPad 31 | UIRequiredDeviceCapabilities 32 | 33 | armv7 34 | 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationLandscapeLeft 39 | UIInterfaceOrientationLandscapeRight 40 | 41 | UISupportedInterfaceOrientations~ipad 42 | 43 | UIInterfaceOrientationPortrait 44 | UIInterfaceOrientationPortraitUpsideDown 45 | UIInterfaceOrientationLandscapeLeft 46 | UIInterfaceOrientationLandscapeRight 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /AFNetworkingMeterApp/AFNetworkingMeterApp/AFNetworkingMeterApp-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'AFNetworkingMeterApp' target in the 'AFNetworkingMeterApp' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_5_0 8 | #warning "This project uses features only available in iOS SDK 5.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /AFNetworkingMeterApp/AFNetworkingMeterApp/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // AFNetworkingMeterApp 4 | // 5 | // Created by Stanislaw Pankevich on 8/21/13. 6 | // Copyright (c) 2013 Stanislaw Pankevich. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /AFNetworkingMeterApp/AFNetworkingMeterApp/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // AFNetworkingMeterApp 4 | // 5 | // Created by Stanislaw Pankevich on 8/21/13. 6 | // Copyright (c) 2013 Stanislaw Pankevich. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @implementation AppDelegate 12 | 13 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 14 | { 15 | // Override point for customization after application launch. 16 | return YES; 17 | } 18 | 19 | - (void)applicationWillResignActive:(UIApplication *)application 20 | { 21 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 22 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 23 | } 24 | 25 | - (void)applicationDidEnterBackground:(UIApplication *)application 26 | { 27 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 28 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 29 | } 30 | 31 | - (void)applicationWillEnterForeground:(UIApplication *)application 32 | { 33 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | - (void)applicationDidBecomeActive:(UIApplication *)application 37 | { 38 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application 42 | { 43 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /AFNetworkingMeterApp/AFNetworkingMeterApp/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stanislaw/AFNetworkingMeter/145ccca7f6e9483bf08a47868b86f4ab928295d5/AFNetworkingMeterApp/AFNetworkingMeterApp/Default-568h@2x.png -------------------------------------------------------------------------------- /AFNetworkingMeterApp/AFNetworkingMeterApp/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stanislaw/AFNetworkingMeter/145ccca7f6e9483bf08a47868b86f4ab928295d5/AFNetworkingMeterApp/AFNetworkingMeterApp/Default.png -------------------------------------------------------------------------------- /AFNetworkingMeterApp/AFNetworkingMeterApp/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stanislaw/AFNetworkingMeter/145ccca7f6e9483bf08a47868b86f4ab928295d5/AFNetworkingMeterApp/AFNetworkingMeterApp/Default@2x.png -------------------------------------------------------------------------------- /AFNetworkingMeterApp/AFNetworkingMeterApp/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // AFNetworkingMeterApp 4 | // 5 | // Created by Stanislaw Pankevich on 8/21/13. 6 | // Copyright (c) 2013 Stanislaw Pankevich. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /AFNetworkingMeterApp/AFNetworkingMeterApp/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // AFNetworkingMeterApp 4 | // 5 | // Created by Stanislaw Pankevich on 8/21/13. 6 | // Copyright (c) 2013 Stanislaw Pankevich. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | 11 | @interface ViewController () 12 | 13 | @end 14 | 15 | @implementation ViewController 16 | 17 | - (void)viewDidLoad 18 | { 19 | [super viewDidLoad]; 20 | // Do any additional setup after loading the view, typically from a nib. 21 | } 22 | 23 | - (void)didReceiveMemoryWarning 24 | { 25 | [super didReceiveMemoryWarning]; 26 | // Dispose of any resources that can be recreated. 27 | } 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /AFNetworkingMeterApp/AFNetworkingMeterApp/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /AFNetworkingMeterApp/AFNetworkingMeterApp/en.lproj/MainStoryboard_iPad.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /AFNetworkingMeterApp/AFNetworkingMeterApp/en.lproj/MainStoryboard_iPhone.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /AFNetworkingMeterApp/AFNetworkingMeterApp/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // AFNetworkingMeterApp 4 | // 5 | // Created by Stanislaw Pankevich on 8/21/13. 6 | // Copyright (c) 2013 Stanislaw Pankevich. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "AppDelegate.h" 12 | 13 | int main(int argc, char *argv[]) { 14 | @autoreleasepool { 15 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /AFNetworkingMeterApp/AFNetworkingMeterAppTests/AFNetworkingMeterAppTests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /AFNetworkingMeterApp/AFNetworkingMeterAppTests/AFNetworkingMeterAppTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // AFNetworkingMeterAppTests.m 3 | // AFNetworkingMeterAppTests 4 | // 5 | // Created by Stanislaw Pankevich on 8/21/13. 6 | // Copyright (c) 2013 Stanislaw Pankevich. All rights reserved. 7 | // 8 | 9 | #import "TestHelpers.h" 10 | 11 | #import "AFNetworkingMeter.h" 12 | 13 | #import 14 | 15 | SPEC_BEGIN(AFNetworkingMeterAppSpec) 16 | 17 | describe(@"...", ^{ 18 | beforeAll(^{ 19 | [[AFNetworkingMeter sharedMeter] startMeter]; 20 | }); 21 | 22 | afterAll(^{ 23 | NSLog(@"AFNetworkingMeter.data: %@", [AFNetworkingMeter sharedMeter].formattedReport); 24 | }); 25 | 26 | afterEach(^{ 27 | [OHHTTPStubs removeAllStubs]; 28 | }); 29 | 30 | it (@"200 OK", ^{ 31 | NSDictionary *dictionary = @{ @"KEY": @"VALUE" }; 32 | NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dictionary options:0 error:nil]; 33 | 34 | [OHHTTPStubs stubRequestsPassingTest:^BOOL(NSURLRequest *request) { 35 | return YES; 36 | } withStubResponse:^OHHTTPStubsResponse*(NSURLRequest *request) { 37 | return [OHHTTPStubsResponse responseWithData:jsonData statusCode:200 headers:nil]; 38 | }]; 39 | 40 | NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"www.foo.bar"]]; 41 | urlRequest.HTTPBody = [jsonData copy]; 42 | 43 | AFHTTPRequestOperation *requestOperation = [[AFHTTPRequestOperation alloc] initWithRequest:urlRequest]; 44 | [requestOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) { 45 | 46 | id object = [NSJSONSerialization JSONObjectWithData:operation.responseData options:0 error:nil]; 47 | NSLog(@"Received data: %@", object); 48 | 49 | } failure:^(AFHTTPRequestOperation *operation, NSError *error) { 50 | abort(); 51 | }]; 52 | 53 | [requestOperation start]; 54 | 55 | runLoopIfNeeded(); 56 | }); 57 | 58 | it (@"404 Not Found", ^{ 59 | [OHHTTPStubs stubRequestsPassingTest:^BOOL(NSURLRequest *request) { 60 | return YES; 61 | } withStubResponse:^OHHTTPStubsResponse*(NSURLRequest *request) { 62 | return [OHHTTPStubsResponse responseWithData:nil statusCode:404 headers:nil]; 63 | }]; 64 | 65 | NSURLRequest *urlRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:@"www.foo.bar"]]; 66 | AFHTTPRequestOperation *requestOperation = [[AFHTTPRequestOperation alloc] initWithRequest:urlRequest]; 67 | 68 | [requestOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) { 69 | } failure:^(AFHTTPRequestOperation *operation, NSError *error) { 70 | }]; 71 | 72 | [requestOperation start]; 73 | 74 | runLoopIfNeeded(); 75 | }); 76 | 77 | it (@"NSURLErrorNotConnectedToInternet 1009", ^{ 78 | [OHHTTPStubs stubRequestsPassingTest:^BOOL(NSURLRequest *request) { 79 | return YES; 80 | } withStubResponse:^OHHTTPStubsResponse*(NSURLRequest *request) { 81 | NSError *error = [NSError errorWithDomain:NSURLErrorDomain code:NSURLErrorNotConnectedToInternet userInfo:nil]; 82 | return [OHHTTPStubsResponse responseWithError:error]; 83 | }]; 84 | 85 | NSURLRequest *urlRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:@"www.foo.bar"]]; 86 | AFHTTPRequestOperation *requestOperation = [[AFHTTPRequestOperation alloc] initWithRequest:urlRequest]; 87 | 88 | [requestOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) { 89 | } failure:^(AFHTTPRequestOperation *operation, NSError *error) { 90 | }]; 91 | 92 | [requestOperation start]; 93 | 94 | runLoopIfNeeded(); 95 | }); 96 | 97 | /* 98 | it (@"AFImageRequestOperation", ^{ 99 | [OHHTTPStubs stubRequestsPassingTest:^BOOL(NSURLRequest *request) { 100 | return YES; 101 | } withStubResponse:^OHHTTPStubsResponse*(NSURLRequest *request) { 102 | NSString *imagePath = [[NSBundle bundleForClass:[self class]] pathForResource:@"apple" ofType:@"jpg"]; 103 | 104 | assert(imagePath != nil); 105 | 106 | return [OHHTTPStubsResponse responseWithFileAtPath:imagePath statusCode:200 headers:nil]; 107 | }]; 108 | 109 | NSURLRequest *urlRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:@"www.foo.bar/apple.jpg"]]; 110 | AFImageRequestOperation *requestOperation = [AFImageRequestOperation imageRequestOperationWithRequest:urlRequest imageProcessingBlock:nil success:^(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image) { 111 | 112 | } failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error) { 113 | NSAssert(nil, nil); 114 | }]; 115 | 116 | [requestOperation start]; 117 | 118 | runLoopIfNeeded(); 119 | }); 120 | */ 121 | 122 | }); 123 | 124 | SPEC_END 125 | -------------------------------------------------------------------------------- /AFNetworkingMeterApp/AFNetworkingMeterAppTests/TestHelpers.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import 4 | 5 | static inline void runLoopIfNeeded() { 6 | // https://developer.apple.com/library/mac/#documentation/CoreFOundation/Reference/CFRunLoopRef/Reference/reference.html 7 | 8 | while (CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.1, YES) == kCFRunLoopRunHandledSource); 9 | } 10 | -------------------------------------------------------------------------------- /AFNetworkingMeterApp/AFNetworkingMeterAppTests/apple.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stanislaw/AFNetworkingMeter/145ccca7f6e9483bf08a47868b86f4ab928295d5/AFNetworkingMeterApp/AFNetworkingMeterAppTests/apple.jpg -------------------------------------------------------------------------------- /AFNetworkingMeterApp/AFNetworkingMeterAppTests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /AFNetworkingMeterApp/Podfile: -------------------------------------------------------------------------------- 1 | platform :ios, '6.0' 2 | 3 | pod 'AFNetworking', '~> 2' 4 | 5 | target :AFNetworkingMeterAppTests do 6 | pod 'Kiwi' 7 | pod 'OHHTTPStubs' 8 | end 9 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 Stanislaw Pankevich 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AFNetworkingMeter 2 | 3 | ![AFNetworkingMeter demonstration](https://raw.github.com/stanislaw/AFNetworkingMeter/master/AFNetworkingMeter.png) 4 | 5 | ## Overview 6 | 7 | AFNetworkingMeter is a grateful child of AFHTTPRequestOperationLogger created by Mattt Thompson (@mattt) for AFNetworking library. It is not the one: there is also its closest brother and companion [AFNetworkingLogger](https://github.com/stanislaw/AFNetworkingLogger) - they share similar design and are both built for the same purpose: to make a HTTP-logging routine for a daily basis of iOS/Mac development easy and informative. 8 | 9 | __Note.__ AFNetworkingMeter currently does not support statistics reporting for NSURLSession-based operations. 10 | 11 | ## Installation 12 | 13 | The recommended way is to install via Cocoapods: 14 | 15 | Add into your Podfile: 16 | 17 | ```ruby 18 | pod 'AFNetworkingMeter', :git => 'https://github.com/stanislaw/AFNetworkingMeter' 19 | ``` 20 | 21 | And run 22 | 23 | ``` 24 | pod update 25 | ``` 26 | 27 | or you can just clone `AFNetworkingMeter` repository using `git clone` and copy the contents of its `AFNetworkingMeter/` folder to your project. 28 | 29 | ## Usage 30 | 31 | You need to start `AFNetworkingMeter` somewhere. For example, your app's delegate is a good place to do this: 32 | 33 | ```objective-c 34 | #import 35 | 36 | - (BOOL)application:(UIApplication *)application 37 | didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 38 | { 39 | [[AFNetworkingMeter sharedMeter] startMeter]; 40 | 41 | return YES; 42 | } 43 | ``` 44 | 45 | Then, whereever you need to know statistics for AFNetworking HTTP interactions, ask `AFNetworkingMeter` to produce a formatted report and feel free to print it into your Xcode console. 46 | 47 | ```objective-c 48 | NSString *HTTPReport = [AFNetworkingMeter sharedMeter].formattedReport; 49 | NSLog(@"Let's see the HTTP Report: %@", HTTPReport); 50 | ``` 51 | 52 | ## Lazy reporting 53 | 54 | ... 55 | 56 | ## Server errors and connection errors 57 | 58 | Clarify their meaning as soon as possible as they can interfere... 59 | 60 | ## TODO 61 | 62 | ... 63 | 64 | ## Notes 65 | 66 | * Currently `AFNetworkingMeter` calculates HTTP headers size using `-[NSPropertyListSerialization dataFromPropertyList:...` (-[NSURLRequest allHTTPHeaderFields] => NSData). Let me know if there is a more precise way of doing this. 67 | * This line is designated for excuses about Russian/Ukrainian english that probably resulted in some misspelings exist somewhere in this README. The author will be thankful for any spelling corrections that might appear. 68 | 69 | ## Credits 70 | 71 | AFNetworkingMeter was created by Stanislaw Pankevich. 72 | 73 | Thanks to Marina Balioura (@mettta) for her assistance in working out the design of 74 | the formatted report `AFNetworkingMeter` produces. Invaluable! 75 | 76 | `AFNetworkingMeter` is a plugin for [AFNetworking](https://github.com/AFNetworking/AFNetworking) library created by [Mattt Thompson](http://github.com/mattt). 77 | 78 | AFNetworkingMeter is inspired by the design of another `AFNetworking` plugin [AFHTTPRequestOperationLogger](https://github.com/AFNetworking/AFHTTPRequestOperationLogger), that was as well created by [Mattt Thompson](http://github.com/mattt). 79 | 80 | ## Copyright 81 | 82 | Copyright (c) 2013, Stanislaw Pankevich. See LICENSE for details. 83 | 84 | 85 | [![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/stanislaw/afnetworkingmeter/trend.png)](https://bitdeli.com/free "Bitdeli Badge") 86 | 87 | --------------------------------------------------------------------------------