From b6769ee7948368665ce06d4ca776a333079b5325 Mon Sep 17 00:00:00 2001 From: Oliver Letterer Date: Wed, 22 May 2013 21:44:42 +0200 Subject: [PATCH] Using __unsage_unretained for getting invocation arguments. --- Tests/AFHTTPClientTests.m | 15 ++++++++++++--- Tests/Podfile.lock | 2 +- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Tests/AFHTTPClientTests.m b/Tests/AFHTTPClientTests.m index c64b811..2e461b8 100644 --- a/Tests/AFHTTPClientTests.m +++ b/Tests/AFHTTPClientTests.m @@ -271,7 +271,10 @@ __block NSArray *operations = nil; id mockClient = [OCMockObject partialMockForObject:self.client]; void (^theBlock)(NSInvocation *) = ^(NSInvocation *invocation) { - [invocation getArgument:&operations atIndex:2]; + __unsafe_unretained id argument = nil; + [invocation getArgument:&argument atIndex:2]; + + operations = argument; }; [[[mockClient stub] andDo:theBlock] enqueueBatchOfHTTPRequestOperations:[OCMArg any] progressBlock:nil completionBlock:nil]; [mockClient enqueueBatchOfHTTPRequestOperationsWithRequests:@[ firstRequest, secondRequest ] progressBlock:nil completionBlock:nil]; @@ -294,12 +297,18 @@ __block NSArray *operations = nil; [[[mockOperationQueue stub] andDo:^(NSInvocation *invocation) { - [invocation getArgument:&operations atIndex:2]; + __unsafe_unretained id argument = nil; + [invocation getArgument:&argument atIndex:2]; + + operations = argument; }] addOperations:OCMOCK_ANY waitUntilFinished:NO]; __block NSBlockOperation *batchedOperation = nil; [[[mockOperationQueue stub] andDo:^(NSInvocation *invocation) { - [invocation getArgument:&batchedOperation atIndex:2]; + __unsafe_unretained id argument = nil; + [invocation getArgument:&argument atIndex:2]; + + batchedOperation = argument; }] addOperation:OCMOCK_ANY]; [mockClient enqueueBatchOfHTTPRequestOperations:@[ firstOperation, secondOperation ] progressBlock:NULL completionBlock:NULL]; diff --git a/Tests/Podfile.lock b/Tests/Podfile.lock index e98fa29..9edb273 100644 --- a/Tests/Podfile.lock +++ b/Tests/Podfile.lock @@ -17,7 +17,7 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: AFHTTPRequestOperationLogger: 34ba125cb9eeb77a3b67aaaca105720ba3a0798c - AFNetworking: 02a1b682b3c3fa39afd22e725ab8f4a65cb157b6 + AFNetworking: d1ba5908b233189e424e101721acef7905b58efb Expecta: d46fb1bd78c90a83da0158b9b1e108de106e369f OCMock: 79212e5e328378af5cfd6edb5feacfd6c49cd8a3