NSOperation
과 observer에 문제가 있습니다.NSOperation, observer 및 thread error
저는 tabbarcontroller
과 splashController
입니다. 스플래시 화면을로드하고 파일을 다운로드하려면 파일을 다운로드 할 때 tabbarcontroller
을 화면에 표시하십시오.
부울 _WebTryThreadLock (BOOL) 0x3d2fa90 : 웹 메인 스레드 또는 웹 스레드가 아닌 다른 스레드에서 잠글 수득 시도
문제
내가 '오류 적이 있다는 것이다. 이것은 보조 스레드에서 UIKit을 호출 한 결과가 될 일 수 있습니다. 가 ... 지금은 충돌
이 내 코드입니다 :
- (void)applicationDidFinishLaunching:(UIApplication *)application {
queue = [[NSOperationQueue alloc] init];
NSString *path = [NSString stringWithFormat:@"%@flux.xml",DOCPATH];
//Le fichier existe dans le repertoire des documents
if([[NSFileManager defaultManager] fileExistsAtPath:path])
[window addSubview:tabBarController.view];
else
{
splash = [[SplashController alloc] init];
[window addSubview:splash.view];
}
DataLoadOperation *operation = [[DataLoadOperation alloc] initWithURL:[NSURL URLWithString:@"http://sly.33.free.fr/flux.xml"]];
[self.queue addOperation:operation];
[operation addObserver:self forKeyPath:@"isFinished" options:NSKeyValueObservingOptionNew context:nil];
}
-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
[window addSubview:tabBarController.view];
[window makeKeyAndVisible];
NSLog(@"fini");
}
이 사람이 나를 도울 수 있을까요?