Skip to content
This repository has been archived by the owner on Mar 4, 2020. It is now read-only.

Various fixes #429

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
111 changes: 111 additions & 0 deletions MKNetworkKit.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
#
# Be sure to run `pod spec lint foo.podspec' to ensure this is a
# valid spec and to remove all comments including this before submitting the spec.
#
# To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html
# To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/
#

Pod::Spec.new do |s|

# ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# These will help people to find your library, and whilst it
# can feel like a chore to fill in it's definitely to your advantage. The
# summary should be tweet-length, and the description more in depth.
#

s.name = "MKNetworkKit"
s.version = "0.89"
s.summary = "ARC ready Networking Framework with built in authentication and HTTP 1.1 caching standards support for iOS 5+ devices."

s.homepage = "https://github.com/MugunthKumar/MKNetworkKit"


# ――― Spec License ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# Licensing your code is important. See http://choosealicense.com for more info.
# CocoaPods will detect a license file if there is a named LICENSE*
# Popular ones are 'MIT', 'BSD' and 'Apache License, Version 2.0'.
#

s.license = "MIT"
# s.license = { :type => "MIT", :file => "FILE_LICENSE" }


# ――― Author Metadata ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# Specify the authors of the library, with email addresses. Email addresses
# of the authors are extracted from the SCM log. E.g. $ git log. CocoaPods also
# accepts just a name if you'd rather not provide an email address.
#
# Specify a social_media_url where others can refer to, for example a twitter
# profile URL.
#

s.author = { "Jon Drukman" => "jsd@beatsmusic.com" }
# Or just: s.author = "Jon Drukman"
# s.authors = { "Jon Drukman" => "jsd@beatsmusic.com" }
# s.social_media_url = "http://twitter.com/Jon Drukman"

# ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# If this Pod runs only on iOS or OS X, then specify the platform and
# the deployment target. You can optionally include the target after the platform.
#

# s.platform = :ios
# s.platform = :ios, "5.0"

# When using multiple platforms
s.ios.deployment_target = "5.0"
s.osx.deployment_target = "10.9"


# ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# Specify the location from where the source should be retrieved.
# Supports git, hg, bzr, svn and HTTP.
#

s.source = { :git => "https://github.com/jdrukman/MKNetworkKit.git", :tag => "0.88" }


# ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# CocoaPods is smart about how it includes source code. For source files
# giving a folder will include any h, m, mm, c & cpp files. For header
# files it will include any header in the folder.
# Not including the public_header_files will make all headers public.
#

s.source_files = "MKNetworkKit/*.{h,m}", "MKNetworkKit/Categories/*.{h,m}"
s.ios.exclude_files = "**/*NSAlert*"
s.osx.exclude_files = "**/*UIAlertView*"

# ――― Project Linking ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# Link your library with frameworks, or libraries. Libraries do not include
# the lib prefix of their name.
#

# s.framework = "SomeFramework"
# s.frameworks = "SomeFramework", "AnotherFramework"

# s.library = "iconv"
# s.libraries = "iconv", "xml2"
s.ios.frameworks = "CFNetwork", "Security"
s.osx.frameworks = "CoreServices", "Security"

# ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# If your library depends on compiler flags you can set them in the xcconfig hash
# where they will only apply to your library. If you depend on other Podspecs
# you can include multiple dependencies to ensure it works.

s.requires_arc = true

# s.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" }
s.dependency "Reachability", "~> 3.1.0"

end
5 changes: 1 addition & 4 deletions MKNetworkKit/Categories/NSAlert+MKNetworkKitAdditions.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,9 @@
@implementation NSAlert (MKNetworkKitAdditions)

+(NSAlert*) showWithError:(NSError*) networkError {

DLog(@"%@", [networkError userInfo]);

NSAlert *alert = [NSAlert alertWithError:networkError];
[alert runModal];
return alert;
}
@end
#endif
#endif
15 changes: 11 additions & 4 deletions MKNetworkKit/Categories/NSDictionary+RequestEncoding.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,17 @@ -(NSString*) urlEncodedKeyValueString {
for (NSString *key in self) {

NSObject *value = [self valueForKey:key];
if([value isKindOfClass:[NSString class]])
[string appendFormat:@"%@=%@&", [key mk_urlEncodedString], [((NSString*)value) mk_urlEncodedString]];
else
[string appendFormat:@"%@=%@&", [key mk_urlEncodedString], value];
if ([value isKindOfClass:[NSString class]]) {
[string appendFormat:@"%@=%@&", [key mk_urlEncodedString], [((NSString*)value) mk_urlEncodedString]];
}
else if ([value isKindOfClass:[NSArray class]]) {
for (id item in value) {
[string appendFormat:@"%@=%@&", [key urlEncodedString], [(NSString*)item urlEncodedString]];
}
}
else {
[string appendFormat:@"%@=%@&", [key mk_urlEncodedString], value];
}
}

if([string length] > 0)
Expand Down
2 changes: 1 addition & 1 deletion MKNetworkKit/MKNetworkOperation.m
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,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 != nil)
self.cacheHandlingBlock(self);
}

Expand Down