ios - RestKit 2 PUT request for some Object -
The server team wants to isolate 2 PUT requests for an item class like this -
< Code> PUT '& lt; Server & gt; / Item /: itemId / like '' & lt; Server & gt; / item /: itemId 'and
code>
I'm using the following code in the initiator:
RKObjectManager * sharedRKObjectManager = [RKObjectManager sharedManager]; RKManagedObjectStore * Managed Obsoststore = [sharedRKObjectManager Managed ObjectStore]; // Create Mapping for News Unit RKIntmapping * Response Mapping = [RKIntipmapping MappingForrentFormName: Managed ObjectStore: Managed Obsoststore in ENTITIM]; [ResponseMapping addAttributeMappingsFromDictionary: @ {@ "ID": @ "ItemID",}]; // Create a response descriptor and add it to the RKObjectManager object. RKResponseDescriptor * responseDescriptor = [RKResponseDescriptor responseDescriptorWithMapping: responseMapping method: RKRequestMethodAny pathPattern: UPDATE_ITEM_URL mainpath: statusCodes zero: RKStatusCodeIndexSetForClass (RKStatusCodeClassSuccessful)]; [SharedRKObjectManager.router.routeSet addRoute: [RKRoute routeWithClass: [item class] pathPattern: UPDATE_ITEM_URL Method: RKRequestMethodAny]]; [SharedRKObjectManager addResponseDescriptor: Response Descriptor];
And then the following call is:
+ (zero) Update ITEM: (item *) Paramas with items: (NSDictionary *) parameter success: (Zero (^) (RKObjectRequestOperation * operation, RKMappingResult * mappingResult)) Success failure: (Zero (^) (RKObjectRequestOperation * operation, NSError * error)) Failure {[CMLRK SharedManager setUpHeaders]; [[RK Object Manager Shared Manager] putObject: Item Path: Zero Parameter: Parameter Success: Success Failure: Failure]; }
My question is - can I use the same work for these 2 requests? Can I add the URL in some other way?
TIA!
Do not use
RKRoute in this case when you enter
Are ... . Pay attention to
carefully, note that you should also have 2 response descriptors because the path patterns are different.
Comments
Post a Comment