IB won't connect?


#1

This is pretty sad, but I’m stuck right at the beginning…I create my Quiz project, I enter the code and quadruple check syntax in xcode for QuizAppDelegate, save, touch and resave, close and resave, etc. etc. No matter what I do, Interface Builder never shows the outlets when I right click on QuizAppDelegate. I can load the sample app, and it’s there, and it’s fine, but when I create a new app, despite the fact that the code is there, and seemingly in the right place, and is even copied verbatim from the completed app…IB just won’t attach the outlets declared in the project.

After a lot of noodling, I also seem to have disconnected the main window from the project as well. Ok so there’s obviously some failure to attach the code to the window…but where is this done? It appears to be an automatic connection in the sample…but my new project just won’t play. I’ve tried recreating with a new project…same outcome. What am I missing?

Thanks, Noel


#2

Hard to diagnose that one, as there are a number of things that could go wrong.

Firstly, I would create a new project and add a single outlet, build the application, save and then see if it shows up in IB.

Perhaps you can post a screenshot of interface builder, with the QuizAppDelegate selected, and the Connection panel selected showing the available connections?


#3

I just had the same problem, and you’re probably making the same mistake I did – you don’t right click on the label, you right click on the QuizAppDelegate and then drag to the label.


#4

It seems that Interface Builder and Xcode has some problem getting in sync. You can see if this is the problem if the light indicator at the bottom of the XIB window is grey.

Bizarrely, it seems to be caused by opening your project using the File > Open Recent Project menu in Xcode, or by using the Recent Documents list in the Xcode welcome screen.

If you double-click the project file in the Finder to open it or choose the project from the Recent Items menu in the Apple menu, Xcode’s connection to Interface Builder is intact.


#5

I experienced a similar difficulty. Even though I had:

//
// QuizAppDelegate.h
// Quiz
//
// Created by David Arnold on 7/12/10.
// Copyright College of the Redwoods 2010. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface QuizAppDelegate : NSObject {

int currentQuestionIndex;

// model objects
NSMutableArray *questions;
NSMutableArray *answers;

// view objects
IBOutlet UILabel *questionField;
IBOutlet UILabel *answerField;

UIWindow *window;

}

@property (nonatomic, retain) IBOutlet UIWindow *window;

  • (IBAction)showQuestion:(id)sender;
  • (IBAction)answerQuestion:(id)sender;

@end

In the Interface Builder, the actions were not showing up. I even tried File->Reload all class files in IB, but that didn’t work either. What worked for me was “building” my application. Then my actions showed up in IB.

Indeed, this is probably an all-round good idea in general. After writing my .h file, Command-B to build checks for typos and errors and seems to correct other problems as well.

D.


#6

I just started working my way through this book, and I am having the same problem. No connection appears in the little black window for me to connect to.

I am using Snow Leopard 10.6.6 and Xcode 3.2.3. My Mac is older so I can’t use a later operating system right now, and I think this is the latest version of Xcode that works with 10.6.6.

I did notice that some Amazon reviews indicated that getting the code in this book to work depends rather heavily on what version of Xcode you’re using. That the interfaces have changed from one version of Xcode to another.

I downloaded some sample code for the iOS 3rd edition book, and it has many of the same projects, but the code is very different. Can someone help me understand what version of Xcode I need to be using in order to make these projects work properly?

Both my book and my Xcode have release dates of 2010, so I figured they’d be roughly in sync.

Thank you,
Mark Brautigam