使用 Qualcomm AR (QCAR) 从 iOS 中的应用程序包外部加载标记
有谁知道是否可以从应用程序包外部加载 config.xml 和 qcar-resources.dat (包含标记信息的文件)?
根据官方论坛和文档,事实并非如此。然而,有一个名为 Blippar 的应用程序似乎可以做到这一点。我从 iPhone 备份中提取了应用程序 Documents 文件夹,其中似乎有一个 config.xml,其中的跟踪标记比应用程序包中的跟踪标记更多。
如果 QCAR SDK 不允许您指定跟踪文件的位置,他们怎么能做到这一点?
我尝试在 NSBundle 上创建一个类别来覆盖
- (NSString *)pathForResource:(NSString *)name ofType:(NSString *)ext;
相反,从文档文件夹返回路径,但这似乎不起作用。
Does anyone know if it is possible to load the config.xml and qcar-resources.dat (The files that contain the marker info) from outside the app bundle?
According to the official forums and documentation, it is not. However, there is an app out there called Blippar which seems to be doing it. I extracted the app Documents folder from an iPhone backup and they seem to have a config.xml in there that has more tracking markers than the one that is in the app bundle.
How could they have done this if the QCAR SDK doesn't allow you to specify a location of the tracking files?
I tried being hacky and creating a category on NSBundle to override
- (NSString *)pathForResource:(NSString *)name ofType:(NSString *)ext;
to return a path from the documents folder instead, but that didn't seem to work.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
好的,我已经解决了。
首先,我在 NSBundle 上创建了一个类别,并为几乎所有与从包中加载文件相关的方法创建了新的实现,直到我发现高通正在使用的一个方法,即:
一旦我有了它,我将我的类别方法更改为:
然后,通过方法调配的魔力:
使用这种方法:
我从这里的答案中得到:iPhone 设备上的 Method Swizzle
可怕吗?是的。
但它有效。
Ok, I've solved it.
First I created a category on NSBundle, and created new implementations of pretty much every method related to loading files from the bundle, until I found the one Qualcomm are using, which is:
Once I had that, I changed my category method to be:
Then, through the magic of method swizzling:
Using this method:
Which I got from the answer here: Method Swizzle on iPhone device
Scary? Yes.
But it works.
我目前正在尝试做同样的事情。你的回答似乎不错,但我有另一个建议。
API 声明
因此,这意味着您可以在任何给定时刻加载可跟踪数据。
如果您需要动态内容,请在您的应用程序中创建一个实用程序函数,将您需要的文件重命名为 config 和 qcar-resources.dat。
例如,假设您的应用程序包中有 20 个不同的 config_x.xml 形式的配置和 dat 文件,那么您只需删除当前的配置和 qcar-resource 数据文件,然后复制并重命名您想要使用的文件。然后您可以调用 QCAR::Tracker::load(),它将为您加载这些文件。这比您的方法安全得多,您的方法实际上是一种黑客而不是解决方案。
Im currently trying to do the same thing. Your answer seems good but I have another suggestion.
The API states that
So this means that you can load trackable data at any given moment.
If you need dynamic content then create a utility function in your app which renames the files you need as config and qcar-resources.dat.
For example lets say you have 20 different config and dat files in the form of config_x.xml etc in your app bundle then you simply delete the current config and qcar-resource data files and copy and rename the files you want to be used. Then you can call QCAR::Tracker::load() and it will load those files for you. This is considerably safer than your method which is really a hack and not a solution.
QCAR SDK 1.5 Beta 现在支持在运行时交换数据集! :) 下载
QCAR SDK 1.5 Beta now supports swapping datasets at runtime! :) Download