So I am trying to grab information in JSON from my rails app with RestKit
My code to do so is like so:
App Delegate
#implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
//Initialise RestKit
NSURL *URL = [NSURL URLWithString:#"https://myapp.dev"];
AFHTTPClient* client = [[AFHTTPClient alloc] initWithBaseURL:URL];
//Enable Activity Indicator Spinner
[AFNetworkActivityIndicatorManager sharedManager].enabled = YES;
[client setDefaultHeader:#"Accept" value:RKMIMETypeJSON];
RKObjectManager *objectManager = [[RKObjectManager alloc] initWithHTTPClient:client];
RKObjectMapping *eventMapping = [RKObjectMapping mappingForClass:[Info class]];
[infoMapping addAttributeMappingsFromDictionary:#{
#"sample":#"sample",
#"sample_1":#"sample_1"
}];
RKResponseDescriptor *infoDescriptor = [RKResponseDescriptor responseDescriptorWithMapping:infoMapping
pathPattern:#"/info"
keyPath:nil
statusCodes:RKStatusCodeIndexSetForClass(RKStatusCodeClassSuccessful)];
[objectManager addResponseDescriptor:infoDescriptor];
}
View File
- (void)loadInfo
{
RKObjectManager *objectManager = [RKObjectManager sharedManager];
[objectManager getObjectsAtPath:#"/info"
parameters:nil
success:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult) {
NSArray *info = [mappingResult array];
NSLog(#"Loaded info: %#", info);
_info = info;
} failure:^(RKObjectRequestOperation *operation, NSError *error) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:#"Error getting into"
message:[error localizedDescription]
delegate:nil
cancelButtonTitle:#"OK"
otherButtonTitles:nil];
[alert show];
NSLog(#"Hit error: %#", error);
}];
}
The problem is. On the log output, RestKit tells me it maps everything successfully. But then when I attempt to view the object with both the method to log in the view file and with the debugger using po I get the following
374 Finished performing object mapping. Results: {
"<null>" = "<Info: 0xa291b30>";
}
I can't view the object and with breakpoints it shows up as:
I've been struggling with this for a few days and I'm not sure what else to try. Any help would be greatly appreciated
I ran into a similar problem. I'm not too sure why, but when I did the following it fixed it.
- (void)loadInfo
{
RKObjectManager *objectManager = [RKObjectManager sharedManager];
[objectManager getObjectsAtPath:#"/info"
parameters:nil
success:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult) {
NSArray *info = [mappingResult array];
NSLog(#"Loaded info: %#", info);
_info = info;
} failure:^(RKObjectRequestOperation *operation, NSError *error) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:#"Error getting into"
message:[error localizedDescription]
delegate:nil
cancelButtonTitle:#"OK"
otherButtonTitles:nil];
[alert show];
NSLog(#"Hit error: %#", error);
}];
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
//Initialise RestKit
NSURL *URL = [NSURL URLWithString:#"https://myapp.dev"];
AFHTTPClient* client = [[AFHTTPClient alloc] initWithBaseURL:URL];
//Enable Activity Indicator Spinner
[AFNetworkActivityIndicatorManager sharedManager].enabled = YES;
[client setDefaultHeader:#"Accept" value:RKMIMETypeJSON];
RKObjectManager *objectManager = [[RKObjectManager alloc] initWithHTTPClient:client];
RKObjectMapping *eventMapping = [RKObjectMapping mappingForClass:[Info class]];
[infoMapping addAttributeMappingsFromDictionary:#{
#"sample":#"sample",
#"sample_1":#"sample_1"
}];
RKResponseDescriptor *infoDescriptor = [RKResponseDescriptor responseDescriptorWithMapping:infoMapping
pathPattern:#"/info/:id"
keyPath:nil
statusCodes:RKStatusCodeIndexSetForClass(RKStatusCodeClassSuccessful)];
[objectManager addResponseDescriptor:infoDescriptor];
}
When you load an object representation that does not have a nesting keyPath, RestKit stores the mapped objects under the [NSNull null] key within the dictionary (since nil is not a valid dictionary key). You can retrieve the mapping results either by calling firstObject, array, or dictionary on the RKMappingResult object to access the mapped objects.
I see a follow-up question about mapping an array to a single object... what does your JSON look like and how are you trying to represent it?
RKResponseDescriptor *infoDescriptor = [RKResponseDescriptor responseDescriptorWithMapping:infoMapping
pathPattern:nil
keyPath:nil
statusCodes:RKStatusCodeIndexSetForClass(RKStatusCodeClassSuccessful)];
Related
I am developing iPhone application and using Restkit for consuming services and put data on server. I am working with Restkit first time. I want to put data on server then I implemented the restkit put method, and it executed successfully and getting response "SUCCESS" but when I retrieving data then it doesn't affecting data means not getting last put data on server. So can anybody tell me what is wrong with this?? I used the following code I used :
////Response Mapping values
RKObjectMapping *responseMapping = [RKObjectMapping mappingForClass:[NSMutableArray class]];
[responseMapping addAttributeMappingsFromArray:#[#"SenderId", #"SentDate", #"Status",#"GroupId", #"Message"]];
//Request Mapping values
RKObjectMapping *requestMapping = [RKObjectMapping requestMapping]; // objectClass == NSMutableDictionary
[requestMapping addAttributeMappingsFromArray:#[#"SenderId", #"SentDate", #"Status",#"GroupId", #"Message"]];
ITRestKitServices *restkitService = [[ITRestKitServices alloc] initWithDelegate:self];
[restkitService putDataONserverBulletin:bulletinMutableArray pathPattern:#"bulletin" keyPath:#"" userName:appDelegate.user.Email password:appDelegate.user.SessionToken requestMapping:requestMapping responseMapping:responseMapping];
// And following code to put data on server in service I used:
// initialize AFNetworking HTTPClient
NSURL *baseURL = [NSURL URLWithString:BASE_URL_STRING];
AFHTTPClient *client = [[AFHTTPClient alloc] initWithBaseURL:baseURL];
[client setAuthorizationHeaderWithUsername:userName password:password];
//set pathPattern
NSString *path = [NSString stringWithFormat:#"%#/%#",BASE_PATH_STRING,pathPattern];
//StatusCodes
NSIndexSet *statusCodes = RKStatusCodeIndexSetForClass(RKStatusCodeClassSuccessful);
//Request Descriptor
RKRequestDescriptor *requestDescriptor =
[RKRequestDescriptor requestDescriptorWithMapping:requestMapping
objectClass:[Bulletin class]
rootKeyPath:nil
method:RKRequestMethodPUT];
//Response Descriptor
RKResponseDescriptor *userResponseDescriptor =
[RKResponseDescriptor responseDescriptorWithMapping:responseMapping
method:RKRequestMethodPUT
pathPattern:path
keyPath:keyPath
statusCodes:statusCodes];
RKObjectManager *objectManager = [[RKObjectManager alloc] initWithHTTPClient:client];
[objectManager addRequestDescriptor:requestDescriptor];
[objectManager addResponseDescriptor:userResponseDescriptor];
AppDelegate *appDelegate = (AppDelegate *) [[UIApplication sharedApplication] delegate];
if(appDelegate.isLoading == NO)
{
[appDelegate startLoading];
}
[objectManager putObject:dataObject
path:path
parameters:nil
success:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult)
{
NSLog(#"Bulletin Success");
}
failure:^(RKObjectRequestOperation *operation, NSError *error)
{
if(appDelegate.isLoading == YES)
{
[appDelegate stopLoading];
}
NSLog(#">>> Error: %#", error);
}];
I have an API that I'm querying where when I query for a list of organizations I get an array of:
{
id: integer,
name: string
}
But I am also able to get details on each organization which returns a single object like:
{
id: integer,
name: string,
description: text,
visit_count: integer,
image_url: string
}
How would I set up the object(s) in RestKit for this?
You need to setup the following:
The Object with all the elements you described in your second block
An object manager
RKObjectManager *objectManager = [RKObjectManager managerWithBaseURL:[NSURL URLWithString:YOUR HOST NAME]];
objectManager.requestSerializationMIMEType=RKMIMETypeJSON;
A mapping object with all the elements in your object
RKObjectMapping *mapping = [RKObjectMapping mappingForClass:[YOUR CLASS class]];
The mapping for your object
[mapping addAttributeMappingsFromArray:#[#"id",
#"name",
#"description",
#"visit_count",
#"image_url"
]];
A response descriptor
RKResponseDescriptor *responseDesciptor = [RKResponseDescriptor responseDescriptorWithMapping:mapping method:RKRequestMethodAny pathPattern:OBJECT URL keyPath:YOUR KEY PATH statusCodes:nil];
Add the response descriptor to the object manager
[objectManager responseDesciptor];
Now you can hit up the server
[[RKObjectManager sharedManager] postObject:nil path:OBJECT URL parameters:nil
success:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult) {
self.variable = [NSMutableArray arrayWithArray: mappingResult.array];
}
} failure:^(RKObjectRequestOperation *operation, NSError *error) {
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:#"An Error Has Occurred" message:[error localizedDescription] delegate:nil cancelButtonTitle:#"OK" otherButtonTitles:nil];
[alertView show];
}];
At the moment I'm struggling with the deletion of Orphaned objects.
I've the following classes.
MAPPER CLASS
In this class I create all my RKObjectManagers and use it in my other classes.
-(RKObjectManager *)mapAppointments{
RKEntityMapping* appointmentMapping = [RKEntityMapping mappingForEntityForName:#"Appointment" inManagedObjectStore:managedObjectStore];
appointmentMapping.identificationAttributes = #[#"app_id",#"app_start"] ;
[appointmentMapping addAttributeMappingsFromDictionary:#{
#"AddressInfo": #"app_addressinfo",
#"Completed": #"app_completed",
#"Description": #"app_description",
#"EndDate":#"app_end",
#"FullDay": #"app_fullday",
#"Id":#"app_id",
#"Label": #"app_label",
#"LabelId": #"app_label_id",
#"Location": #"app_location",
#"Private":#"app_private",
#"ProjectName":#"app_project_name",
#"ProjectNumber": #"app_project_number",
#"RecurrenceInfo": #"app_recurrenceInfo",
#"RelationAddressCity": #"app_relation_address_city",
#"RelationAddressId":#"app_relation_address_id",
#"RelationAddressName": #"app_relation_address_name",
#"RelationAddressStreet":#"app_relation_address_street",
#"RelationCode": #"app_relation_code",
#"RelationContactPersonId": #"app_relation_contact_id",
#"RelationContactPersonName": #"app_relation_contact_name",
#"RelationName":#"app_relation_name",
#"ReminderInfo":#"app_reminder_info",
#"StartDate": #"app_start",
#"State": #"app_state",
#"Subject": #"app_subject",
#"SupplierCode":#"app_supplier_code",
#"SupplierContactPersonId": #"app_supplier_contact_person_id",
#"SupplierContactPersonName":#"app_supplier_contact_person_name",
#"SupplierName": #"app_supplier_name",
#"Type": #"app_type",
#"ResxPers":#"app_resxPers",
}];
RKResponseDescriptor *responseDescriptor = [RKResponseDescriptor responseDescriptorWithMapping:appointmentMapping pathPattern:nil keyPath:#"" statusCodes:[NSIndexSet indexSetWithIndex:200]];
NSArray *arrResponsDescriptor = [[NSArray alloc]initWithObjects:responseDescriptor,nil];
[objectManager addResponseDescriptorsFromArray:arrResponsDescriptor];
return objectManager;
}
WEBSERVICE CLASS
In this class I do my request and also try to delete the Orphaned objects.
-(void)fetchAppointmentsOnCompletionFor:(NSDate *)start andEnd:(NSDate *)end OnCompletion:(myCompletion) compblock{
Mapper *mapper = [Mapper new];
RKManagedObjectStore *store = [[AdsolutDataModel sharedDataModel] objectStore];
NSLog(#"store is %#",store);
NSManagedObjectContext *context = store.mainQueueManagedObjectContext;
RKObjectManager *objectManager = [mapper mapAppointments];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc]init];
[dateFormatter setTimeZone:[NSTimeZone defaultTimeZone]];
[dateFormatter setDateFormat:#"dd-MM-yyyy"];
NSString *strStart = [dateFormatter stringFromDate:start];
NSString *strEnd = [dateFormatter stringFromDate:end];
NSString *userName = [[NSUserDefaults standardUserDefaults]valueForKey:#"userName"];
NSString *hash = [[NSUserDefaults standardUserDefaults]valueForKey:#"hash"];
NSString *urlString = [NSString stringWithFormat:#"getcrmappointments?gebrcode=%#&token=%#&startdate=%#&enddate=%#",userName,hash,strStart,strEnd];
[objectManager addFetchRequestBlock:^NSFetchRequest *(NSURL *URL) {
RKPathMatcher *pathMatcher = [RKPathMatcher pathMatcherWithPattern:urlString];
NSDictionary *argsDict = nil;
BOOL match = [pathMatcher matchesPath:[URL relativePath] tokenizeQueryStrings:NO parsedArguments:&argsDict];
if (match) {
NSFetchRequest *fetchRequest = [NSFetchRequest fetchRequestWithEntityName:#"Appointment"];
fetchRequest.predicate = [NSPredicate predicateWithFormat:#"(app_start >= %#) AND (app_end <= %#)", start,end]; // NOTE: Coerced from string to number
fetchRequest.sortDescriptors = #[ [NSSortDescriptor sortDescriptorWithKey:#"app_id" ascending:YES] ];
return fetchRequest;
}
return nil;
}];
NSURLRequest *request = [objectManager requestWithObject:nil method:RKRequestMethodGET path:urlString parameters:nil];
RKManagedObjectRequestOperation *operation = [objectManager managedObjectRequestOperationWithRequest:request managedObjectContext:context success:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult) {
NSLog(#"REQUEST URL = %#",request.URL);
NSError *error = nil;
BOOL success = [context save:&error];
if (!success) RKLogWarning(#"Failed saving managed object context: %#", error);
NSLog(#"SUCCESS");
NSError *saveError = nil;
for (Appointment *appointment in mappingResult.array) {
NSLog(#"Appointment title is %#",appointment.app_subject);
appointment.synchronized = #1;
appointment.app_delete = #0;
[context saveToPersistentStore:&saveError];
}
[self fetchAfwezighedenOnCompletionFor:start andEnd:end OnCompletion:^(BOOL finished) {
if(finished){
compblock(YES);
}
}];
} failure:^(RKObjectRequestOperation *operation, NSError *error) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:#"Error"
message:[error localizedDescription]
delegate:nil
cancelButtonTitle:#"OK"
otherButtonTitles:nil];
[alert show];
NSLog(#"Hit error: %#", error);
}];
[objectManager enqueueObjectRequestOperation:operation];
}
PROBLEM
At the moment, the Orphaned objects are not deleted. Am I doing somehting wrong or is something not setup right ?
Thanks for the help !
Looking at the code for RKObjectManager managedObjectRequestOperationWithRequest: shows that the fetch request blocks are passed from the object manager passed to the operation. So, debugging would be required to work out why it wasn't called. It should be called in all 'success' scenarios (i.e. ones where a response descriptor matches the received response).
You could look at using the manager to make the request instead of getting a request and using RKManagedObjectRequestOperation, but in theory this should simply be less code to write rather than a functional difference.
Try changing the fetch request block:
RKPathMatcher *pathMatcher = [RKPathMatcher pathMatcherWithPattern:#"getcrmappointments"];
Hello and thanks in advance for your help. I've been looking but couldn't find an answer for this. I've only been programing for iOS for a week.
So far, all the connections to the web services are functioning and I've created a class and methods to do those calls. I'm making a standard login, user enters login info, the app passes those values to the web service and it returns a bool value depending if the info matches anything on the database. After that, the app gets the return value and it moves to the next screen or shows an error alert. Or at least that's what I'm aiming for.
The problem is that, the conditional is being executed before the rest call is made or the response parsed and I'm not having much luck finding a solution. I've read about asynchronous and synchronous calls but hadn't have much luck at implementing them.
This is the call code:
//Class that has the methods for calling the web services
__restObj = [[restCalls alloc] init];
bool login = [__restObj restLogin:user passwd:pass];
if (login) {
[self performSegueWithIdentifier:#"adminLogin" sender:self];
}
else{
UIAlertView*alert = [[UIAlertView alloc] initWithTitle:#"Error" message:#"Incorrect group name or password." delegate:self cancelButtonTitle:#"Ok" otherButtonTitles:nil, nil];
[alert show];
}
The conditional in being performed before the actual POST occurs and there for is always false.
This is my method:
- (bool)restLogin:(NSString*)user passwd:(NSString*)pass{
// Load the object model via RestKit
RKObjectManager *objectManager = [RKObjectManager sharedManager];
groupInfo *gi = [[groupInfo alloc] init];
gi.gName = user;
gi.pass = pass;
RKObjectMapping *userInfoMapping = [RKObjectMapping requestMapping];
[userInfoMapping addAttributeMappingsFromDictionary:#{#"gName": #"groupName",#"pass":#"pass"}];
RKRequestDescriptor *requestDescriptor = [RKRequestDescriptor requestDescriptorWithMapping:userInfoMapping
objectClass:[groupInfo class]
rootKeyPath:nil];
[objectManager addRequestDescriptor:requestDescriptor];
objectManager.requestSerializationMIMEType = RKMIMETypeJSON;
[objectManager postObject:gi
path:#"adminLoginIos"
parameters:nil
success:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult) {
NSArray* statuses = [mappingResult array];
NSLog(#"Loaded statuses: %#", statuses);
_result = [statuses objectAtIndex:0];
}
failure:^(RKObjectRequestOperation *operation, NSError *error) {
NSLog(#"Hit error: %#", error);
}
];
return _result;
}
Thanks in advance and keep in mind that I'm really new at this so I appreciate your help and if my code is not the best please tell me so.
Regards,
ChmlGr
You need to pass in a block and then inside the success callback, block return the _result.
An example based on your structure would be something like:
-(void) restLogin:(NSString*)user passwd:(NSString*)pass block:(void (^)(id))block {
// Load the object model via RestKit
RKObjectManager *objectManager = [RKObjectManager sharedManager];
groupInfo *gi = [[groupInfo alloc] init];
gi.gName = user;
gi.pass = pass;
RKObjectMapping *userInfoMapping = [RKObjectMapping requestMapping];
[userInfoMapping addAttributeMappingsFromDictionary:#{#"gName": #"groupName",#"pass":#"pass"}];
RKRequestDescriptor *requestDescriptor = [RKRequestDescriptor requestDescriptorWithMapping:userInfoMapping
objectClass:[groupInfo class]
rootKeyPath:nil];
[objectManager addRequestDescriptor:requestDescriptor];
objectManager.requestSerializationMIMEType = RKMIMETypeJSON;
[objectManager postObject:gi
path:#"adminLoginIos"
parameters:nil
success:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult) {
NSArray* statuses = [mappingResult array];
NSLog(#"Loaded statuses: %#", statuses);
_result = [statuses objectAtIndex:0];
block(_result);
}
failure:^(RKObjectRequestOperation *operation, NSError *error) {
NSLog(#"Hit error: %#", error);
block(nil);
}
];
}
Your call to that method would be something like:
[__restObj restLogin:user passwd:pass block:^(id obj) {
// do something here to translate that object into a BOOL and check value
}];
I don't use RestKit, so I can't verify this is exactly what you need, but it should get you on the right path. That said, if you wanted to check out AFNetworking, I wrote a NetworkClient wrapper that I don't mind sharing.
I just found out RestKit and it will be an important part of the app I'm doing. At the time, I was able to integrate it with the core data, but have not figured out the best way to send multiple GET requests.
What I need to do is:
Get data from the following addresses:
http://url.com/api/banner/
http://url.com/api/category/
http://url.com/api/link/
The URL will always be in the following format: http://url.com/api/SOMETHING/
Once all requests are finished, I would like to run a code (such as calling a new view controller). What would be the best way to do this?
At the moment, this is the code I'm using:
- (id)init
{
self = [super init];
if (self) {
[self setupConnector];
[self setupDatabase];
[self setupMappings];
[self sendRequests];
}
return self;
}
- (void)setupConnector
{
// Initialize RestKIT
RKObjectManager *objectManager = [RKObjectManager managerWithBaseURL:[NSURL URLWithString:#"http://baseURL"]];
self.managedObjectStore = [[RKManagedObjectStore alloc] initWithManagedObjectModel:[[NLCoreData shared] managedObjectModel]];
objectManager.managedObjectStore = self.managedObjectStore;
}
- (void)setupDatabase
{
NSString *storePath = [[NLCoreData shared] storePath];
NSError *error = nil;
NSPersistentStore *persistentStore = [self.managedObjectStore addSQLitePersistentStoreAtPath:storePath fromSeedDatabaseAtPath:nil withConfiguration:nil options:nil error:&error];
NSAssert(persistentStore, #"Failed to add persistent store with error: %#", error);
[self.managedObjectStore createManagedObjectContexts];
self.managedObjectStore.managedObjectCache = [[RKInMemoryManagedObjectCache alloc] initWithManagedObjectContext:self.managedObjectStore.persistentStoreManagedObjectContext];
}
- (void)setupMappings
{
RKObjectManager *objectManager = [RKObjectManager sharedManager];
// Mappings
// banner
RKEntityMapping *bannerMapping = [RKEntityMapping mappingForEntityForName:#"Banner" inManagedObjectStore:self.managedObjectStore];
[bannerMapping addAttributeMappingsFromDictionary:#{
#"title": #"title",
#"id": #"bannerID",
#"created_at": #"created_at",
#"image": #"image",
#"resource_uri": #"resource_uri",
#"updated_at": #"updated_at",
#"url": #"url"
}];
bannerMapping.identificationAttributes = #[ #"bannerID" ];
RKResponseDescriptor *bannerDescriptor = [RKResponseDescriptor responseDescriptorWithMapping:bannerMapping
pathPattern:#"/api/v1/banner/"
keyPath:#"objects"
statusCodes:RKStatusCodeIndexSetForClass(RKStatusCodeClassSuccessful)];
[objectManager addResponseDescriptor:bannerDescriptor];
// category
RKEntityMapping *categoryMapping = [RKEntityMapping mappingForEntityForName:#"Category" inManagedObjectStore:self.managedObjectStore];
[categoryMapping addAttributeMappingsFromDictionary:#{
#"name": #"name",
#"id": #"categoryID",
#"created_at": #"created_at",
#"resource_uri": #"resource_uri",
#"updated_at": #"updated_at",
#"active": #"active"
}];
categoryMapping.identificationAttributes = #[ #"categoryID" ];
RKResponseDescriptor *categoryDescriptor = [RKResponseDescriptor responseDescriptorWithMapping:categoryMapping
pathPattern:#"/api/v1/category/"
keyPath:#"objects"
statusCodes:RKStatusCodeIndexSetForClass(RKStatusCodeClassSuccessful)];
[objectManager addResponseDescriptor:categoryDescriptor];
}
- (void)sendRequests
{
RKObjectManager *objectManager = [RKObjectManager sharedManager];
// Send Request
[objectManager getObjectsAtPath:#"/api/v1/banner/" parameters:nil success:^(RKObjectRequestOperation * operation, RKMappingResult *mappingResult) {
NSLog(#"SUCCESS: %#", mappingResult.array);
} failure: ^(RKObjectRequestOperation * operation, NSError * error) {
NSLog(#"FAILURE %#", error);
}];
// category
[objectManager getObjectsAtPath:#"/api/v1/category/" parameters:nil success:^(RKObjectRequestOperation * operation, RKMappingResult *mappingResult) {
NSLog(#"SUCCESS: %#", mappingResult.array);
} failure: ^(RKObjectRequestOperation * operation, NSError * error) {
NSLog(#"FAILURE %#", error);
}];
}
Any tips?
The RestKit solution would be this: instead of using the convenience method ObjectManager::getObjectsAtPath you will have to init all of your RKObjectRequestOperations manually and then use ObjectManager::enqueueBatchOfObjectRequestOperations:progress:completion: method to enqueue them.
Alternatively, and I think this is actually easier and cleaner solution, use dispatch groups as described in the accepted answer to this question.
NSURL *url1 = [NSURL URLWithString:#"http://baseURL.domain/api/banner/"];
NSMutableURLRequest *request2 = [NSMutableURLRequest requestWithURL:url1];
RKObjectRequestOperation *objectRequestOperation1 = [[RKObjectRequestOperation alloc] initWithRequest:request2 responseDescriptors:#[ ResponseDescriptor ]];
NSURL *url2 = [NSURL URLWithString:#"http://baseURL.domain/api/category/"];
NSMutableURLRequest *request2 = [NSMutableURLRequest requestWithURL:url2];
RKObjectRequestOperation *objectRequestOperation2 = [[RKObjectRequestOperation alloc] initWithRequest:request2 responseDescriptors:#[ ResponseDescriptor ]];
NSArray *requestArray = [NSArray arrayWithObjects:objectRequestOperation,objectRequestOperation1,objectRequestOperation2, nil];
[[RKObjectManager sharedManager] enqueueBatchOfObjectRequestOperations:requestArray progress:^(NSUInteger numberOfFinishedOperations, NSUInteger totalNumberOfOperations) {
//
// Handle process indicator
//
NSLog(#"%lu",(unsigned long)totalNumberOfOperations);
} completion:^(NSArray *operations) {
//
// Remove blocking dialog, do next tasks
?