Full code
To be more complex / descriptive, my code was as follows:
RKHTTPRequestOperation_Timeoutable.h
#import "RKHTTPRequestOperation.h" @interface RKHTTPRequestOperation_Timeoutable: RKHTTPRequestOperation - (NSURLRequest *)connection:(NSURLConnection *)connection willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)redirectResponse; @end
RKHTTPRequestOperation_Timeoutable.m
#import "RKHTTPRequestOperation_Timeoutable.h" @implementation RKHTTPRequestOperation_Timeoutable - (NSURLRequest *)connection:(NSURLConnection *)connection willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)redirectResponse { NSMutableURLRequest *requestWithTimeout = [request mutableCopy]; [requestWithTimeout setTimeoutInterval:150];
Then (and this is the part that helped me find out what was not mentioned in the other answers), register your class with RKObjectManager .
So (Forgive my inconsistency, this is my only code segment in quickly not a lens c ):
RKObjectManager.sharedManager().registerRequestOperationClass(Timeoutable);
csga5000
source share