Fixing crash in NotificationCenter event handler
This commit is contained in:
parent
807fa94e31
commit
9b37f46e33
@ -1653,7 +1653,7 @@
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CODE_SIGN_ENTITLEMENTS = AutoCat/AutoCat.entitlements;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 136;
|
||||
CURRENT_PROJECT_VERSION = 137;
|
||||
DEVELOPMENT_TEAM = 46DTTB8X4S;
|
||||
INFOPLIST_FILE = AutoCat/Info.plist;
|
||||
INFOPLIST_KEY_CFBundleDisplayName = AutoCat;
|
||||
@ -1680,7 +1680,7 @@
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CODE_SIGN_ENTITLEMENTS = AutoCat/AutoCat.entitlements;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 136;
|
||||
CURRENT_PROJECT_VERSION = 137;
|
||||
DEVELOPMENT_TEAM = 46DTTB8X4S;
|
||||
INFOPLIST_FILE = AutoCat/Info.plist;
|
||||
INFOPLIST_KEY_CFBundleDisplayName = AutoCat;
|
||||
|
||||
@ -56,7 +56,11 @@ class CheckController: UIViewController, UITableViewDelegate, UISearchResultsUpd
|
||||
}
|
||||
|
||||
self.history.delegate = self
|
||||
NotificationCenter.default.addObserver(self, selector:#selector(self.calendarDayDidChange(_:)), name:NSNotification.Name.NSCalendarDayChanged, object:nil)
|
||||
|
||||
NotificationCenter.default.addObserver(forName: .NSCalendarDayChanged,
|
||||
object: nil,
|
||||
queue: .main,
|
||||
using: calendarDayDidChange)
|
||||
}
|
||||
|
||||
override func viewWillDisappear(_ animated: Bool) {
|
||||
@ -118,9 +122,9 @@ class CheckController: UIViewController, UITableViewDelegate, UISearchResultsUpd
|
||||
}
|
||||
}
|
||||
|
||||
@objc private func calendarDayDidChange(_ notification : NSNotification) {
|
||||
DispatchQueue.main.async {
|
||||
self.historyDataSource.reload()
|
||||
nonisolated private func calendarDayDidChange(_ notification : Notification) {
|
||||
MainActor.assumeIsolated {
|
||||
historyDataSource.reload()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user