2012-09-26 4 views
0

AppController에서 AppDelegate.m의 하나의 ViewController로 시간을 설정하고 아래의 메서드에 대한 메시지가 표시되어 내 App 추락했습니다. 인식 할 수없는 선택기가 인스턴스 0x6a0e360으로 전송되었습니다.하나의 ViewController에서 하나의 ViewController로 시간 설정

-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 
    [self performSelector:@selector(toSecondViewController:) withObject:nil afterDelay:5]; 
} 

-(void)toSecondViewController{ 
    SecondViewController *second = [[SecondViewController alloc] init]; 
    [self.navigationController pushViewController:sale animated:YES]; 
} 

왜 그런지 모르겠습니까? FUNC 어떤 매개 변수가되지 않을 경우

+0

오류 메시지와 스택 추적을 포함시키지 않으면 아마도 그 이유도 알 수 없습니다. – Jonah

+0

내 질문 업데이트 – Sovannarith

답변

2

시도 변화 코드

[self performSelector:@selector(toSecondViewController:) withObject:nil afterDelay:5]; 

[self performSelector:@selector(toSecondViewController) withObject:nil afterDelay:5]; 

에, 다음 "을 :"추가하지 마십시오 기호 FUNC 이름

+0

Oké, 지금 작동합니다. 정말 고마워요. – Sovannarith

1

후 만약 매개 변수를 보내려면 ":"만 추가해야합니다. 그렇지 않으면 추가 할 필요가 없습니다.

올바른 코드는 다음과 같습니다. -[self performSelector : @selector (toSecondViewController) withObject : nil afterDelay : 5];

관련 문제