Just spent some time figuring out how to do this in v0.20. From what I can say, you cannot directly change the base URL without entering the source code of AFNetworking. You can create a new HTTPClient
and install it, but I found that it caused even more problems, apparently because RestKit does additional configuration in AFNetworking HTTPClient
when configuring RKObjectManager
, as well as directly configuring the client is missing.
I came up with this solution, which should create another RKObjectManager
with a new baseURL and re-add the descriptors. You will also need to set serialization types and headers again.
NSString *urlString = @"http://www.something.com/api"; RKObjectManager *newManager = [RKObjectManager managerWithBaseURL:[NSURL URLWithString:urlString]]; [newManager setRequestSerializationMIMEType:RKMIMETypeJSON]; [newManager setAcceptHeaderWithMIMEType:RKMIMETypeJSON]; [newManager addResponseDescriptorsFromArray:[RKObjectManager sharedManager].responseDescriptors]; [newManager addRequestDescriptorsFromArray:[RKObjectManager sharedManager].requestDescriptors]; [RKObjectManager setSharedManager:newManager];
Related Documentation: Using Multiple Base URLs in RestKit
source share