restkit

Serialize nested image in RestKit (Rails Backend)

爱⌒轻易说出口 提交于 2019-12-11 13:11:46
问题 Here's what I'm getting: food_name_token Pizza id 1 category_id 1 review {"note"=>"tasty!", "image"=>"<RKParamsAttachment: 0x7834500>"} And this is what I'm expecting: food_name_token Pizza id 1 category_id 1 review {"note"=>"tasty!", "image"=>{"filename"=>"image", "type"=>"image/png", "name"=>"image", "tempfile"=>"#", "head"=>"Content-Disposition: form-data; name=\"image\"; filename=\"image\"\r\nContent-Type: image/png\r\n"}} I'm using Restkit and I'm trying to serialize my data on the

Targeting JSON internal array data and using RKValueTransformer in RestKit

元气小坏坏 提交于 2019-12-11 11:41:14
问题 I'm using RestKit on iOS to retrieve some data from kraken.com I have the following JSON data: { "error":[], "result":{ "XXBTZUSD":{ "a":["475.00000","1"], "b":["465.00639","2"], "c":["475.00000","0.01000389"], "v":["1.01078477","1.01078477"], "p":["475.00008","475.00008"], "t":[6,6], "l":["475.00000","475.00000"], "h":["475.00013","475.00013"], "o":"475.00001" } } } My keyPath is @"result.XXBTZUSD" and I'm interested in the first member of the array in each property, i.e. 'a' , 'b' , 'c' ,

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

Restkit: GET remote linked object when foreign key refers to missing local object in Core Data

烂漫一生 提交于 2019-12-11 08:01:25
问题 I cannot figure out if Restkit is able to download an object not present locally, in particular when a foreign key is referring to that missing object in a to-one relationship in Core Data. Take the following example: - contact 1 refers to company 2 contact 1 is present in the local db but company 2 is not when in the UI the user inspects the details of contact 1, then a GET for the contact 1 is performed the GET returns a JSON containing among other contact details the property company_id =

RestKit multiple RKObjectManagers object mapping

僤鯓⒐⒋嵵緔 提交于 2019-12-11 07:36:46
问题 I'm using two RKObjectManagers, one without an RKManagedObjectStore, (which is the shared instance) and one with. When I attempt to set the RKManagedObjectStore like so: [self.storeBackedObjectManager setObjectStore:[RKManagedObjectStore objectStoreWithStoreFilename:@"conversations.sqlite"]]; I get the following error: *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '[RKObjectManager sharedManager].objectStore cannot be nil' It seems that RestKit is

RestKit 0.10.1: How do I create a new instance of an NSManagedObject subclass?

你说的曾经没有我的故事 提交于 2019-12-11 06:48:16
问题 I need to create a new instance of an NSManagedObject subclass, which I then intend to POST using - (void)postObject:(id<NSObject>)object usingBlock:(RKObjectLoaderBlock)block How do I create the object? Do I use this method?: + (id)insertNewObjectForEntityForName:(NSString *)entityName inManagedObjectContext:(NSManagedObjectContext *)context; If I am supposed to use insertNewObjectForEntityName , how do I get context ? 回答1: I figured it out myself. Say that my NSManagedObject subclass was

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

RKRoute with “/” as parameter doesn't work

妖精的绣舞 提交于 2019-12-11 05:43:48
问题 I'm trying to set up a RKRoute to get folder contents from the Dropbox API using RestKit. The URL to get the contents is https://api.dropbox.com/1/metadata/dropbox/<path> . So I set up the response and route like this: // objectManagers baseURL is @"https://api.dropbox.com/1/" RKResponseDescriptor *rootResponse = [RKResponseDescriptor responseDescriptorWithMapping:dynamicMapping pathPattern:@"metadata/dropbox:path" keyPath:nil statusCodes:RKStatusCodeIndexSetForClass

RestKit value transformer validation block not called

五迷三道 提交于 2019-12-11 05:27:54
问题 I'm using RestKit (the latest version 0.23.1), and I have defined a custom transformer between a string value to a number field as follows: mapping.valueTransformer = [RKBlockValueTransformer valueTransformerWithValidationBlock:^BOOL(__unsafe_unretained Class inputValueClass, __unsafe_unretained Class outputValueClass) { return [inputValueClass isSubclassOfClass:[NSString class]]; } transformationBlock:^BOOL(id inputValue, __autoreleasing id *outputValue, __unsafe_unretained Class outputClass

Getting Restkit tutorial code to work

余生长醉 提交于 2019-12-11 05:27:35
问题 I am relatively new to development on iOS and trying to get familiarized with RestKit, so bear with me if I am missing something obvious. We are developing an iOS 5 application that will receive and map JSON to objects (ARC is enabled, if it matters). In search of a tutorial for Restkit, I came across this one. However, a simplified version of the sample code there (the one in the "A real life example with RKClient" section) fails with the following error: 2012-01-14 22:15:55.124 Test