【发布时间】:2018-07-22 18:36:27
【问题描述】:
首先它说
'UIApplicationDidEnterBackground' 已重命名为 'UIApplication.didEnterBackgroundNotification'
当我点它时,它说
类型“Notification.Name”(又名“NSNotification.Name”)没有成员 'UI应用'
func listenForBackgroundNotification() {
observer = NotificationCenter.default.addObserver(forName: Notification.Name.UIApplicationDidEnterBackground, object: nil, queue: OperationQueue.main) { [weak self] _ in
if let weakSelf = self {
if weakSelf.presentedViewController != nil {
weakSelf.dismiss(animated: true, completion: nil)
}
weakSelf.descriptionTextView.resignFirstResponder()
}
}
}
【问题讨论】:
-
不行,还是一样的错误