petegoodliffe / PGMidi

PGMidi iOS MIDI library and example code
296 stars 83 forks source link

addSubview:viewController.view won't work anymore (fix included here in this post) #21

Open Reiszecke opened 8 years ago

Reiszecke commented 8 years ago

Instead of searching for a bug in the MIDI framework I've been using for the last 2 years I thought it'd be a good idea to just rip off someone else's work to make money.

MidiMonitorAppDelegate.m line 23 contains [window addSubview:viewController.view]; which doesn't work anymore. Please replace with [window setRootViewController:viewController]; otherwise you will get

Assertion failure in -[UIApplication _runWithMainScene:transitionContext:completion:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit/UIKit-3590.1/UIApplication.m:3676
2016-08-24 14:14:10.651022 MidiMonitor[1413:428747] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Application windows are expected to have a root view controller at the end of application launch'
*** First throw call stack:
(0x1b20c2a7 0x1a927097 0x1b20c181 0x1ba72e55 0x204d148b 0x204e3bb1 0x204ce375 0x1ca5fac3 0x1ca5f97d 0x1ca5fc67 0x1b1c8b63 0x1b1c866d 0x1b1c6943 0x1b117483 0x1b117291 0x202b909b 0x202b375f 0xe0c9b 0x1ad9650b)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 

on a SIGABRT in the line 18 of the main int retVal = UIApplicationMain(argc, argv, nil, nil); I added the full text just in case someone googles it