iOS universal app ok on simulator, but crash on iPhone/Pod device ...

Hi there,
I have an app ( ) which runs fine on simulator for iPhone, for iPad in any resolution retina or not.
No problem, no hardcore error messages.

I had a nice surprise to see it crashing at startup on iPhone & iPod.

I had crash log, symbolicated them but I didn’t achieve to solve the problem.

It works very fine on iPad any model.

my is basic:

#include "ofMain.h"  
#include "testApp.h"  
int main(){  
    ofAppiPhoneWindow * iOSWindow = new ofAppiPhoneWindow();  
	ofSetupOpenGL(iOSWindow,768,1024, OF_FULLSCREEN);  
	ofRunApp(new testApp);  

and I’m doing this as conditions code in my setup() in

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)  
     // iPads  
     theControlsUIViewController	= [[ControlsUI alloc] initWithNibName:@"ControlsUI" bundle:nil];  
     [ofxiPhoneGetGLView() addSubview:theControlsUIViewController.view];  
     theControlsUIViewController.view.hidden = NO;  
     else { // iPhone & iPod  
     theControlsUIViewControllerphone = [[ControlsUIphone alloc] initWithNibName:@"ControlsUIphone" bundle:nil];  
     [ofxiPhoneGetUIWindow() addSubview:theControlsUIViewControllerphone.view];  
     theControlsUIViewControllerphone.view.hidden = NO;  
     theSettingsVCphone	= [[settingsVCphone alloc] initWithNibName:@"settingsVCPhone" bundle:nil];  
     [ofxiPhoneGetUIWindow() addSubview:theSettingsVCphone.view];  
     theSettingsVCphone.view.hidden = YES;      
     theHelpVCphone	= [[helpVCphone alloc] initWithNibName:@"helpVCphone" bundle:nil];  
     [ofxiPhoneGetUIWindow() addSubview:theHelpVCphone.view];  
     theHelpVCphone.view.hidden = YES;  

In the iPad case, I’m using popovercontroller to load 2 other nib (not visible here)
In the other cases, I’m basically showing/hiding my 2 view over the first.

if I remove the allocation of settingsVCphone & helpVCphone, it works fine.
So I tried to dig inside those views but I don’t know why it would works on simulator & not in real life.
Each VC are totally basic.

I’m almost despaired :-/


Have you first synthesized the variables?

settingsVCphone * theSettingsVCphone; //in your header

@synthesize theSettingsVCphone; //in your implementation

Double check the filenames of the .xib-files in your bundle and referenced in your code. On the simulator they are case-insensitive, on the device they ARE casesensitive.

HTH, Stephan

Hi Seth,
I synthesized all but not that one.
you mean where?
I mean: where can I synth those ?
settingsVCphone is declared in my

Hi sth,
by bundle you mean the filename itself or in plist or ?

Thanks to both of you, I have more leads :slight_smile:

I meant the name of the .xib-file in your project on the file-system. If your .xib-file on the hard-drive has a different case as “settingsVCPhone.xib” then you app will crash because of an NSException because the xib file cannot be found.


Ok sth.
both are okay.
still digging…
thanks for the precious tips, btw!

Problem seems totally solved.

What I have done:

  • recreate the xib files from scratch (copy pasting all elements from previous xib), then relinking each elements to file owner’s when required and to first responder / methods
  • declared my view controllers as proposed by Seth

Making those 2 changes made the trick!

I want to thank you both for your answers.
Now, 1.01 will be released and be solid as a rock!

Let’s spread Mobile Mood Machine =)

Excellent Solution, I have got from this Source.