에서 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
수 : 하단 패널 (NOT 엑스 코드의 오른쪽 상단에있는 유사하게 보이는 버튼)에, 중간 표시 아이콘을 클릭하여 콘솔 섹션은 변수에 추가로 표시되고 있음을 다시 확인합니다 그 메소드에 중단 점을 두어 충돌이 발생했는지 확인합니다. 코드를 일시 중지 할 라인의 코드 왼쪽에있는 씬 (thin) 바로 가기를 클릭하십시오. 코드가 멈추지 않으면 그 메소드는 호출되지 않습니다. –
정확히 이것을 넣고있는 곳은 어디입니까? – JoshRagem
@Kris Gellci가 방금 해봤습니다. 코드는 거기에 도착하지만 로그는 결코 발생하지 않습니다. 어쩌면 로그 화면이 제대로 작동하지 않을 수 있습니까? – GeekedOut