I am trying to add an iOS subview to the OF view and have been following the model given in the iPhoneGuiExample. The app builds but stops at the line ‘UIApplicationMain(nil, nil, nil, [NSString stringWithUTF8String:appDelegateClassName.c_str()]);’ and gives the error message ’ terminating with uncaught exception of type NSException’. I did something quite similar in an app I did two years ago using OF 074 without a problem. Here are the pertinent parts of my code:
ofApp.mm
#include "ofApp.h"
#include "ButtonView.h"
ButtonView * buttonView;
void ofApp::setup(){
buttonView = [[ButtonView alloc] initWithNibName:@"ButtonView" bundle:nil];
[ofxiPhoneGetGLParentView() addSubview:buttonView.view];
}
ButtonView.h
#import <UIKit/UIKit.h>
#include "ofApp.h"
@interface ButtonView : UIViewController <UIGestureRecognizerDelegate>
- (void) viewDidLoad;
@end
ButtonView.mm
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "ButtonView.h"
#include "ofxiOSExtras.h"
@implementation ButtonView
// app pointer
ofApp * myApp;
- (void) viewDidLoad {
// get app pointer
myApp = (ofApp*)ofGetAppPtr();
}
@end
I’m using XCode 6 and attempting to run on both an iPhone 5 simulator and an iPad Mini with the same results.