0
我是新手到iOS
,我想執行一個初始屏幕和加載數據從數據庫然後傳輸到另一視圖控制器在UITableView
這裏是顯示數據我的代碼***終止應用程序由於未捕獲的異常「NSInvalidArgumentException」,
#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
運行
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason:
'-[SplashViewController pushToSessionTableViewController:]: unrecognized selector sent
to instance 0x6e45740'
任何建議時,我得到了以下錯誤???
抱歉,但沒有奏效 – 2012-08-15 23:32:38
是否拋出同樣的異常? – ohr 2012-08-15 23:34:36
否.............. – 2012-08-15 23:35:11