애니메이션 :인식 할 수없는 선택기 인스턴스과 pushViewController로 전송 :이 문제를 해결하는 방법을 모른다
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[ViewController pushViewController:animated:]: unrecognized selector sent to instance 0x8e5fc70'
이 문제는 화면 타임 아웃에 연결되어 있습니다. 활동이없는 30 초 후, 내 앱은 로그인 화면으로 돌아 가야하며, 사용자가 다시 돌아 오면 다시 로그인해야합니다. 그리고 내 코드는 다음과 같습니다.
AppDelegate.h:
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
AppDelegate.m:
-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidTimeout:) name:kApplicationDidTimeoutNotification object:nil];
return YES;
}
-(void)applicationDidTimeout:(NSNotification *) notif
{
NSLog (@"time exceeded!!");
UIViewController *controller = [[UIStoryboard storyboardWithName:@"Main" bundle:NULL] instantiateViewControllerWithIdentifier:@"mainView"];
[(UINavigationController *)self.window.rootViewController pushViewController:controller animated:YES];
문제는이 코드의 마지막 줄에 있습니다. 내가 사용한이 코드 부분은 다음에서 가져온 것입니다. iOS perform action after period of inactivity (no user interaction)
입니다 스토리 보드에서 의미? 그렇게 보이지 않는다. – Larme
그래서 어떻게 바꿀 수 있습니까? – Tannis