"We offer new support options and therefor the forums are now in read-only mode! Please check out our Support Center for more information." - Vuforia Engine Team

Dynamically loading .xml and .dat failing

I have an iOS app that basically copies the sample app and swaps a few things out. When I use a .xml included in the project, everything loads/functions totally fine. But I'm trying to have it load the .xml and .dat from a server on startup, and use that as the tracking info. So, the app starts, I download the files, and save them locally. This works great. Then, I call loadObjectTrackerDataSet:(NSString *)dataFile with the URL to the locally saved .xml file (the .dat file is named/located identically, except for the file extension). Here's the code that deals with that: if(dataFile && ![dataFile isEqualToString:@""]) //data file URL exists! use absolute location {   if(!tDataSet->load([dataFile cStringUsingEncoding:NSASCIIStringEncoding], Vuforia::STORAGE_ABSOLUTE))   {     NSLog(@"Vuforia: ERROR: failed to load custom data set");     objectTracker->destroyDataSet(tDataSet);     tDataSet = NULL;   } } else //data file URL doesn't exist, load default from resources dir {   NSString *defaultDataFile = [NSString stringWithFormat:@"MGG_2017_01_07.xml"];//@"StonesAndChips.xml"];   if(!tDataSet->load([defaultDataFile cStringUsingEncoding:NSASCIIStringEncoding], Vuforia::STORAGE_APPRESOURCE))   {     NSLog(@"Vuforia: ERROR: failed to load default data set");     objectTracker->destroyDataSet(tDataSet);     tDataSet = NULL;   } } So if I pass in an empty/null string, it loads a default .xml that's packaged with the app. This works fine. But if I pass in a non-empty string, it tries to load the datafile from the absolute location that I passed in (in this case, file:///var/mobile/Containers/Data/Application/954551B4-4105-44A0-8D8B-EB98F957EF55/Library/7978/vuforiadb.xml ). But this fails. The documentation doesn't offer much help for when/why it would fail. What am I missing/doing wrong? Some thoughts: - Is this the "absolute URL" expected by Vuforia::STORAGE_ABSOLUTE? - Does its name need to conform to any weird quirks? - Does the location of the .dat need to be anything special? - Does it fundamentally have a problem loading the info from anywhere but the assets folder in the resources bundle?  

khushiMishti

Wed, 01/24/2018 - 06:45

Hi ,

I faced this problem, but now i got solution. Your .dat and .xml is not downloading properly in document directory/local store.

you need to download .dat and .xml.