@@ -49,7 +49,7 @@ - (void)testParamAddForBranchKey {
4949 if (callCount == 1 ) {
5050 BOOL foundIt = ([request.URL.query rangeOfString: @" branch_key=key_" ].location != NSNotFound );
5151 XCTAssertTrue (foundIt, @" Branch Key not added" );
52- BNCAfterSecondsPerformBlock (0.01 , ^{ [expectation fulfill ]; });
52+ BNCAfterSecondsPerformBlockOnMainThread (0.01 , ^{ [expectation fulfill ]; });
5353 return YES ;
5454 }
5555 return NO ;
@@ -108,7 +108,10 @@ - (void)testGetRequestAsyncRetriesWhenAppropriate {
108108 // Return actual data afterwards
109109 ++successfulConnections;
110110 XCTAssertEqual (connectionAttempts, failedConnections + successfulConnections);
111- BNCAfterSecondsPerformBlock (0.01 , ^{ NSLog (@" ==> Fullfill." ); [successExpectation fulfill ]; });
111+ BNCAfterSecondsPerformBlockOnMainThread (0.01 , ^{
112+ NSLog (@" ==> Fullfill." );
113+ [successExpectation fulfill ];
114+ });
112115
113116 NSDictionary * dummyJSONResponse = @{@" key" : @" value" };
114117 return [OHHTTPStubsResponse responseWithJSONObject: dummyJSONResponse statusCode: 200 headers: nil ];
@@ -153,7 +156,7 @@ - (void)testGetRequestAsyncRetriesWhenInappropriateResponse {
153156 NSDictionary * dummyJSONResponse = @{@" key" : @" value" };
154157 connectionAttempts++;
155158 XCTAssertEqual (connectionAttempts, 1 );
156- BNCAfterSecondsPerformBlock (0.01 , ^ {
159+ BNCAfterSecondsPerformBlockOnMainThread (0.01 , ^ {
157160 [successExpectation fulfill ];
158161 });
159162 return [OHHTTPStubsResponse responseWithJSONObject: dummyJSONResponse statusCode: 200 headers: nil ];
@@ -191,7 +194,7 @@ - (void)testGetRequestAsyncRetriesWhenInappropriateRetryCount {
191194 NSDictionary * dummyJSONResponse = @{@" key" : @" value" };
192195 connectionAttempts++;
193196 XCTAssertEqual (connectionAttempts, 1 );
194- BNCAfterSecondsPerformBlock (0.01 , ^{
197+ BNCAfterSecondsPerformBlockOnMainThread (0.01 , ^{
195198 [successExpectation fulfill ];
196199 });
197200 return [OHHTTPStubsResponse responseWithJSONObject: dummyJSONResponse statusCode: 200 headers: nil ];
@@ -243,7 +246,10 @@ - (void)testPostRequestAsyncRetriesWhenAppropriate {
243246 ++successfulConnections;
244247 NSDictionary * dummyJSONResponse = @{@" key" : @" value" };
245248 XCTAssertEqual (connectionAttempts, failedConnections + successfulConnections);
246- BNCAfterSecondsPerformBlock (0.01 , ^ { NSLog (@" ==>> Fullfill <<==" ); [successExpectation fulfill ]; });
249+ BNCAfterSecondsPerformBlockOnMainThread (0.01 , ^ {
250+ NSLog (@" ==>> Fullfill <<==" );
251+ [successExpectation fulfill ];
252+ });
247253 return [OHHTTPStubsResponse responseWithJSONObject: dummyJSONResponse statusCode: 200 headers: nil ];
248254
249255 } else {
@@ -284,8 +290,7 @@ - (void)testPostRequestAsyncRetriesWhenInappropriateResponse {
284290 NSDictionary * dummyJSONResponse = @{@" key" : @" value" };
285291 connectionAttempts++;
286292 XCTAssertEqual (connectionAttempts, 1 );
287- BNCAfterSecondsPerformBlock (0.01 , ^{ [successExpectation fulfill ]; });
288-
293+ BNCAfterSecondsPerformBlockOnMainThread (0.01 , ^{ [successExpectation fulfill ]; });
289294 return [OHHTTPStubsResponse responseWithJSONObject: dummyJSONResponse statusCode: 200 headers: nil ];
290295
291296 }];
@@ -321,10 +326,8 @@ - (void)testPostRequestAsyncRetriesWhenInappropriateRetryCount {
321326 NSDictionary * dummyJSONResponse = @{@" key" : @" value" };
322327 connectionAttempts++;
323328 XCTAssertEqual (connectionAttempts, 1 );
324- BNCAfterSecondsPerformBlock (0.01 , ^{ [successExpectation fulfill ]; });
325-
329+ BNCAfterSecondsPerformBlockOnMainThread (0.01 , ^{ [successExpectation fulfill ]; });
326330 return [OHHTTPStubsResponse responseWithJSONObject: dummyJSONResponse statusCode: 200 headers: nil ];
327-
328331 }];
329332
330333 [serverInterface getRequest: nil url: @" http://foo" key: @" key_live_foo" callback: NULL ];
0 commit comments