这是我显示 XIB 文件的简单按钮操作,该文件实际上是 Objective-C 中的条形码扫描仪。
- (IBAction)startCamera:(id)sender {
BarcodeVC * controller = [[BarcodeVC alloc] initWithNibName:@"BarcodeVC" bundle:[NSBundle mainBundle]];
//[self presentViewController:controller animated:YES completion:nil];
UIWindow * currentwindow = [[UIApplication sharedApplication] keyWindow];
[currentwindow.rootViewController presentViewController:controller animated:YES completion:nil];
}
但不幸的是,出现了一个警告:
keyWindow
已弃用:首先在 iOS 13.0 中弃用
我知道由于iOS 13支持多个场景,但是在 Objective-C 中有没有办法解决这个问题?我看过 Swift 版本,但我在 Objective-C 上没有成功。