restkit-0.20

RestKit: mapping JSON array of strings

人盡茶涼 提交于 2019-12-12 07:12:41
问题 Given the following JSON: { "someKey":"someValue", "otherKey":"otherValue", "features":[ "feature1", "feature2", "feature3" ] } I am mapping this JSON into NSManagedObject s with RKMapperOperation and RKEntityMapping (in this example I would have 2 entity mappings: one for the top level object and another one for my Feature class). The top level object mapping is trivial: two attribute mappings plus a relationship one(features) for the relation with Feature. My question is,how to map the

Restkit property mapping Failed Transformation error

懵懂的女人 提交于 2019-12-12 02:45:15
问题 this is what my sample code looks like: { "name": "Ahmad Mansour", "subjects": [ { "parent_subject_name": "Arabic", "subject_name": "Shafahi", "exams": [ { "score": "30.00", "exam_name": "Sa3i 1 " }, { "score": "50.00", "exam_name": "sa3i 2" }, { "score": "100.00", "exam_name": "First Semester Exam" } ] }, { "parent_subject_name": "Arabic", "subject_name": "Khati", "exams": [ { "score": "50.00", "exam_name": "Sa3i 1 " }, { "score": "60.00", "exam_name": "sa3i 2" }, { "score": "95.00", "exam

Map upper keypath to lower keypath mapping attribute RESTKIT V0.20

馋奶兔 提交于 2019-12-11 22:17:40
问题 "Allocation":{ "UserID":"8bc2df34-b77a-4889-a2ab-559e24cc2d40", "Answers": { "SurveyInstanceAnswerID":"cb924a6a-ad61-4786-b5fb-00302c4fc7dc", "SurveyInstanceAllocationID":"42e96cec-5a00-416c-8a96-488ab152e4f5", "AllocationUniqueRef":"1ce53cdf-b33e-4594-a938-b60656b8b64c", "SurveyContentID":"ccd07464-9718-4953-8e51-ad25fa00e053", "AnswerValue":null, } } I have two classes Allocation with userID and answer with answervalue and userID . I want to map userid present in allocations with userid in

Restkit not work on iOS 7

孤人 提交于 2019-12-11 20:48:02
问题 I'm using the restkit to make the request that returns JSON Data. It worked fine on iOS 6 but when i built the app on XCode 5 + iOS 7, it cannot get the response data. [objectManager getObjectsAtPath:path parameters:nil success:^(RKObjectRequestOperation * operation, RKMappingResult *mappingResult){ } failure:^(RKObjectRequestOperation * operation, NSError *error) { //always run to this block }]; Here's the error log: E restkit.network:RKObjectRequestOperation.m:575 Object request failed:

RestKit 0.20 Post Array Json issues

只愿长相守 提交于 2019-12-11 19:17:15
问题 This is the json that I need to post to services. { "deviceToken":"asdfasdfasdf", "alarm": [ { "start" "8:30", "end": "9:30", "line": "156", "code": "xxxafsdfasdf", "station": "asdfa", "stationLeft": 5, "available": true, "times": 2 }] } The response data just have one more field "id" in alarm: { "deviceToken":"asdfasdfasdf", "alarm": [ { "id":1, "start" "8:30", "end": "9:30", "line": "156", "code": "xxxafsdfasdf", "station": "asdfa", "stationLeft": 5, "available": true, "times": 2 }] } Then

RestKit: Intersect database seeding or where is didSeedObject in RestKit > 0.20?

ぃ、小莉子 提交于 2019-12-11 18:34:40
问题 I am updating a function to seed a database with a RestKit version < 0.10. There is a didSeedObject method to intersect the seeding. In my code it is used to map a relationship by primary / foreign key. In RestKit > 0.20 the seeding code has changed. There is now a RKManagedObjectImporter to do this. My question is: How can I intersect the seeding so I can create the relationship in the same kind of way it was done with didSeedObject ? EDIT : Since didSeedObject or a way to intersect the

Relationship between RKObjectMapping and RKEntityMapping

你离开我真会死。 提交于 2019-12-11 10:32:22
问题 Say I have JSON like this: { "hits": 4056, "books": [ { "name": "Book 1" }, { "name": "Book 2" }, { "name": "Book 3" } ] } I would like to map this response to BooksResponse object: @interface BooksResponse @property (nonatomic, assign) NSInteger hits; @property (nonatomic, strong) NSArray* books; @end Where books property is an array of CoreData Book objects. I'm using RKObjectEntity to map BooksResponse like this: RKObjectMapping* booksResponseMapping = [RKObjectMapping mappingForClass:

Restkit : multipartFormRequestWithObject not json

╄→尐↘猪︶ㄣ 提交于 2019-12-11 08:37:30
问题 I am using RestKit 2.0 to send a core data entity and an image to a server with the 'multipartFormRequestWithObject' method. However, when the entity data arrives it is not in json format. If I send the entity using 'postObject' without an image then the data is in json format. I use the same RKObjectMapping for both situations. What do I have to do to make the Object serialize to json? I tried [request setValue:@"application/json" forHTTPHeaderField:@"content-type"]; But that didn't help and

converting NSArray to RLMArray with RKValueTransFormer fails converting outputValue to AutoreleasingUnsafeMutablePointer<AnyObject?>

五迷三道 提交于 2019-12-11 06:02:58
问题 I am using RestKit and realm.io together. I have an array of values (the array is url strings of pictures) being returned in JSON that should become a RLMArray of RLMObject s. I believe the mappings are set up correctly because it makes an attempt to convert the results to an RLMArray . But I get the following error from RestKit: restkit.object_mapping:RKMappingOperation.m:449 Failed transformation of value at keyPath 'picList' to representation of type 'RLMArray': Error Domain=org.restkit

Delete CoreData objects after POST request

点点圈 提交于 2019-12-11 05:14:25
问题 I'm using RestKit 0.20.3 with CoreData to cache the results from my web services. I need to delete from CoreData all the objects that are not in the response so I use [RKObjectManager addFetchRequestBlock] . Everything works fine when I do GET requests but when I do POST requests the objects are not deleted in CoreData, I think because deleteLocalObjectsMissingFromMappingResult is done only with GET requests. I understand that, in a RESTfull architecture, POST requests are used to update an