ismyhc's Forum Posts

  • 3 posts
  • Yeah, I guess I could just host them. Probably making more work for myself than needed anyways.

    FYI, just wanted to mention that construct is great! Been programming for 10 years, but every time I hop into construct its really refreshing how easy it is to put together a game. :)

  • You can't load projects over the file: protocol. So many things get blocked for security reasons it won't load at all. There are quite a few significant changes that need to be made to get it to load.

    Why not use the built-in iOS export? That loads the game in WKWebView and handles all of this for you.

    Hey Ashley,

    Thanks for the reply! So what Im building is a mini game app of sorts. The games part of it is only about 50% of the app. The app is written in SwiftUI and for each game I open up a custom WKWebview which launches each mini game. I was trying to avoid having to host/serve each of the games. My hope was to simply have zip files of each of the games that I could download and run locally. My custom WKWebview also has message handlers to bridge some custom functionality to and from the mini games.

    I tried using the macos export and pulling out the contents of the www folder, but as mentioned above Im not sure if I need to call something from the wkwebview side to initiate the game. I also havent tried pulling from the iOS export. I will do that next.

    Im curious though, you mentioned not supporting the file:// protocol, but isnt the macos * ios exports utilizing that?

    At anyrate, I hope this explains better what Im trying to do.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hello,

    Im trying to load an exported game into my WKWebview without any success. Im trying to load the game locally from disk. I am able to do this with a game exported from ctjs so far.

    Heres what I am doing.

    1. game is stored as a zip on my server

    2. app downloads zip and unzips to users document directory

    3. I then launch the try launching the game from the directory

    Heres what the setup looks like.

    Directory of the upzipped game on the phone looks like this:

    file:///var/mobile/Containers/Data/Application/37C0D30F-415E-4CF8-8177-FCA0CD3566BD/Documents/6CtBOiFP0ieN4GVQKhQp/

    Files are at the root like: index.html, data.json, etc

    I open my WKWebview these settings:

    let configs = WKWebViewConfiguration() configs.setValue(true, forKey: "_allowUniversalAccessFromFileURLs") <-- needed for serving locally let webView = WKWebView(frame: .zero, configuration: configs) context.coordinator.parent = webView //.... Task { let url = await game.downloadZipFile() let index = url?.appendingPathComponent("index.html") if let dir = url, let index = index { webView.loadFileURL(index, allowingReadAccessTo: dir) <-- needed for serving locally } }

    Again, I can do this with an exported ctjs game and it loads as expected. But when I try to load the example game Glokar in this manner I get the following error.

    Now, I've tried this with the HTML5 export. Also, I've tried with the macos export, grabbed the contents of the www folder and also added the usercontentcontroller message handlers for 'C3Wrapper', but still the same error. I do get the messagehandler called with {"type":"ready"}.

    Heres screen shots of the promise not handled rejection. Any ideas? :)

    Tagged:

  • 3 posts