fix crash: IASKAppSettingsView is load before app entering foreground

This commit is contained in:
Danmei Chen 2020-05-26 19:36:16 +02:00
parent b4d3992d25
commit e06da76068
2 changed files with 16 additions and 11 deletions

View file

@ -196,18 +196,23 @@
- (IASKSettingsReader *)settingsReader {
IASKSettingsReader *r = [super settingsReader];
NSMutableArray *dataSource = [NSMutableArray arrayWithArray:[r dataSource]];
for (int i = 0; i < [dataSource count]; ++i) {
NSMutableArray *specifiers = [NSMutableArray arrayWithArray:[dataSource objectAtIndex:i]];
for (int j = 0; j < [specifiers count]; ++j) {
id sp = [specifiers objectAtIndex:j];
if ([sp isKindOfClass:[IASKSpecifier class]]) {
sp = [SettingsView filterSpecifier:sp];
if ([[UIApplication sharedApplication] applicationState] != UIApplicationStateBackground) {
for (int i = 0; i < [dataSource count]; ++i) {
NSMutableArray *specifiers = [NSMutableArray arrayWithArray:[dataSource objectAtIndex:i]];
for (int j = 0; j < [specifiers count]; ++j) {
id sp = [specifiers objectAtIndex:j];
if ([sp isKindOfClass:[IASKSpecifier class]]) {
sp = [SettingsView filterSpecifier:sp];
}
[specifiers replaceObjectAtIndex:j withObject:sp];
}
[specifiers replaceObjectAtIndex:j withObject:sp];
}
[dataSource replaceObjectAtIndex:i withObject:specifiers];
[dataSource replaceObjectAtIndex:i withObject:specifiers];
}
} else {
NSLog(@"Application is in background, linphonecore is off, skiping filter specifier.");
}
[r setDataSource:dataSource];
return r;
}

View file

@ -242,8 +242,8 @@ CGRect IASKCGRectSwap(CGRect rect);
[super viewDidDisappear:animated];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return YES;
- (BOOL)shouldAutorotate {
return YES;
}
- (void)didReceiveMemoryWarning {