0

I have the requirement to support multiple connections (multiple baseURLs). So some get and post request should go to baseURL1 some to baseURL2 an so forth.

I think one way to do this is by constantly switching the baseURL to the needed one right before a get or post. I'm not sure how well RestKit 0.20 would handles this and if there are some side-effects. Generally I think it would be a bad idea with a lot of overhead. But I'm not a RestKit expert when it comes to the internal workings.

The other idea I have is to use multiple RKObjectManagers, one per baseURL and then somehow use the right one for the calls. But I have no idea if RestKit is designed for that and can be used in this scenario. How would you manage multiple RKObjectManagers? Or is this a bad idea to solve my problem?

What's the way to go?

4

1 回答 1

1

使用多个RKObjectManagers。我将有一个单例数据控制器,它将应用程序的其余部分从 RestKit 的使用中抽象出来,并根据您的模型对象呈现一个接口。在内部,它有许多RKObjectManager实例,并且每种方法都使用适当的实例(它们可以是属性,或者您可以拥有它们的字典,具体取决于您如何知道何时应该使用它们)。

于 2013-09-04T20:48:51.633 回答