Crash ReasonCrash
Assertion failure in
-[UIApplication _runWithMainScene:transitionContext:completion:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-
(* * * * terminating app due to uncaught exception ' nsinternalinconsistencyexception ', ' Enter code here ' reason: ' Application W Indows is expected to has a root
view controller at the end of application launch‘
First throw call stack:)Try solution one:The code makes adjustments, joins the next loop cycle, runs the code again, and the program is normal. ******//
- (void) Applicationdidbecomeactive: (UIApplication *) Application {//Restart Any tasks this were paused (or not yet started) while the application is inactive. If the application is previously in the background, optionally refresh the user interface. //crash in iOS9_testwindow =[[UIWindow alloc] Initwithframe:[uiscreen mainscreen].bounds]; _testwindow.hidden=NO; //OK//Dispatch_async (Dispatch_get_main_queue (), ^{//_testwindow = [[UIWindow alloc] Initwithframe:[uiscreen mainscreen].bounds]; //_testwindow.hidden = NO; // }); }
OrTry solution two:Xcode7 need all windows must have a root controller XCODE 7 requires that all the Windows must has a rootviewcontroller you can take easy:
uiviewcontroller* VC = [[Uiviewcontroller alloc]initwithnibname:nil Bundle:nil];
It's working good if you need the only UIWindow (for easy examples from any tutorials-before Xcode 7)!
About XCODE7 compiling old project crashes-[uiapplication _runwithmainscene:transitioncontext:completion:]