0
votes

i am newbie to iOS and i want to implement a splash screen and load the data from database then transmit to another view controller to display data in a UITableView here is my code

#import "SplashViewController.h"
#import "DataLoader.h"
#import "UISessionTable.h"
@interface SplashViewController ()  

@end
@implementation SplashViewController

@synthesize sessionsDataFromDatabase;





-(void) viewDidLoad{
    [super viewDidLoad];

   double  currentTime = [[NSDate date] timeIntervalSince1970];

    dispatch_queue_t downloadQueue = dispatch_queue_create("session data loader", NULL);
    dispatch_async(downloadQueue, ^{
        //code to load session into array

        self.sessionsDataFromDatabase = [DataLoader getSessions]; 
        dispatch_async(dispatch_get_main_queue(), ^{




            double differance = 5000.0 - ([[NSDate date] timeIntervalSince1970] - currentTime) ;


            differance = differance<0? 0:differance;

            [[NSTimer scheduledTimerWithTimeInterval: differance target:self
                                                              selector: @selector(pushToSessionTableViewController:) userInfo: nil repeats: NO]fire];

                    });
    });
    dispatch_release(downloadQueue);


}
-(void) viewDidUnload{
    [super viewDidUnload];
    self.sessionsDataFromDatabase = nil;
}
-(void) pushToSessionTableViewController{


    UISessionTable * obj = [[UISessionTable alloc]init ];

    [obj setSessionsData:self.sessionsDataFromDatabase];


    [self.navigationController pushViewController:obj animated:YES];



}
@end

i got the following error when run

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 
'-[SplashViewController pushToSessionTableViewController:]: unrecognized selector sent 
to instance 0x6e45740'

any suggestion ???

1

1 Answers

2
votes

The colon at the end is for methods that receive parameters, yours doesn't receive anything. That's why it can't find the method (it assumes it is another undeclared method).

Replace

pushToSessionTableViewController:

with

pushToSessionTableViewController