|
@@ -23,34 +23,34 @@ class UpdateVersionManager: NSObject {
|
|
|
|
|
|
/// 初始化升级
|
|
|
func initUpdateVersionManager() {
|
|
|
- //启动程序
|
|
|
- observe = NotificationCenter.default.addObserver(forName: UIApplication.didFinishLaunchingNotification, object: nil, queue: OperationQueue.main, using: {
|
|
|
- [weak self] (notification) in
|
|
|
- self?.configUpGrade()
|
|
|
-
|
|
|
- })
|
|
|
- //程序进入后台
|
|
|
- observe = NotificationCenter.default.addObserver(forName: UIApplication.didEnterBackgroundNotification, object: nil, queue: OperationQueue.main, using: {
|
|
|
- [weak self] (notification) in
|
|
|
- if self?.updateVersionView != nil {
|
|
|
- self?.updateVersionView?.hide()
|
|
|
- }
|
|
|
- })
|
|
|
- //将要进入前台的时候
|
|
|
- observe = NotificationCenter.default.addObserver(forName: UIApplication.willEnterForegroundNotification, object: nil, queue: OperationQueue.main, using: {
|
|
|
- [weak self] (notification) in
|
|
|
- self?.configUpGrade()
|
|
|
- //基础配置
|
|
|
- SwiftMoyaNetWorkServiceConfig.shared().configApi(completion: {(data) -> (Void) in}){_ in}
|
|
|
- })
|
|
|
- //程序即将退出
|
|
|
- observe = NotificationCenter.default.addObserver(forName: UIApplication.willTerminateNotification, object: nil, queue: OperationQueue.main, using: {
|
|
|
- [weak self] (notification) in
|
|
|
- if self?.updateVersionView != nil {
|
|
|
- self?.updateVersionView?.hide()
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
+ //启动程序
|
|
|
+ observe = NotificationCenter.default.addObserver(forName: UIApplication.didFinishLaunchingNotification, object: nil, queue: OperationQueue.main, using: {
|
|
|
+ [weak self] (notification) in
|
|
|
+ self?.configUpGrade()
|
|
|
+
|
|
|
+ })
|
|
|
+ //程序进入后台
|
|
|
+ observe = NotificationCenter.default.addObserver(forName: UIApplication.didEnterBackgroundNotification, object: nil, queue: OperationQueue.main, using: {
|
|
|
+ [weak self] (notification) in
|
|
|
+ if self?.updateVersionView != nil {
|
|
|
+ self?.updateVersionView?.hide()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ //将要进入前台的时候
|
|
|
+ observe = NotificationCenter.default.addObserver(forName: UIApplication.willEnterForegroundNotification, object: nil, queue: OperationQueue.main, using: {
|
|
|
+ [weak self] (notification) in
|
|
|
+ self?.configUpGrade()
|
|
|
+ //基础配置
|
|
|
+ SwiftMoyaNetWorkServiceConfig.shared().configApi(completion: {(data) -> (Void) in}){_ in}
|
|
|
+ })
|
|
|
+ //程序即将退出
|
|
|
+ observe = NotificationCenter.default.addObserver(forName: UIApplication.willTerminateNotification, object: nil, queue: OperationQueue.main, using: {
|
|
|
+ [weak self] (notification) in
|
|
|
+ if self?.updateVersionView != nil {
|
|
|
+ self?.updateVersionView?.hide()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
|
|
|
// 用于判断当前系统版本是否低于指定版本
|
|
|
func systemVersion(below aVersionString: String) -> Bool
|