0

I'm loading a Quartz composition from a file through this code:

// 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];

and I get the error:

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

(file exists at location, loading the file from IB works inside IB but not when running the application)

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

tagyro
  • 1,638
  • 2
  • 21
  • 36

1 Answers1

0

The working directory might not be what you think it is. Try referencing it using an absolute path.

For example, assuming the qtz file is in your bundle's Resources folder:

NSString *path = [[NSBundle mainBundle] pathForResource:@"wdq" ofType:@"qtz" inDirectory:@"res"]]l
QCComposition *qc = [QCComposition compositionWithFile:path];
smokris
  • 11,740
  • 2
  • 39
  • 59
  • thank you but actually the problem was that the QCView wasn't on the main window and for some strage reason couldn't load the file - moving the QCView on the main window solved the problem. – tagyro Mar 01 '12 at 10:29