restkit

RestKit - Process one REST operation at a time

别等时光非礼了梦想. 提交于 2019-12-23 04:03:17
问题 I'm using RestKit 0.20.3 and have some REST operations that needs to be done in a certain order ( the response from one REST operation needs to be included in the request parameter mapping for the next ). I tried setting up the queue to handle one operation at a time like this: RKObjectManager.sharedManager.operationQueue.maxConcurrentOperationCount = 1; And adding the operations like this: for (id insertedObject in insertedObjects) { [RKObjectManager.sharedManager postObject:insertedObject

RestKit - Process one REST operation at a time

Deadly 提交于 2019-12-23 04:02:52
问题 I'm using RestKit 0.20.3 and have some REST operations that needs to be done in a certain order ( the response from one REST operation needs to be included in the request parameter mapping for the next ). I tried setting up the queue to handle one operation at a time like this: RKObjectManager.sharedManager.operationQueue.maxConcurrentOperationCount = 1; And adding the operations like this: for (id insertedObject in insertedObjects) { [RKObjectManager.sharedManager postObject:insertedObject

RestKit: Managed object mapped inside a plain old Objective-C object

≯℡__Kan透↙ 提交于 2019-12-23 01:27:15
问题 Preamble: I'm using RestKit 0.21.0, but I've also tried 0.23.0. I have a number of mappings where a plain old Objective-C object (let's call that a POOCO) contains an NSManagedObject . It seems that when doing GET requests on this root POOCO, the managed object is created under the mainQueueManagedObjectContext . However when I do a PUT against the POOCO, when the response is loaded (the response is a copy of the object that was sent), the managed sub-object is created under a temporary

How do I set RKObjectManager's delegate to nil?

余生颓废 提交于 2019-12-23 01:04:52
问题 I want to set RKObjectManager's delegate to nil. But I can't find delegate property. My request is: [[RKObjectManager sharedManager] loadObjectsAtResourcePath:@"getData" objectMapping:[[RKObjectManager sharedManager].mappingProvider objectMappingForKeyPath:@"clips"] delegate:self]; UPDATE: There is a crash in my app. I go to "Clips" and in the viewDidLoad send loadObjectsAtResourcePath. If I rapidly leave this screen I get crash at [RKResponse connection:didReceiveData:]. 回答1: The crash is

Restkit route error

℡╲_俬逩灬. 提交于 2019-12-22 18:32:48
问题 I am trying to do a simple post for a login screen. I post an email address and password. This gives me a JSON back with status-codes. If this code is 200 it also contains a person object. If it is something else it contains an error object. I have this code for posting. RKObjectManager *manager = [RKObjectManager managerWithBaseURL:[NSURL URLWithString:@"http://******.com.be/nl/webservice/company-user/login/apikey/key**"]]; NSDictionary *dictionary = @{ @"email": _txtLogin.text, @"pwd":

RestKit: Creating stubs for foreign key relationships

烂漫一生 提交于 2019-12-22 08:13:04
问题 I am struggling to map the foreign key relationships returned by my JSON API with RestKit. Specifically, I use Loopback to generate an API with Entities like Team and User . There are two Endpoints by default that return the following JSON: /Teams/ [ { "title": "Team Title", "id": 1, } ] /Users/ [ { "name": "Alice", "id": 1, "teamId": 1, }, { "name": "Bob", "id": 2, "teamId": 1, }, ... ] Now this is a pretty simple API, right? It should be easy to map with RestKit, but even after reading all

Where to put object mappings (in RestKIt)

偶尔善良 提交于 2019-12-22 05:53:39
问题 As I don't want to hijack another thread here comes my question about mappings. First read: Where's the best place to put object mappings in RestKit I'm sure that the answer Blake Waters gave will probable be very correct as he is a much smarter and more experienced guy than I am, but to me logic tells me to put the mapping in each model: if you change something in your model, you're just a scroll away to change your mappings. In my AppDelegate I would then just call the initMappings (or

Restkit: Post Json Array and Map response to Managed Objects

為{幸葍}努か 提交于 2019-12-21 23:19:05
问题 Here is my setup, Post a list of objects in Json to server and got back with updated results that will be mapped to core data and updated. -- Post Boday -- { "memberId": "1000000", "contacts": [ { "phoneNumber": "+12233333333", "firstName": "john", "lastName": "H" }, { "phoneNumber": "+12244444444", "firstName": "mary", "lastName": "K" } ] } -- Post Response -- { "contacts": [ { "phoneNumber": "+12233333333", "firstName": "john", "lastName": "k", "isMember": "yes" }, { "phoneNumber": "

RestKit: how to remove core data entries to keep the content in sync with the server?

旧街凉风 提交于 2019-12-21 13:35:30
问题 I'm using the RestKit RKObjectManager to get data from my server and store in core data (see my other post) I want to configure the deletion behavior of the old entries left in the database. I saw there's a deletionPredicate property in the RKEntityMapping class but I understand that it is used only when the service actually returns the objects to be deleted flagged as 'to-be-deleted'. (am I right?) In my case when some objects have to be deleted, they're just NOT returned by the server and I

why is RestKit changing my response content-type?

↘锁芯ラ 提交于 2019-12-21 12:29:33
问题 In short: I try to fetch data form the server with the content-type of the http request header set as @"text/html .. but for some reason RestKit changes that to application/JSON Explanation: If I were to make this request using just AFNetworking.. things work like a charm.. this is what my AFNetworking code looks like: AFHTTPClient *client = [AFHTTPClient alloc] initWithBaseURL: [NSURL URLWithString:kApiBaseUrl]]; singleton.parameterEncoding = AFJSONParameterEncoding; [singleton