diff --git a/MKNetworkKit/Categories/NSDictionary+RequestEncoding.m b/MKNetworkKit/Categories/NSDictionary+RequestEncoding.m index 1cf2a73..bf1e50f 100644 --- a/MKNetworkKit/Categories/NSDictionary+RequestEncoding.m +++ b/MKNetworkKit/Categories/NSDictionary+RequestEncoding.m @@ -42,38 +42,33 @@ -(NSString*) urlEncodedKeyValueString { if([string length] > 0) [string deleteCharactersInRange:NSMakeRange([string length] - 1, 1)]; - return string; + return string; } -(NSString*) jsonEncodedKeyValueString { - if(NSClassFromString(@"NSJSONSerialization")) { - NSError *error = nil; - NSData *data = [NSClassFromString(@"NSJSONSerialization") dataWithJSONObject:self - options:0 // non-pretty printing - error:&error]; - if(error) - DLog(@"JSON Parsing Error: %@", error); - - return [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; - } else { - DLog(@"JSON encoder missing, falling back to URL encoding"); - return [self urlEncodedKeyValueString]; - } + NSError *error = nil; + NSData *data = [NSJSONSerialization dataWithJSONObject:self + options:0 // non-pretty printing + error:&error]; + if(error) + DLog(@"JSON Parsing Error: %@", error); + + return [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; } -(NSString*) plistEncodedKeyValueString { - NSError *error = nil; - NSData *data = [NSPropertyListSerialization dataWithPropertyList:self - format:NSPropertyListXMLFormat_v1_0 + NSError *error = nil; + NSData *data = [NSPropertyListSerialization dataWithPropertyList:self + format:NSPropertyListXMLFormat_v1_0 options:0 error:&error]; if(error) DLog(@"JSON Parsing Error: %@", error); - return [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; + return [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; } @end diff --git a/MKNetworkKit/MKNetworkEngine.m b/MKNetworkKit/MKNetworkEngine.m index c233e19..a49bde8 100644 --- a/MKNetworkKit/MKNetworkEngine.m +++ b/MKNetworkKit/MKNetworkEngine.m @@ -30,6 +30,12 @@ #error MKNetworkKit does not support Objective-C Garbage Collection #endif +#if TARGET_OS_IPHONE +#ifndef __IPHONE_5_0 +#error MKNetworkKit does not support iOS 4 and lower +#endif +#endif + #if ! __has_feature(objc_arc) #error MKNetworkKit is ARC only. Either turn on ARC for the project or use -fobjc-arc flag #endif diff --git a/MKNetworkKit/MKNetworkOperation.m b/MKNetworkKit/MKNetworkOperation.m index 3db61b8..ea6481b 100644 --- a/MKNetworkKit/MKNetworkOperation.m +++ b/MKNetworkKit/MKNetworkOperation.m @@ -29,6 +29,12 @@ #error MKNetworkKit does not support Objective-C Garbage Collection #endif +#if TARGET_OS_IPHONE +#ifndef __IPHONE_5_0 +#error MKNetworkKit does not support iOS 4 and lower +#endif +#endif + #if ! __has_feature(objc_arc) #error MKNetworkKit is ARC only. Either turn on ARC for the project or use -fobjc-arc flag #endif @@ -65,7 +71,7 @@ @interface MKNetworkOperation (/*Private Methods*/) @property (nonatomic, strong) NSData *cachedResponse; @property (nonatomic, copy) MKNKResponseBlock cacheHandlingBlock; -#if TARGET_OS_IPHONE +#if TARGET_OS_IPHONE @property (nonatomic, assign) UIBackgroundTaskIdentifier backgroundTaskId; #endif @@ -98,11 +104,11 @@ -(BOOL) isCacheable { } -//=========================================================== +//=========================================================== // + (BOOL)automaticallyNotifiesObserversForKey: // -//=========================================================== -+ (BOOL)automaticallyNotifiesObserversForKey: (NSString *)theKey +//=========================================================== ++ (BOOL)automaticallyNotifiesObserversForKey: (NSString *)theKey { BOOL automatic; @@ -115,9 +121,9 @@ + (BOOL)automaticallyNotifiesObserversForKey: (NSString *)theKey return automatic; } -//=========================================================== -// postDataEncoding -//=========================================================== +//=========================================================== +// postDataEncoding +//=========================================================== - (MKNKPostDataEncodingType)postDataEncoding { return _postDataEncoding; @@ -137,17 +143,9 @@ - (void)setPostDataEncoding:(MKNKPostDataEncodingType)aPostDataEncoding } break; case MKNKPostDataEncodingTypeJSON: { - if(NSClassFromString(@"NSJSONSerialization")) { [self.request setValue: [NSString stringWithFormat:@"application/json; charset=%@", charset] forHTTPHeaderField:@"Content-Type"]; - } - else { - [self.request setValue: - [NSString stringWithFormat:@"application/x-www-form-urlencoded; charset=%@", charset] - forHTTPHeaderField:@"Content-Type"]; - - } } break; case MKNKPostDataEncodingTypePlist: { @@ -165,9 +163,9 @@ -(NSString*) encodedPostDataString { NSString *returnValue = @""; if(self.postDataEncodingHandler) - returnValue = self.postDataEncodingHandler(self.fieldsToBePosted); + returnValue = self.postDataEncodingHandler(self.fieldsToBePosted); else if(self.postDataEncoding == MKNKPostDataEncodingTypeURL) - returnValue = [self.fieldsToBePosted urlEncodedKeyValueString]; + returnValue = [self.fieldsToBePosted urlEncodedKeyValueString]; else if(self.postDataEncoding == MKNKPostDataEncodingTypeJSON) returnValue = [self.fieldsToBePosted jsonEncodedKeyValueString]; else if(self.postDataEncoding == MKNKPostDataEncodingTypePlist) @@ -184,9 +182,9 @@ -(void) setCustomPostDataEncodingHandler:(MKNKEncodingBlock) postDataEncodingHan [NSString stringWithFormat:@"%@; charset=%@", contentType, charset] forHTTPHeaderField:@"Content-Type"]; } -//=========================================================== -// freezable -//=========================================================== +//=========================================================== +// freezable +//=========================================================== - (BOOL)freezable { return _freezable; @@ -227,7 +225,7 @@ -(NSInteger) HTTPStatusCode { - (void)setFreezable:(BOOL)flag { - // get method cannot be frozen. + // get method cannot be frozen. // No point in freezing a method that doesn't change server state. if([self.request.HTTPMethod isEqualToString:@"GET"] && flag) return; _freezable = flag; @@ -277,7 +275,7 @@ -(void) notifyCache { if(![self isCacheable]) return; if(!([self.response statusCode] >= 200 && [self.response statusCode] < 300)) return; - if(![self isCancelled]) + if(![self isCancelled]) self.cacheHandlingBlock(self); } @@ -323,11 +321,11 @@ -(void) setState:(MKNetworkOperationState)newState { } } -- (void)encodeWithCoder:(NSCoder *)encoder +- (void)encodeWithCoder:(NSCoder *)encoder { [encoder encodeInteger:self.stringEncoding forKey:@"stringEncoding"]; [encoder encodeInteger:_postDataEncoding forKey:@"postDataEncoding"]; - + [encoder encodeObject:self.uniqueId forKey:@"uniqueId"]; [encoder encodeObject:self.request forKey:@"request"]; [encoder encodeObject:self.response forKey:@"response"]; @@ -348,7 +346,7 @@ - (void)encodeWithCoder:(NSCoder *)encoder [encoder encodeInteger:self.credentialPersistence forKey:@"credentialPersistence"]; } -- (id)initWithCoder:(NSCoder *)decoder +- (id)initWithCoder:(NSCoder *)decoder { self = [super init]; if (self) { @@ -426,7 +424,7 @@ -(void) updateHandlersFromOperation:(MKNetworkOperation*) operation { -(void) setCachedData:(NSData*) cachedData { - self.cachedResponse = cachedData; + self.cachedResponse = cachedData; [self operationSucceeded]; } @@ -440,7 +438,7 @@ -(void) updateOperationBasedOnPreviousHeaders:(NSMutableDictionary*) headers { if(eTag) { [self.request setValue:eTag forHTTPHeaderField:@"IF-NONE-MATCH"]; - } + } } -(void) setUsername:(NSString*) username password:(NSString*) password { @@ -489,11 +487,11 @@ - (id)initWithURLString:(NSString *)aURLString params:(NSDictionary *)params httpMethod:(NSString *)method -{ +{ if((self = [super init])) { self.responseBlocks = [NSMutableArray array]; - self.errorBlocks = [NSMutableArray array]; + self.errorBlocks = [NSMutableArray array]; self.filesToBePosted = [NSMutableArray array]; self.dataToBePosted = [NSMutableArray array]; @@ -518,19 +516,19 @@ - (id)initWithURLString:(NSString *)aURLString if (([method isEqualToString:@"GET"] || [method isEqualToString:@"DELETE"]) && (params && [params count] > 0)) { - finalURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@?%@", aURLString, + finalURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@?%@", aURLString, [self encodedPostDataString]]]; } else { finalURL = [NSURL URLWithString:aURLString]; } - self.request = [NSMutableURLRequest requestWithURL:finalURL - cachePolicy:NSURLRequestReloadIgnoringLocalCacheData + self.request = [NSMutableURLRequest requestWithURL:finalURL + cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:kMKNetworkKitRequestTimeOutInSeconds]; [self.request setHTTPMethod:method]; - [self.request setValue:[NSString stringWithFormat:@"%@, en-us", + [self.request setValue:[NSString stringWithFormat:@"%@, en-us", [[NSLocale preferredLanguages] componentsJoinedByString:@", "] ] forHTTPHeaderField:@"Accept-Language"]; @@ -555,7 +553,7 @@ -(void) addHeaders:(NSDictionary*) headersDictionary { -(void) setAuthorizationHeaderValue:(NSString*) token forAuthType:(NSString*) authType { - [self.request setValue:[NSString stringWithFormat:@"%@ %@", authType, token] + [self.request setValue:[NSString stringWithFormat:@"%@ %@", authType, token] forHTTPHeaderField:@"Authorization"]; } /* @@ -564,11 +562,11 @@ -(void) setAuthorizationHeaderValue:(NSString*) token forAuthType:(NSString*) au -(NSString*) description { - NSMutableString *displayString = [NSMutableString stringWithFormat:@"%@\nRequest\n-------\n%@", + NSMutableString *displayString = [NSMutableString stringWithFormat:@"%@\nRequest\n-------\n%@", [[NSDate date] descriptionWithLocale:[NSLocale currentLocale]], [self curlCommandLineString]]; - NSString *responseString = [self responseString]; + NSString *responseString = [self responseString]; if([responseString length] > 0) { [displayString appendFormat:@"\n--------\nResponse\n--------\n%@\n", responseString]; } @@ -595,7 +593,7 @@ -(NSString*) curlCommandLineString if(self.postDataEncoding == MKNKPostDataEncodingTypeURL) { [self.fieldsToBePosted enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) { - [displayString appendFormat:@" %@ \"%@=%@\"", option, key, obj]; + [displayString appendFormat:@" %@ \"%@=%@\"", option, key, obj]; }]; } else { [displayString appendFormat:@" -d \"%@\"", [self encodedPostDataString]]; @@ -627,17 +625,17 @@ -(void) addData:(NSData*) data forKey:(NSString*) key { } -(void) addData:(NSData*) data forKey:(NSString*) key mimeType:(NSString*) mimeType fileName:(NSString*) fileName { - + if ([self.request.HTTPMethod isEqualToString:@"GET"]) { - [self.request setHTTPMethod:@"POST"]; + [self.request setHTTPMethod:@"POST"]; } NSDictionary *dict = @{@"data": data, - @"name": key, - @"mimetype": mimeType, - @"filename": fileName}; + @"name": key, + @"mimetype": mimeType, + @"filename": fileName}; - [self.dataToBePosted addObject:dict]; + [self.dataToBePosted addObject:dict]; } -(void) addFile:(NSString*) filePath forKey:(NSString*) key { @@ -648,14 +646,14 @@ -(void) addFile:(NSString*) filePath forKey:(NSString*) key { -(void) addFile:(NSString*) filePath forKey:(NSString*) key mimeType:(NSString*) mimeType { if ([self.request.HTTPMethod isEqualToString:@"GET"]) { - [self.request setHTTPMethod:@"POST"]; + [self.request setHTTPMethod:@"POST"]; } NSDictionary *dict = @{@"filepath": filePath, - @"name": key, - @"mimetype": mimeType}; + @"name": key, + @"mimetype": mimeType}; - [self.filesToBePosted addObject:dict]; + [self.filesToBePosted addObject:dict]; } -(NSData*) bodyData { @@ -667,29 +665,29 @@ -(NSData*) bodyData { NSString *boundary = @"0xKhTmLbOuNdArY"; NSMutableData *body = [NSMutableData data]; - __block NSUInteger postLength = 0; + __block NSUInteger postLength = 0; [self.fieldsToBePosted enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) { NSString *thisFieldString = [NSString stringWithFormat: - @"--%@\r\nContent-Disposition: form-data; name=\"%@\"\r\n\r\n%@", + @"--%@\r\nContent-Disposition: form-data; name=\"%@\"\r\n\r\n%@", boundary, key, obj]; [body appendData:[thisFieldString dataUsingEncoding:[self stringEncoding]]]; [body appendData:[@"\r\n" dataUsingEncoding:[self stringEncoding]]]; - }]; + }]; [self.filesToBePosted enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { NSDictionary *thisFile = (NSDictionary*) obj; NSString *thisFieldString = [NSString stringWithFormat: @"--%@\r\nContent-Disposition: form-data; name=\"%@\"; filename=\"%@\"\r\nContent-Type: %@\r\nContent-Transfer-Encoding: binary\r\n\r\n", - boundary, - thisFile[@"name"], - [thisFile[@"filepath"] lastPathComponent], + boundary, + thisFile[@"name"], + [thisFile[@"filepath"] lastPathComponent], thisFile[@"mimetype"]]; - [body appendData:[thisFieldString dataUsingEncoding:[self stringEncoding]]]; + [body appendData:[thisFieldString dataUsingEncoding:[self stringEncoding]]]; [body appendData: [NSData dataWithContentsOfFile:thisFile[@"filepath"]]]; [body appendData:[@"\r\n" dataUsingEncoding:[self stringEncoding]]]; }]; @@ -699,12 +697,12 @@ -(NSData*) bodyData { NSDictionary *thisDataObject = (NSDictionary*) obj; NSString *thisFieldString = [NSString stringWithFormat: @"--%@\r\nContent-Disposition: form-data; name=\"%@\"; filename=\"%@\"\r\nContent-Type: %@\r\nContent-Transfer-Encoding: binary\r\n\r\n", - boundary, - thisDataObject[@"name"], - thisDataObject[@"filename"], + boundary, + thisDataObject[@"name"], + thisDataObject[@"filename"], thisDataObject[@"mimetype"]]; - [body appendData:[thisFieldString dataUsingEncoding:[self stringEncoding]]]; + [body appendData:[thisFieldString dataUsingEncoding:[self stringEncoding]]]; [body appendData:thisDataObject[@"data"]]; [body appendData:[@"\r\n" dataUsingEncoding:[self stringEncoding]]]; }]; @@ -717,7 +715,7 @@ -(NSData*) bodyData { NSString *charset = (__bridge NSString *)CFStringConvertEncodingToIANACharSetName(CFStringConvertNSStringEncodingToEncoding(self.stringEncoding)); if(([self.filesToBePosted count] > 0) || ([self.dataToBePosted count] > 0)) { - [self.request setValue:[NSString stringWithFormat:@"multipart/form-data; charset=%@; boundary=%@", charset, boundary] + [self.request setValue:[NSString stringWithFormat:@"multipart/form-data; charset=%@; boundary=%@", charset, boundary] forHTTPHeaderField:@"Content-Type"]; [self.request setValue:[NSString stringWithFormat:@"%lu", (unsigned long) [body length]] forHTTPHeaderField:@"Content-Length"]; @@ -743,14 +741,14 @@ -(void) main { -(void) endBackgroundTask { -#if TARGET_OS_IPHONE +#if TARGET_OS_IPHONE dispatch_async(dispatch_get_main_queue(), ^{ if (self.backgroundTaskId != UIBackgroundTaskInvalid) { [[UIApplication sharedApplication] endBackgroundTask:self.backgroundTaskId]; self.backgroundTaskId = UIBackgroundTaskInvalid; } }); -#endif +#endif } - (void) start @@ -779,9 +777,9 @@ - (void) start } dispatch_async(dispatch_get_main_queue(), ^{ - self.connection = [[NSURLConnection alloc] initWithRequest:self.request - delegate:self - startImmediately:NO]; + self.connection = [[NSURLConnection alloc] initWithRequest:self.request + delegate:self + startImmediately:NO]; [self.connection scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSRunLoopCommonModes]; @@ -810,7 +808,7 @@ - (BOOL)isReady { return (self.state == MKNetworkOperationStateReady); } -- (BOOL)isFinished +- (BOOL)isFinished { return (self.state == MKNetworkOperationStateFinished); } @@ -822,7 +820,7 @@ - (BOOL)isExecuting { -(void) cancel { - if([self isFinished]) + if([self isFinished]) return; @synchronized(self) { @@ -848,7 +846,7 @@ -(void) cancel { [self.downloadStreams removeAllObjects]; self.downloadStreams = nil; - self.authHandler = nil; + self.authHandler = nil; self.mutableData = nil; self.downloadedDataSize = 0; @@ -885,12 +883,12 @@ - (void)connection:(NSURLConnection *)connection willSendRequestForAuthenticatio if (((challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodDefault) || (challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodHTTPBasic) || (challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodHTTPDigest) || - (challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodNTLM)) && + (challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodNTLM)) && (self.username && self.password)) { // for NTLM, we will assume user name to be of the form "domain\\username" - NSURLCredential *credential = [NSURLCredential credentialWithUser:self.username + NSURLCredential *credential = [NSURLCredential credentialWithUser:self.username password:self.password persistence:self.credentialPersistence]; @@ -936,14 +934,14 @@ - (void)connection:(NSURLConnection *)connection willSendRequestForAuthenticatio // Cert not trusted, and user is not OK with that. Don't proceed [challenge.sender continueWithoutCredentialForAuthenticationChallenge:challenge]; } - } + } else { // invalid or revoked certificate [challenge.sender useCredential:[NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust] forAuthenticationChallenge:challenge]; //[challenge.sender continueWithoutCredentialForAuthenticationChallenge:challenge]; } - } + } else if (self.authHandler) { // forward the authentication to the view controller that created this operation @@ -990,7 +988,7 @@ - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLRespon NSString *expiresOn = httpHeaders[@"Expires"]; NSString *contentType = httpHeaders[@"Content-Type"]; - // if contentType is image, + // if contentType is image, NSDate *expiresOnDate = nil; @@ -999,7 +997,7 @@ - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLRespon // For images let's assume a expiry date of 7 days if there is no eTag or Last Modified. if(!eTag && !lastModified) expiresOnDate = [[NSDate date] dateByAddingTimeInterval:kMKNetworkKitDefaultImageCacheDuration]; - else + else expiresOnDate = [[NSDate date] dateByAddingTimeInterval:kMKNetworkKitDefaultImageHeadRequestDuration]; } @@ -1025,7 +1023,7 @@ - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLRespon } } - // if there was a cacheControl entity, we would have a expiresOnDate that is not nil. + // if there was a cacheControl entity, we would have a expiresOnDate that is not nil. // "Cache-Control" headers take precedence over "Expires" headers expiresOn = [expiresOnDate rfc1123String]; @@ -1062,7 +1060,7 @@ - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data { if ([stream hasSpaceAvailable]) { const uint8_t *dataBuffer = [data bytes]; [stream write:&dataBuffer[0] maxLength:[data length]]; - } + } } self.downloadedDataSize += [data length]; @@ -1073,11 +1071,11 @@ - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data { double progress = (double)(self.downloadedDataSize) / (double)(self.startPosition + [self.response expectedContentLength]); downloadProgressBlock(progress); - } + } } } -- (void)connection:(NSURLConnection *)connection didSendBodyData:(NSInteger)bytesWritten +- (void)connection:(NSURLConnection *)connection didSendBodyData:(NSInteger)bytesWritten totalBytesWritten:(NSInteger)totalBytesWritten totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite { @@ -1106,10 +1104,10 @@ - (NSURLRequest *)connection: (NSURLConnection *)inConnection } - (void)connectionDidFinishLoading:(NSURLConnection *)connection { - if([self isCancelled]) + if([self isCancelled]) return; - self.state = MKNetworkOperationStateFinished; + self.state = MKNetworkOperationStateFinished; for(NSOutputStream *stream in self.downloadStreams) [stream close]; @@ -1117,10 +1115,10 @@ - (void)connectionDidFinishLoading:(NSURLConnection *)connection { if (self.response.statusCode >= 200 && self.response.statusCode < 300 && ![self isCancelled]) { self.cachedResponse = nil; // remove cached data - [self notifyCache]; + [self notifyCache]; [self operationSucceeded]; - } + } if (self.response.statusCode >= 300 && self.response.statusCode < 400) { if(self.response.statusCode == 301) { @@ -1136,12 +1134,12 @@ - (void)connectionDidFinishLoading:(NSURLConnection *)connection { DLog(@"%@ returned status %d", self.url, (int) self.response.statusCode); } - } else if (self.response.statusCode >= 400 && self.response.statusCode < 600 && ![self isCancelled]) { + } else if (self.response.statusCode >= 400 && self.response.statusCode < 600 && ![self isCancelled]) { [self operationFailedWithError:[NSError errorWithDomain:NSURLErrorDomain code:self.response.statusCode userInfo:self.response.allHeaderFields]]; - } + } [self endBackgroundTask]; } @@ -1192,7 +1190,7 @@ -(void) decompressedResponseImageOfSize:(CGSize) size completionHandler:(void (^ size_t imageWidth = (size_t)targetSize.width; size_t imageHeight = (size_t)targetSize.height; - + CGContextRef context = CGBitmapContextCreate(NULL, imageWidth, imageHeight, @@ -1231,7 +1229,7 @@ -(void) decompressedResponseImageOfSize:(CGSize) size completionHandler:(void (^ CGImageRelease(decompressedImageRef); dispatch_async(dispatch_get_main_queue(), ^{ imageDecompressionHandler(decompressedImage); - }); + }); }); } @@ -1249,17 +1247,11 @@ -(NSXMLDocument*) responseXML { -(id) responseJSON { - if(NSClassFromString(@"NSJSONSerialization")) { - if([self responseData] == nil) return nil; - NSError *error = nil; - id returnValue = [NSClassFromString(@"NSJSONSerialization") JSONObjectWithData:[self responseData] options:0 error:&error]; - if(error) DLog(@"JSON Parsing Error: %@", error); - return returnValue; - } - else { - DLog("You are running on iOS 4. Subclass MKNO and override responseJSON to support custom JSON parsing"); - return [self responseString]; - } + if([self responseData] == nil) return nil; + NSError *error = nil; + id returnValue = [NSJSONSerialization JSONObjectWithData:[self responseData] options:0 error:&error]; + if(error) DLog(@"JSON Parsing Error: %@", error); + return returnValue; } #pragma mark - @@ -1282,7 +1274,7 @@ -(void) showLocalNotification { UILocalNotification *localNotification = [[UILocalNotification alloc] init]; localNotification.alertBody = [self.error localizedDescription]; - localNotification.alertAction = NSLocalizedString(@"Dismiss", @""); + localNotification.alertAction = NSLocalizedString(@"Dismiss", @""); [[UIApplication sharedApplication] presentLocalNotificationNow:localNotification]; } @@ -1294,7 +1286,7 @@ -(void) operationFailedWithError:(NSError*) error { self.error = error; DLog(@"%@, [%@]", self, [self.error localizedDescription]); for(MKNKErrorBlock errorBlock in self.errorBlocks) - errorBlock(error); + errorBlock(error); #if TARGET_OS_IPHONE DLog(@"State: %d", [[UIApplication sharedApplication] applicationState]); diff --git a/README.mdown b/README.mdown index e78bbfd..1b1092e 100644 --- a/README.mdown +++ b/README.mdown @@ -1,8 +1,6 @@ -This is version 0.85 of MKNetworkKit. Read the [blog post](http://mk.sg/8w) for more. The master branch is a live working branch. Expect bugs!(?). Nah, most bugs are squashed already. Special thanks to all of you contributors. +This is version 0.85 of MKNetworkKit. Read the [blog post](http://mk.sg/8w) for more. The latest code is still not fully testing on Mac, though iOS is complete. Caching responses and invalidation of cache is not implemented the right way for the Mac target. -If you are too chicken, you can always pickup the latest stable code at the tag [v0.83](https://github.com/MugunthKumar/MKNetworkKit/zipball/v0.83) - -The latest stable code is still not fully testing on Mac, though iOS is complete. Caching responses and invalidation of cache is not implemented the right way for the Mac target. MKNetworkKit is ready for production use on iOS apps. +MKNetworkKit is ready for production use on iOS apps. MKNetworkKit can also be compiled to a static library and included. I will be updating the documentation on how to do this soon. @@ -90,9 +88,6 @@ Gentle Bytes appledoc@gentlebytes.com * Example code for Mac * Fix AppleDoc warnings - -I'll be working on this soon. But you can start forking it and getting it right - --- ###Known Issues * Frozen operations don't report progress/completion handlers back to the calling code. (Before 1.0)