car in 場站查車鎖車 ios
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

83 satır
3.1KB

  1. //
  2. // AppDelegate.m
  3. // goodpk
  4. //
  5. // Created by 歐特儀 on 2020/2/11.
  6. // Copyright © 2020 Altob. All rights reserved.
  7. //
  8. #import "AppDelegate.h"
  9. @interface AppDelegate ()
  10. @property NSUserDefaults* defaults;
  11. @end
  12. @implementation AppDelegate
  13. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  14. // Override point for customization after application launch.
  15. return YES;
  16. }
  17. #pragma mark - UISceneSession lifecycle
  18. - (UISceneConfiguration *)application:(UIApplication *)application configurationForConnectingSceneSession:(UISceneSession *)connectingSceneSession options:(UISceneConnectionOptions *)options {
  19. // Called when a new scene session is being created.
  20. // Use this method to select a configuration to create the new scene with.
  21. return [[UISceneConfiguration alloc] initWithName:@"Default Configuration" sessionRole:connectingSceneSession.role];
  22. }
  23. - (void)application:(UIApplication *)application didDiscardSceneSessions:(NSSet<UISceneSession *> *)sceneSessions {
  24. // Called when the user discards a scene session.
  25. // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
  26. // Use this method to release any resources that were specific to the discarded scenes, as they will not return.
  27. }
  28. - (void)applicationDidBecomeActive:(UIScene *)scene {
  29. // Called when the scene has moved from an inactive state to an active state.
  30. // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
  31. self.defaults = [NSUserDefaults standardUserDefaults];
  32. if ([self.defaults boolForKey:@"notFirstRun"]) {
  33. [self.window.rootViewController dismissViewControllerAnimated:YES completion:NULL];
  34. }
  35. }
  36. - (void)applicationWillResignActive:(UIScene *)scene {
  37. // Called when the scene will move from an active state to an inactive state.
  38. // This may occur due to temporary interruptions (ex. an incoming phone call).
  39. self.defaults = [NSUserDefaults standardUserDefaults];
  40. if ([self.defaults boolForKey:@"notFirstRun"]) {
  41. UIViewController *blankViewController = [UIViewController new];
  42. blankViewController.view.backgroundColor = [UIColor blackColor];
  43. [self.window.rootViewController presentViewController:blankViewController animated:YES completion:NULL];
  44. }
  45. }
  46. - (void)applicationDidEnterBackground:(UIApplication *)application
  47. {
  48. self.defaults = [NSUserDefaults standardUserDefaults];
  49. if ([self.defaults boolForKey:@"notFirstRun"]) {
  50. UIViewController *blankViewController = [UIViewController new];
  51. blankViewController.view.backgroundColor = [UIColor blackColor];
  52. [self.window.rootViewController presentViewController:blankViewController animated:YES completion:NULL];
  53. }
  54. }
  55. - (void)applicationWillEnterForeground:(UIApplication *)application
  56. {
  57. self.defaults = [NSUserDefaults standardUserDefaults];
  58. if ([self.defaults boolForKey:@"notFirstRun"]) {
  59. [self.window.rootViewController dismissViewControllerAnimated:YES completion:NULL];
  60. }
  61. }
  62. @end