Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8347347
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T07:20:15+00:00 2026-06-09T07:20:15+00:00

I’m an asp.net developer and starting to learn objective c. Been struggling for days

  • 0

I’m an asp.net developer and starting to learn objective c. Been struggling for days to find a fix for this:

I’m completely new to ios development so forgive me if my question sound stupid.

I have 2 table view controllers:

AnnouncementsTableViewController and NewsTableViewController.

For each of these controllers Im calling a web service using rest kit:
Here’s my code in NewsTableViewController

- (void)viewDidLoad
{
[super viewDidLoad];
[self sendRequest];

}
- (void)sendRequest
{

//set the base URL
RKURL *baseURL = [RKURL URLWithBaseURLString:@"http://someurl.com/WcfDataService.svc"];
NSString *format=@"json";
NSString *un = @"blah";
NSString *pw = @"blah";

RKObjectManager *objectManager1 = [RKObjectManager objectManagerWithBaseURL:baseURL];
objectManager1.client.baseURL = baseURL;


NSDictionary *queryParams;
queryParams = [NSDictionary dictionaryWithObjectsAndKeys:format,@"format", nil];

objectManager1.client.username=un;
objectManager1.client.password=pw;

//set news mapping

RKObjectMapping *newsMapping = [RKObjectMapping mappingForClass:[News class]];


[newsMapping setSetDefaultValueForMissingAttributes:true]; 
[newsMapping mapKeyPath:@"NEWSTITLE" 
            toAttribute:@"name"]; 

[newsMapping mapKeyPath:@"NEWSBODY" 
            toAttribute:@"newsBody"]; 


 RKURL *newsURL = [RKURL URLWithBaseURL:[objectManager1 baseURL] resourcePath:@"/NEWS"   queryParameters:queryParams];


 [objectManager1 loadObjectsAtResourcePath:[NSString stringWithFormat:@"%@?$%@", [newsURL resourcePath], [newsURL query]] usingBlock:^(RKObjectLoader *loader) 

 {

     [loader.mappingProvider setObjectMapping:newsMapping forKeyPath:@"d"];

     loader.method = RKRequestMethodGET;

     loader.delegate = self;

     loader.userData=@"NewsData";
 }];

}

- (void)objectLoader:(RKObjectLoader *)objectLoader didFailWithError:(NSError *)error
{
NSLog(@"Error: %@", [error localizedDescription]);
}

- (void)request:(RKRequest*)request didLoadResponse:(RKResponse*)response {
NSLog(@"response code: %d", [response statusCode]);
}

- (void)objectLoader:(RKObjectLoader *)objectLoader didLoadObjects:(NSArray *)objects
{
NSString* source = (NSString*) objectLoader.userData;

NSLog(@"objects[%d]", [objects count]);
NSLog(@"%@", source);
data2 = objects;


 [self.tableView reloadData];

}

And I’m doing the exact same code as above on AnnouncementsViewController (just changing the base URL and mappings).

Problem is it only loads for the newstableviewcontroller and not on announcements.

I have read this https://github.com/RestKit/RestKit/wiki/Using-Multiple-Base-URLs-%28and-Multiple-Object-Managers%29

but cant seem to understand and apply on my code.

I hope someone can shed some light!

Best regards,
Rikuna

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T07:20:16+00:00Added an answer on June 9, 2026 at 7:20 am

    @PauldeLange thanks for taking time to respond. I’ve finally fixed it. This line is just what did the magic:

     RKObjectManager *objectManager =  [RKObjectManager sharedManager];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I want use html5's new tag to play a wav file (currently only supported
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
Seemingly simple, but I cannot find anything relevant on the web. What is the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.