[英]*** Terminating app due to uncaught exception 'NSInvalidArgumentException',
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 我是iOS
新手,我想实现一个启动画面并从数据库加载数据,然后传输到另一个视图控制器,在UITableView
显示数据这里是我的代码
#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 ??? 任何建议???
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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.