C++ 从后台输入后出现iOS Vuforia错误

C++ 从后台输入后出现iOS Vuforia错误,c++,ios,objective-c,augmented-reality,vuforia,C++,Ios,Objective C,Augmented Reality,Vuforia,我在iOS应用程序中使用Vuforia SDK,版本6.2.9。 所有工作都很好,但当应用程序从后台进入时出现错误 运行VUFORIA的viewcontroller正在侦听UIApplicationWillResignActivification和UIApplicationIDBecMeActivification通知。 在UIApplicationWillResignActiveNotification暂停AR的情况下,在UIApplicationIDBecMeActivenotificati

我在iOS应用程序中使用Vuforia SDK,版本6.2.9。 所有工作都很好,但当应用程序从后台进入时出现错误

运行VUFORIA的viewcontroller正在侦听UIApplicationWillResignActivificationUIApplicationIDBecMeActivification通知。 在UIApplicationWillResignActiveNotification暂停AR的情况下,在UIApplicationIDBecMeActivenotification恢复AR的情况下

// we use the iOS notification to pause/resume the AR when the application goes (or come back from) background

[[NSNotificationCenter defaultCenter]
 addObserver:self
 selector:@selector(pauseAR)
 name:UIApplicationWillResignActiveNotification
 object:nil];

[[NSNotificationCenter defaultCenter]
 addObserver:self
 selector:@selector(resumeAR)
 name:UIApplicationDidBecomeActiveNotification
 object:nil];
这些就是方法

- (void) pauseAR {
   NSError * error = nil;
   if (![vapp pauseAR:&error]) {
      NSLog(@"Error pausing AR:%@", [error description]);
   }
}

- (void) resumeAR {

    NSError * error = nil;
    if(! [vapp resumeAR:&error]) {
        NSLog(@"Error resuming AR:%@", [error description]);
    }

    // on resume, we reset the flash
    Vuforia::CameraDevice::getInstance().setFlashTorchMode(false);

    [self handleRotation:self.interfaceOrientation];
}
当我返回扫描模式时,在应用程序从后台进入后,相机被冻结,出现错误 找不到响应选择器renderFrameVuforia的CaeAglayer或CametLayer图层类的UIView

2017-07-17 11:13:01.187406+0200 App[8689:2961061] frame: {{0, 0}, {375, 667}}
2017-07-17 11:13:01.243707+0200 App[8689:2961061] DEBUG/AR(8689) Could not find a UIView with CAEAGLLayer or CAMetalLayer layer class that responds to selector renderFrameVuforia
2017-07-17 11:13:01.253958+0200 App[8689:2961061] Vuforia Library version 6.2.9
2017-07-17 11:13:01.731099+0200 App[8689:2961061] AR View: Rotating to Portrait
2017-07-17 11:13:01.731406+0200 App[8689:2961061] frame: {{0, 0}, {375, 667}}
2017-07-17 11:13:01.731562+0200 App[8689:2961061] VideoBackgroundConfig: size: 750,1334
2017-07-17 11:13:01.731589+0200 App[8689:2961061] VideoMode:w=1280 h=720
2017-07-17 11:13:01.731611+0200 App[8689:2961061] width=750.000 height=1334.000
2017-07-17 11:13:01.731638+0200 App[8689:2961061] ViewPort: X,Y: 0,0 Size X,Y:750,1334
2017-07-17 11:13:02.598959+0200 App[8689:2962160] INFO/AR(8689) 2017-07-18 11:13:02: Completed CloudReco transaction with ID '6f5c61ecc07741a7b652242abf909479'
2017-07-17 11:13:02.843834+0200 App[8689:2961061] frame: {{0, 0}, {375, 667}}
2017-07-17 11:13:02.844215+0200 App[8689:2961061] frame: {{0, 0}, {375, 667}}
2017-07-17 11:13:02.860971+0200 App[8689:2961061] DEBUG/AR(8689) UIView has CAEAGLLayer layer class
2017-07-17 11:13:02.861114+0200 App[8689:2961061] DEBUG/AR(8689) UIView does not respond to selector renderFrameVuforia
2017-07-17 11:13:02.861191+0200 App[8689:2961061] DEBUG/AR(8689) UIView has CAEAGLLayer layer class
2017-07-17 11:13:02.861222+0200 App[8689:2961061] DEBUG/AR(8689) UIView does not respond to selector renderFrameVuforia

谢谢你的帮助

在哪个方法中调用
pauseAR()

当我回到ViewController(拥有EagleView)时,我也遇到了同样的问题,相机被冻结了

我在
视图中调用
pauseAR()
将消失()
视图中调用
resumeAR()
,当问题出现时,EAGLView中的委托方法
renderFrameVuforia()
从未被调用,我认为这是问题的原因:

找不到响应选择器renderFrameVuforia的CaeAglayer或CametLayer图层类的UIView

因此,我查找了Vuforia开发人员库,发现:

在调用QCAR::onResume()之前,应用程序的视图层次结构已完全设置好(此时QCAR尝试定位符合UIGLViewProtocol的应用程序视图)


我将名为position的
resumeAR()
方法更改为
viewdideappear()
,一切正常。希望这能对您有所帮助。

-(void)applicationidenterbackground:(UIApplication*)application--尝试在该方法中添加代码您是指“pauseAR”方法吗?您没有指定
视图将消失()
视图将出现()
的文件名及其路径