Skip to main content
Known Participant
September 23, 2018
Question

ANE: How to load XIB file?

  • September 23, 2018
  • 0 replies
  • 515 views

Hi, guys!

Our ANE is trying to load a portion of user interface from .xib file.

Unfortunately it fails with a crash.

Is it even possible in AIR?

We put the XIB file "CustomViewController.xib" in the root of .ipa package.

And here's the native code that loads the XIB.

UINib *uiNib = [UINib nibWithNibName:@“CustomViewController” bundle:[NSBundle mainBundle]];

//uiNib is NOT nil at this point. So it was found and loaded.

//But the following line crashes.

UIView *view = [uiNib instantiateWithOwner:self options:nil].firstObject;

This message is printed to the console.

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException',

reason: 'Could not load NIB in bundle: 'NSBundle </var/containers/Bundle/Application/295E25B2-DF66-426D-8DD0-FDF5C816943D/YoWindow Weather.app> (loaded)' with name 'CustomViewController''

This is except from the crash.

Exception Type:  EXC_CRASH (SIGABRT)

Exception Codes: 0x0000000000000000, 0x0000000000000000

Exception Note:  EXC_CORPSE_NOTIFY

Triggered by Thread:  0

Application Specific Information:

abort() called

Filtered syslog:

None found

Last Exception Backtrace:

0   CoreFoundation                  0x183d2ed8c __exceptionPreprocess + 228

1   libobjc.A.dylib                 0x182ee85ec objc_exception_throw + 55

2   CoreFoundation                  0x183d2ec6c +[NSException raise:format:] + 115

3   UIKit                           0x18dfafd2c -[UINib instantiateWithOwner:options:] + 467

     

The code works just fine in a standalone application but fails when run inside AIR.

Has anyone managed to successfully load a XIB in ANE?

This topic has been closed for replies.