3

I am attempting to build an IOS application using the Wikitude Augmented Reality SDK. Currently, the SDK requires a configuration file to be either included in the binary, or fetched from the network within the context of their own javascript webview-esque framework.

The SDK has no documented way of passing this configuration file from the local app storage to the javascript context. The current implementation involves fetching the configuration file from Parse. This is problematic for the following reasons:

  1. The configuration needs to be downloaded from the net everytime the context is created (during launch). This is problematic as the configuration can be 10+ megabytes.
  2. There is no option for persistent storage within the javascript context
  3. Would not allow for offline use as every launch requires a network connection.

I am looking for advice on workarounds for this issue. I am considering either a custom URL scheme from NSURL Protocol or potentially a local web server on the app, but I am unsure if the javascript context would be able to see any assets linked from the app local storage. Any advice would be super helpful!

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Andrew Walz
  • 890
  • 2
  • 8
  • 27

1 Answers1

0

How does the Wikitude SDK know to fetch the config file from the network, do you give it a URL string/NSURL entity? If that's the case, I suppose you could try a quick test to see if a file URL will work:

- (NSURL *)urlForConfigFile
{
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *localDir = paths[0];
    NSString *resourcePath = [NSString stringWithFormat:@"%@/config.txt", localDir];
    return [NSURL fileURLWithPath:resourcePath];
}

This will give you something like:

file:///var/mobile/Containers/Data/Application/7DAABE99-F9A9-4281-B95F-971448DA7377/Documents/config.txt

Replace 'config.txt' with your actual file name and make sure it's on the device in the right location, and that should be enough to at least test the theory.

fullofsquirrels
  • 1,828
  • 11
  • 16