2012-02-29 2 views
0

이 코드를 통해 파일에서 석영 구성을로드하고있어에서 석영 구성을로드 할 수 없습니다 :QCView 파일

// quartz is a QCView in the XIB file 
QCComposition *qc = [QCComposition compositionWithFile:@"res/wdq.qtz"]; 
//NSLog(@"input keys %@",[qc inputKeys]); 
//NSLog(@"copyright %@",[[qc attributes] valueForKey:QCCompositionAttributeCopyrightKey]); 
[quartz loadComposition:qc]; 

나는 오류 얻을 :

*** <QCComposition = 0x100258d80 | identifier = "(null)" | source = (null) | backing = "res/wdq.qtz": Failed loading composition 

(파일 위치에 존재를 , IB에서 파일로드는 IB 내부에서 작동하지만 응용 프로그램을 실행하지 않음)

Mac OS X Lion 10.7.3 | XCode 4.2 | Quartz Composer 4.5

+0

문제가 QCView 메인 창에서 아니 었습니다. – tagyro

답변

0

작업 디렉토리가 실제와 다를 수도 있습니다. 절대 경로를 사용하여 참조하십시오.

예를 들어, QTZ 파일을 가정하면 번들의 리소스 폴더에 있습니다

NSString *path = [[NSBundle mainBundle] pathForResource:@"wdq" ofType:@"qtz" inDirectory:@"res"]]l 
QCComposition *qc = [QCComposition compositionWithFile:path]; 
+0

감사하지만 실제로 문제는 QCView가 주 창에 없었고 일부 문제 때문에 파일을로드 할 수 없었습니다. 주 창에서 QCView를 이동하면 문제가 해결되었습니다. – tagyro