我正在使用ARKit学习该应用程序。我有带UIKit的UIViewcontroller,它是UINavigationController的根。 当我关闭此错误时,会出现下一个错误:
Cannot remove an observer <ARImageSensor 0x1d02c8110> for the key path "deviceWhiteBalanceGains" from <AVCaptureFigVideoDevice 0x1047827e0> because it is not registered as an observer.
(null)
我该如何解决?
我的VC代码如下:
#import "ARViewController.h"
#import <ARKit/ARKit.h>
@interface ARViewController () <ARSCNViewDelegate, ARSessionDelegate>
@property(nonatomic, strong) IBOutlet ARSCNView *sceneView;
@property(nonatomic, strong) ARAnchor *arAnchor;
@end
@implementation ARViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.sceneView.delegate = self;
UIBarButtonItem *cancelButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancelButtonTapped)];
self.navigationItem.leftBarButtonItem = cancelButtonItem;
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
ARWorldTrackingConfiguration *configuration = [ARWorldTrackingConfiguration new];
[configuration setWorldAlignment:ARWorldAlignmentGravity];
[configuration setPlaneDetection:ARPlaneDetectionHorizontal];
[self.sceneView.session runWithConfiguration:configuration];
}
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
[self.sceneView.session pause];
}
- (void)cancelButtonTapped {
[self dismissViewControllerAnimated:YES completion:nil];
}
#pragma mark - ARSCNViewDelegate
- (SCNNode *)renderer:(id<SCNSceneRenderer>)renderer nodeForAnchor:(ARAnchor *)anchor {
// some my code
}
@end
我没有发现任何可能导致问题的原因。