Start a new topic

Load WTC from Documents folder on iphone

Load WTC from Documents folder on iphone


Can we load WTC file from Documents folder on iphone ?

Thank you for reply,

I use JS SDK, and I tried this code with static path as a test:

this.tracker = new AR.ClientTracker("file:///var/mobile/Containers/Data/Application/A9F83B3C-B12A-4F30-88EC-3839D6D5F7B8/Documents/EpicMAR.wtc",{});

Is this code can do the job ?

Always I receive message of "WTC cannot be loaded".

 

Hardcoding the path will not work as the path will change upon re-installing the application on the device. Specifically, the hexadecimal pattern will be different. Here are some of the paths I got returned upon successive Xcode debug sessions:

/var/mobile/Containers/Data/Application/0DB301EB-E750-4D36-9FA7-418F8BB08F27/Documents

/var/mobile/Containers/Data/Application/8696826F-532D-400E-AA09-3788122C12EF/Documents

/var/mobile/Containers/Data/Application/6763F72A-1BE7-4E85-BD38-3F2BC59B863A/Documents

/var/mobile/Containers/Data/Application/522A09F0-0FD6-46E6-8D93-5060087BED15/Documents

 

If you however query the path at run-time using the code I provided previously and pass it to the JS environment your code will succeed I imagie.

Assuming you are using the Wikitude Native SDK, you can use the following piece of code directly:            

 


NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);

 

NSString *documentsPaths = paths.firstObject;

 

NSURL *documentsUrl = ;

 

NSURL *wtcUrl = ;

 

self.clientTracker = ;


 

 

Should you be using the Javascript SDK, you would need to query the path identically and pass the wtcUrl to the Javascript side as the JS API does not provide a means to get this path directly.

 

Should you be using one of our extensions, the proper way of doing this will yet again be different.
Login or Signup to post a comment