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 8623011
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:11:04+00:00 2026-06-12T07:11:04+00:00

I’m working on this app, but somehow, its not returning any rows in my

  • 0

I’m working on this app, but somehow, its not returning any rows in my tableviewcontroller.
here is my code:

#define kBgQueue dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)
#define kStudentenURL [NSURL URLWithString:@"http://localhost/api/api.php"] 

#import "MasterViewController.h"

#import "DetailViewController.h"


@interface MasterViewController () {
    NSArray *_studenten; } @end

@implementation MasterViewController

- (void)awakeFromNib {
    [super awakeFromNib]; }

- (void)viewDidLoad {
    [super viewDidLoad];    // Do any additional setup after loading the view, typically from a nib.
    // The hud will dispable all input on the view (use the higest view possible in the view hierarchy)     HUD = [[MBProgressHUD alloc] initWithView:self.navigationController.view];  [self.navigationController.view addSubview:HUD];        // Regiser for HUD callbacks so we can remove it from the window at the right time  HUD.delegate = self;        // Show the HUD while the provided method executes in a new thread  [HUD showWhileExecuting:@selector(getJsonDataFromServer) onTarget:self withObject:nil animated:YES]; }

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated. }


-(void)getJsonDataFromServer {
    dispatch_async(kBgQueue, ^{
        NSData* data = [NSData dataWithContentsOfURL:
                        kStudentenURL];
        [self performSelectorOnMainThread:@selector(fetchedData:)
                               withObject:data waitUntilDone:YES];
    }); }

- (void)fetchedData:(NSData *)responseData {
    NSError* error;
    NSDictionary *json = [NSJSONSerialization
                          JSONObjectWithData:responseData                           
                          options:kNilOptions
                          error:&error];

    _studenten = [json objectForKey:@"studenten"];

    NSLog(@"Studenten: %@", _studenten);
    NSLog(@"%u", _studenten.count); }

#pragma mark - Table View

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1; }

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return _studenten.count; }

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath];

    NSDictionary *student = [_studenten objectAtIndex:0];

    NSString *studentNaam = [student objectForKey:@"studentNaam"];
    NSString *studentAchterNaam = [student objectForKey:@"studentAchterNaam"];

    cell.textLabel.text = studentAchterNaam;
    cell.detailTextLabel.text = studentNaam;


    return cell; }

/* // Override to support rearranging the table view.
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath { }
*/

/* // Override to support conditional rearranging of the table view.
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
    // Return NO if you do not want the item to be re-orderable.
    return YES; }
*/

/*- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    if ([[segue identifier] isEqualToString:@"showDetail"]) {
        NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
        NSDate *object = _objects[indexPath.row];
        [[segue destinationViewController] setDetailItem:object];
    } }*/

@end

I know my json is comming in correctly. the NSLogs are returning the data i ask, but i cant seem to get any rows. Can someone give me a hand? tnx

  • 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-12T07:11:06+00:00Added an answer on June 12, 2026 at 7:11 am

    Simple answer — you need to call [(your tableview) reloadData] once you’ve finished loading that data array!

    Presumably you’ve got your tableview on the storyboard right now, and you’ve set it’s datasource and delegate to your view controller. You will also need to have a property in your view controller to that tableview. You might have some code that looks like this.

    @interface MasterViewController () {
        NSArray *_studenten;
    }
    
    @property (weak, nonatomic) IBOutlet UITableView *tableView;
    
    @end
    
    @implementation MasterViewController
    - (void)fetchedData:(NSData *)responseData {
        NSError* error;
        NSDictionary *json = [NSJSONSerialization
                          JSONObjectWithData:responseData                           
                          options:kNilOptions
                          error:&error];
    
        _studenten = [json objectForKey:@"studenten"];
    
        NSLog(@"Studenten: %@", _studenten);
        NSLog(@"%u", _studenten.count);
        [self.tableView reloadData];
    }
    @end
    
    • 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 have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
This could be a duplicate question, but I have no idea what search terms
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into

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.