Is applicationWillResignActive ever called before didFinishLaunchingWithOptions ends?

后端 未结 3 2018
日久生厌
日久生厌 2020-12-29 17:06

Can a scenario happen where applicationWillResignActive: will be called before application:didFinishLaunchingWithOptions: ends?

3条回答
  •  渐次进展
    2020-12-29 17:22

    The runloop can be called recursively.

    A hypothetical implementation of application:disFinishLaunchigWithOptions: could run the runloop which, in turn, would allow for notification delivery from within the method.

    The following contrived example would let the run loop run, yet never return:

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
        while (YES)
            [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]];
    }
    

提交回复
热议问题