In an attempt to figure out how to integrate code from one program into another I have dumped 3 classes into an empty open GLES game project. The classes are ContentController, PhoneContentController and MyViewController from the PageControl apple sample.
I have then taken this initialisation code form the PageControl app delegate file and put it into the game project appDelegate.
contentController = [[PhoneContentController alloc] init];
[self.window addSubview:contentController.view];
with the necessary synthesize / protocols / includes and declarations where they are in PageControl.
I get a SIGABRT error on this line in main:
return UIApplicationMain(argc, argv, nil, NSStringFromClass([IntegrationTestAppDelegate class]));
I added a general breakpoint and it points to this line in MyViewController.m
newsItem = [[UITextView alloc] initWithFrame:self.view.frame];
I’m guessing this has something to do with self.view.frame ….? maybe? So, is there some hierarchy type issue at work here?
EDIT – on further inspection it does seem to have something to do with views… although I don’t quite know what. Could this have something to do with a foreign nib file?
EDIT – more detail: the newsItem is called from init of myViewController which is called from a method within phone content controller, which in turn is called with the following line in appdelegate:
contentController = [[PhoneContentController alloc] init];
At what point is:
being run? In particular, is it after nib loading is complete? If not, and self.view was set in Interface Builder, then self.view is going be nil, and self.view.frame is going to be garbage. (-initWithFrame: expects a CGRect struct, so in this case a nil pointer is wholly unacceptable, unlike in methods that expect Objective-C objects.)