从后台进入后出现iOS Vuforia错误
iOS Vuforia error after entering from background
我在iOS应用程序中使用Vuforia SDK,版本6.2.9。 所有工作都很好,但是当应用程序从后台进入时会出现错误。
运行 VUFORIA 的视图控制器正在侦听 UIApplicationWillResignActiveNotification 和UIApplicationDidBecomeActiveNotification通知。在UIApplicationWillResignActiveNotification的情况下暂停AR,在UIApplicationDidBecomeActiveNotification 恢复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];
}
当我返回扫描模式时,应用程序从后台进入后,相机冻结,并显示错误找不到具有 CAEAGLLayer 或 CAMetalLayer 类的 UIView 响应选择器 renderFrameVuforia
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(拥有EAGLView(时,我遇到了同样的问题,相机被冻结了。
我在viewWillDisappear()
中调用pauseAR()
,在viewWillAppear()
中调用resumeAR()
,因为问题出现,EAGLView 中的委托方法renderFrameVuforia()
从未被调用,我认为这是问题导致的问题:
找不到具有 CAEAGLLayer 或 CAMetalLayer 类的 UIView 响应选择器 renderFrameVuforia
所以我查找了 Vuforia 开发人员库并发现:
应用程序的视图层次结构是在调用 QCAR::onResume(( 之前完全设置的(此时 QCAR 会尝试找到符合 UIGLViewProtocol 的应用程序视图(。
我将resumeAR()
称为位置的方法更改为viewDidAppear()
,一切都像往常一样工作。希望这能帮助你。
- 使用ios:ate写入到流会覆盖现有文件
- 如何访问RTCVideoRenderer的帧?(ios)
- ios::fmtflags 在 C++ 中是如何工作的?setf() 是如何工作的?
- 我可以在 iOS 或 mac 应用程序中使用C++代码吗?
- "string.h"在构建适用于iOS的qt应用程序中找不到消息
- 为什么 C++ 11 在 ios 类中添加了运算符 bool
- 'string'文件在带有C++文件的iOS插件上找不到
- 文件模式标志"ios::app"是否用于删除文件(如果文件已存在)?
- 使用 C++ iOS::ate 获取错误的文件大小
- 使用 适用于 Android 和 iOS 的 tf-lite C++ API
- 如何正确设置 ios 标志以进行流操作?
- 在为 iOS 构建 aws-sdk-cpp 时,cmake 上的 CXX 编译器错误已损坏
- C++ std::locale( "en" ) 在 iOS 上引发异常
- 在瓦尔格林德的泄漏摘要中使用 std::ios::sync_with_stdio(fasle) 打印时获取"still reachable"
- 在iOS应用程序中创建数据库
- Qt & Firebase C++ SDK 在 iOS 上的链接问题
- 是否有可以在iOS上运行的API来更改现有视频的每秒帧数?
- 将文件从 iOS 应用程序加载到 C++ 对象中/<iostream>iOS 上的问题
- 从后台进入后出现iOS Vuforia错误
- 我可以在 iOS 中将 Swift 应用程序与 C++ 应用程序 (Vuforia) 合并吗?