mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-30 21:26:57 +02:00
BugFix: App crashes on iPhone 6S in case of rotation on login screen.
The crash reason was the following: Terminating app due to uncaught exception 'NSRangeException', reason: 'Cannot remove an observer <RoomViewController> for the key path "isOffline" from <AppDelegate> because it is not registered as an observer.
This commit is contained in:
@@ -236,18 +236,12 @@
|
||||
[super viewWillAppear:animated];
|
||||
|
||||
[self listenTypingNotifications];
|
||||
|
||||
// Observe network reachability
|
||||
[[AppDelegate theDelegate] addObserver:self forKeyPath:@"isOffline" options:0 context:nil];
|
||||
[self refreshActivitiesViewDisplay];
|
||||
}
|
||||
|
||||
- (void)viewWillDisappear:(BOOL)animated
|
||||
{
|
||||
[super viewWillDisappear:animated];
|
||||
|
||||
[[AppDelegate theDelegate] removeObserver:self forKeyPath:@"isOffline"];
|
||||
|
||||
// hide action
|
||||
if (self.currentAlert)
|
||||
{
|
||||
@@ -286,6 +280,10 @@
|
||||
|
||||
[super viewDidAppear:animated];
|
||||
|
||||
// Observe network reachability
|
||||
[[AppDelegate theDelegate] addObserver:self forKeyPath:@"isOffline" options:0 context:nil];
|
||||
[self refreshActivitiesViewDisplay];
|
||||
|
||||
if (self.roomDataSource)
|
||||
{
|
||||
// Set visible room id
|
||||
@@ -297,6 +295,8 @@
|
||||
{
|
||||
[super viewDidDisappear:animated];
|
||||
|
||||
[[AppDelegate theDelegate] removeObserver:self forKeyPath:@"isOffline"];
|
||||
|
||||
// Reset visible room id
|
||||
[AppDelegate theDelegate].visibleRoomId = nil;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user