iosobjective-chtmlwkwebviewarticulate

UIWebView cannot read correctly some local HTML5 stuff


Here I come with a new challenge for you all, Objective-C developers:

I'm trying to load some HTML5 exports from Articulate into an UIWebView. Well, at first sight it's quite simple: just put the HTML5 resources into the project and call index.html.

Well, that simply doesn't work if the HTML5 resource have a complex javascript structure. Specially with <audio> and <video> tags.

Any idea?


Solution

  • I've been investigating for hours and the solution appeared with some lateral thinking:

    If the main problem is that reading locally doesn't work, but the app requirements forces you to maintain the content offline, then let's serve the content locally!.

    Here are the steps I followed to resolve this issue:

    1. Embed a web server into your app (I prefer GCDWebServer)
    2. Let GDCWebServer serve your storyline locally with: [webServer startWithOptions:@{@"BindToLocalhost": @YES} error:nil];
    3. Use WKWebView to call your local web server with: [wkView loadRequest:[NSURLRequest requestWithURL:webServer.serverURL]];

    Then you will see your Articulate storyline working perfectly in your app inside a window, with iOS8.

    Hope this can help someone.