You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I got an issue that the view controller cannot release when observing a notification like this.
let observable = NotificationCenter.default.observable(for: Notification.Name.UIApplicationDidEnterBackground)
observe(observable) { notification in
print("Application did enter background")
}
How to fix it ? Thanks.
The text was updated successfully, but these errors were encountered:
Hello, you should use [weak self] in your event handlers to avoid creating a retain cycle, like this:
let observable = NotificationCenter.default.observable(for: Notification.Name.UIApplicationDidEnterBackground)
observe(observable) { [weak self] notification in
print("Application did enter background")
self?.doSomething()
}
Hello, I got an issue that the view controller cannot release when observing a notification like this.
How to fix it ? Thanks.
The text was updated successfully, but these errors were encountered: