2012-03-01 3 views
0

내 앱에 앱이 열려 있거나 백그라운드에서 잘 작동하는 로컬 알림이 있습니다. 그러나 앱과 알림 트리거를 완전히 닫으면 표시되지만 앱을 클릭하면 앱이 정지됩니다. 새보기를로드하지 않습니다. 앱이 처음 시작될 때로드되는 표준보기를로드하는 앱을 원합니다. 그러므로 나는 delegate.m 앱에 #import "ViewController.h"을 선언했다.didFinishLaunchingWithOptions에서 앱이 다운 됨

그러나
@implementation AppDelegate 

@synthesize window = _window; 

- (void)dealloc 
{ 
    [_window release]; 
    [super dealloc]; 
} 

ViewController *vc; 

- (BOOL)application:(UIApplication *)app didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 
    [_window addSubview:vc.view]; 
    [_window makeKeyAndVisible]; 

    return YES; 
} 

내가 알림 tiggers 후 응용 프로그램 (응용 프로그램이 닫힌 상태)를 클릭하면 앱이 있었다 그리고 나는 검은 화면을 수있는 마지막보기로 열립니다 : 그럼 다음이 죽음의. 어떤 도움이 필요합니까? 나는 그것을 이해할 수 없다. 나는 많은 것을 시도했다.

+0

'ViewController * vc;'와 (과)의 관계는 무엇입니까? 도대체 그게 뭐야? – Costique

답변

0
- (BOOL)application:(UIApplication *)app didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 
    ViewController *vc = [[[ViewController alloc] initWithNibName:@"ViewController" bundle:nil] autorelease]; 

    [_window addSubview:vc.view]; 
    [_window makeKeyAndVisible]; 

    return YES; 
} 
+0

'NSInternalInconsistencyException'이라는 캐치되지 않은 예외로 인해 앱 종료 중 : '번들로 NIB를로드 할 수 없습니다 :'NSBundle (loaded) 'with 이름 '의 ViewController' ' *** 먼저 던져 호출 스택 : (0x37c1f8bf 0x3776b1e5 0x37c1f7b9 0x37c1f7db 0x3193b747 0x318ab9cb 0x3178aea1 0x3170078b 0x29d7 0x316ff7eb 0x316f93bd 0x316c7921 0x316c73bf 0x316c6d2d 0x3794ddf3 0x37bf3553 0x37bf34f5 0x37bf2343 0x37b754dd 0x37b753a5 0x316f8457 0x316f5743 0x28e7 0x288c) 가 예외를 던지는라고 종료 (GDB) 코드를 사용할 때 얻을 수 있습니다. = ( – user1241757

관련 문제