2012-12-01 2 views
2

에서 NSLog을하려고 예기치 않은 동작 :IOS - 나는 내 수업에서이 설정을 가지고 didViewAppear

- (void)viewDidAppear:(BOOL)animated 
{ 
    NSLog(@"test"); 
    NSString *htmlFile = [[NSBundle mainBundle] pathForResource:@"get_business_ideas" ofType:@"html"]; 
    NSURL *url = [NSURL fileURLWithPath:htmlFile]; 
    NSURLRequest *rq = [NSURLRequest requestWithURL:url]; 
    [theWebView loadRequest:rq]; 
} 

NSLog 문은 결코 내 로그 화면에 나타납니다,하지만 코드의 나머지 부분이 있기 때문에 작동하는 것 같다 uiWebView는 렌더링을 수행합니다. 어떻게 될 수 있니? 그것은 새로운 프로젝트입니다, 그래서 아마도 로깅을 볼 수 있도록 뭔가를 설정해야합니까?

감사합니다.

UPDATE : 여기에 전체 파일입니다

#import "ViewController.h" 

@interface ViewController() 

@end 

@implementation ViewController 

- (void)viewDidAppear:(BOOL)animated 
{ 
    [super viewDidAppear:animated]; 

    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) 
    { 
     //load iphone image 
     UIImageView *imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"building"]]; 
     imgView.frame = self.view.bounds; // to set the frame to your view's size 
     [self.view addSubview:imgView]; 
     [self.view sendSubviewToBack:imgView]; 
    } 
    else 
    { 
     //load ipad image 
     UIImageView *imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"[email protected]"]]; 
     imgView.frame = self.view.bounds; // to set the frame to your view's size 
     [self.view addSubview:imgView]; 
     [self.view sendSubviewToBack:imgView]; 
    } 

    NSLog(@"2"); 
} 

- (void)viewDidLoad 
{ 
    [super viewDidLoad]; 
    // Do any additional setup after loading the view, typically from a nib. 
} 

- (void)didReceiveMemoryWarning 
{ 
    [super didReceiveMemoryWarning]; 
    // Dispose of any resources that can be recreated. 
} 

@end 
+1

수 : 하단 패널 (NOT 엑스 코드의 오른쪽 상단에있는 유사하게 보이는 버튼)에, 중간 표시 아이콘을 클릭하여 콘솔 섹션은 변수에 추가로 표시되고 있음을 다시 확인합니다 그 메소드에 중단 점을 두어 충돌이 발생했는지 확인합니다. 코드를 일시 중지 할 라인의 코드 왼쪽에있는 씬 (thin) 바로 가기를 클릭하십시오. 코드가 멈추지 않으면 그 메소드는 호출되지 않습니다. –

+0

정확히 이것을 넣고있는 곳은 어디입니까? – JoshRagem

+0

@Kris Gellci가 방금 해봤습니다. 코드는 거기에 도착하지만 로그는 결코 발생하지 않습니다. 어쩌면 로그 화면이 제대로 작동하지 않을 수 있습니까? – GeekedOut

답변

3

당신을위한 슈퍼 통화 수정이 추가합니까?

- (void)viewDidAppear:(BOOL)animated 
{ 
    [super viewDidAppear:animated]; 
    NSLog(@"test"); 
    NSString *htmlFile = [[NSBundle mainBundle] pathForResource:@"get_business_ideas" ofType:@"html"]; 
    NSURL *url = [NSURL fileURLWithPath:htmlFile]; 
    NSURLRequest *rq = [NSURLRequest requestWithURL:url]; 
    [theWebView loadRequest:rq]; 
} 

(이 방법에서 [슈퍼] 전화를 계속해야합니다 ... 여기에 귀하의 문제를 해결 끝 상관없이이 ...이 API 문서 당 필요한 것).

아래쪽 창을 표시했지만 디버그 메시지가 표시되지 않는다고 말씀하셨습니다.

Console

+0

@J Shapiro가 방금 시도했으나 작동하지 않았습니다. NSLog를 생각하지 않고 그냥 사용하는 또 다른 프로젝트가 있습니다.이 경우 잘못된 점이 무엇인지 모르겠습니다. – GeekedOut

+0

OP 로그에 영향을주는 이유는 무엇입니까? – JoshRagem

+0

@GeekedOut - 최신 편집보기 –

관련 문제