0

I'm new to Xcode trying to make a standalone application for a Quartz Composition.

Xcode 5.1.1 Quartz Composer 4.6 (151)

Steps are taken from this video

  1. I create a new Cocoa Application.

  2. Open MainMenu.xib in Interface builder.

  3. Drag and Drop "Quartz Composer View" into the new window.

  4. Load Composition and I select select a blank Composition (Note: This is tested with my final composition as well as a blank Composition)

  5. Return to main Project Screen -> Linked Frameworks and Libraries -> Add Framework -> Quartz.framework and QuartzCore.framework.

  6. Build and this is all I get.

    The document "MainMenu.xib" could not be opened. The operation couldn’t be completed. (com.apple.InterfaceBuilder error -1.)

The weird part is that my Quartz output shows up fine in my Interface Builder window, but my app won't build or run.

Daniel Arnett
  • 493
  • 2
  • 8
  • 18

2 Answers2

0

Okay I found a solution.

I downloaded the Quartz Container Application and built my Composition into it.

Follow the video tutorial here.

Daniel Arnett
  • 493
  • 2
  • 8
  • 18
  • This application has pretty much the same code as my answer above so you should get the same result if you put the code above into your application rather than putting your application into the Quartz Container Application code. – WorkingMatt Jan 20 '18 at 13:37
0

This is how I added a Quartz Composer Composition into an XCode 5 application programmatically so the QCC fills a window and resizes with it.

NSString *path = [[NSBundle mainBundle] pathForResource:@"NameOfQCComposition" ofType:@"qtz"];
NSView *superView = [self.displayWindow contentView];

qcView = [[QCView alloc] initWithFrame:superView.frame];
[superView addSubview:qcView];
[superView setTranslatesAutoresizingMaskIntoConstraints:YES];
[superView setAutoresizesSubviews:YES];
[qcView setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];

[superView addConstraint:
 [NSLayoutConstraint constraintWithItem: qcView
                               attribute: NSLayoutAttributeWidth
                               relatedBy: NSLayoutRelationEqual
                                  toItem: superView
                               attribute: NSLayoutAttributeWidth
                              multiplier:1
                                constant:0]];

[superView addConstraint:
 [NSLayoutConstraint constraintWithItem: qcView
                              attribute: NSLayoutAttributeHeight
                              relatedBy: NSLayoutRelationEqual
                                 toItem: superView
                              attribute: NSLayoutAttributeHeight
                             multiplier:1
                               constant:0]];
[superView addConstraint:
 [NSLayoutConstraint constraintWithItem: qcView
                              attribute: NSLayoutAttributeCenterX
                              relatedBy: NSLayoutRelationEqual
                                 toItem: superView
                              attribute: NSLayoutAttributeCenterX
                             multiplier:1
                               constant:0]];
[superView addConstraint:
 [NSLayoutConstraint constraintWithItem: qcView
                              attribute: NSLayoutAttributeCenterY
                              relatedBy: NSLayoutRelationEqual
                                 toItem: superView
                              attribute: NSLayoutAttributeCenterY
                             multiplier:1
                               constant:0]];

[qcView unloadComposition];
[qcView loadCompositionFromFile:path];
[qcView setMaxRenderingFrameRate: 30.0];
[qcView startRendering];

if(![qcView loadCompositionFromFile:path])
{
    NSLog(@"******QC.qtz failed to load");
    [NSApp terminate:nil];
}
NSLog(@"******qc.qtz has been loaded!!!!");
WorkingMatt
  • 639
  • 8
  • 24
  • The way around the bug is to do what you'd do with Interface Builder in the xib programmatically. I've written a blog post about this - really just a paste of the above code with some minor description of my problem. http://workingmatt.blogspot.co.uk/2014/08/xcode-5-quartz-composer-bug-fix.html – WorkingMatt Aug 28 '14 at 19:41