10

I'm trying to do some RESTKit http requests, and when I use the RKResponseDescriptor line of code, it says 'responseDescriptorWithMapping:pathPattern:keyPath:statusCodes:' is deprecated.

Here is how I coded it:

RKResponseDescriptor *responseDescriptor = [RKResponseDescriptor 
responseDescriptorWithMapping:mapping pathPattern:nil keyPath:nil 
statusCodes:statusCodeSet];

What exactly is the deal here, and how can I fix it?

comrod
  • 343
  • 7
  • 17

2 Answers2

13

Restkit 0.20.3 introduced new feature that allows you to use a response descriptor with multiple requests methods

+ (instancetype)responseDescriptorWithMapping:(RKMapping *)mapping
                                   method:(RKRequestMethod)method
                              pathPattern:(NSString *)pathPattern
                                  keyPath:(NSString *)keyPath
                              statusCodes:(NSIndexSet *)statusCodes

So you can just switch to this new implementation.

Dmitry Shevchenko
  • 31,814
  • 10
  • 56
  • 62
6

I had to search a fair bit to figure out what to put for method, so I thought I would share the specifics for others:

RKResponseDescriptor *responseDescriptor =
  [RKResponseDescriptor responseDescriptorWithMapping:mapping
                                               method:RKRequestMethodAny
                                          pathPattern:nil keyPath:nil
                                          statusCodes:statusCodeSet];

I used the general RKRequestMethodAny, but you can use something more specific if you prefer.

Nico teWinkel
  • 870
  • 11
  • 19