123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- //
- // AppDelegate.swift
- // RainbowPlanet
- //
- // Created by 南鑫林 on 2019/3/8.
- // Copyright © 2019 南鑫林. All rights reserved.
- //
- import UIKit
- @UIApplicationMain
- class AppDelegate: UIResponder, UIApplicationDelegate {
- var window: UIWindow?
- func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
- //初始化窗口
- initWindow()
-
- DispatchQueue.global(qos: .default).async {
- //初始化百度地图
- BaiduMapManager.shared.initBaiduMap()
- //初始化键盘
- DispatchQueue.main.async {
- //初始化友盟
- UMManager.shared.initUM(launchOptions: launchOptions)
- IQKeyboardManagerSwiftManager.shared().initIQKeyboardManagerSwift()
- }
- }
-
- return true
- }
-
- ///当App将从后台回到前台时调用,之后肯定调用applicationDidBecomeActive方法表示程序进入active状态,但App第一次启动时不是从后台启动,所以首次加载时不会调用此方法.
- func applicationWillEnterForeground(_ application: UIApplication) {
- SwiftMoyaNetWorkServiceUser.shared().userMemberMessageIndexApi {
- (messageIndexModel) -> (Void) in
- let messageIndexModel = messageIndexModel as? MessageIndexModel
- if messageIndexModel?.activity?.isYes == 1 || messageIndexModel?.follow?.isYes == 1 || messageIndexModel?.notification?.isYes == 1 || messageIndexModel?.praise?.isYes == 1 || messageIndexModel?.comment?.isYes == 1 {
- NotificationCenter.default.post(name: NSNotification.Name(rawValue: "MessageMainViewController"), object: messageIndexModel)
- }
-
- }
- }
- }
|