Skip to content

Commit

Permalink
Merge pull request #6 from josipbernat/develop
Browse files Browse the repository at this point in the history
Updated canceling operations.
  • Loading branch information
josipbernat committed Sep 2, 2014
2 parents 18e993b + 0398fb7 commit 8c078c5
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
6 changes: 3 additions & 3 deletions JBMessage.podspec
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
Pod::Spec.new do |s|
s.name = "JBMessage"
s.version = "1.0.12"
s.version = "1.0.13"
s.summary = "JBMessage is simple iOS networking wrapper based on AFNetworking"
s.homepage = "https://github.com/josipbernat/JBMessage"
s.license = { :type => "MIT", :file => "LICENSE" }
s.author = { "Josip Bernat" => "[email protected]" }
s.social_media_url = "http://twitter.com/josipbernat"
s.platform = :ios, "6.0"
s.source = { :git => "https://github.com/josipbernat/JBMessage.git", :tag => "v1.0.12" }
s.source = { :git => "https://github.com/josipbernat/JBMessage.git", :tag => "v1.0.13" }
s.source_files = 'JBMessage/JBMessage/**/*.{h,m}'
s.requires_arc = true
s.dependency "AFNetworking", "~> 2.3.1"
s.dependency "AFNetworking", "~> 2.3"
end

8 changes: 8 additions & 0 deletions JBMessage/JBMessage/JBMessage.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ @interface JBMessage () {
BOOL _isExecuting;
}

@property (nonatomic, strong) AFHTTPRequestOperation *operation;

#pragma mark - Shared Queue
+ (NSOperationQueue *)sharedQueue;

Expand Down Expand Up @@ -224,7 +226,10 @@ - (void) finish {
}

- (void) cancel {

_isCancelled = YES;
[self.operation cancel];
self.operation = nil;
}

- (BOOL) isConcurrent {
Expand Down Expand Up @@ -270,13 +275,16 @@ - (void)executeRequest {

__strong JBMessage *strongThis = this;
[strongThis receivedResponse:responseObject error:nil];
strongThis.operation = nil;

} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
#ifdef DEBUG
NSString *response = [[NSString alloc] initWithData:operation.responseData encoding:NSUTF8StringEncoding];
if (response && response.length) { NSLog(@"Response error: %@", response); }
#endif
__strong JBMessage *strongThis = this;
[strongThis receivedResponse:operation.responseData error:error];
strongThis.operation = nil;
}];

[operation setUploadProgressBlock:self.uploadBlock];
Expand Down
2 changes: 1 addition & 1 deletion Podfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
platform :ios, '6.0'
pod 'AFNetworking', '~> 2.3.1'
pod 'AFNetworking', '~> 2.3'
2 changes: 1 addition & 1 deletion Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ PODS:
- AFNetworking/NSURLSession

DEPENDENCIES:
- AFNetworking (~> 2.3.1)
- AFNetworking (~> 2.3)

SPEC CHECKSUMS:
AFNetworking: 6d7b76aa5d04c8c37daad3eef4b7e3f2a7620da3
Expand Down

0 comments on commit 8c078c5

Please sign in to comment.