I understand .js file don’t run locally. However, when I compiled my app using PhoneGap, the .js I’m using works perfectly, even though it’s technically local, running on the iPad.
The problem is I need (we all need, actually) to ditch PhoneGap given that is uses Apple’s iOS 12 SDK and Apple is requiring to use SDK 13 starting in April.
So, I created a project file on Xcode using the Hype templates that have been circulating in this forum and got the app to run. However, the .js file is not running
But when I copy the same files to Xcode (and change the name of the resources folder from xxxxx.hyperesources to xxxx_resources, otherwise Xcode crashes) I get the app to run fine, except that particular function of scratching a hidden image using a .js file looks like this (2nd attachment)
As I said earlier, I know .js files do not work locally, but this should be able to work on an Xcode built app but somehow the .js file is not loading.
You’ll definitely want to check the web developer console in the method that @Photics described; it will likely point to what is going wrong. I can already see on the working website version itself there are many resource not loaded errors which might indicate that there’s something unexpected in your setup:
If you change the resources folder name, then you will also need to change corresponding code in the .html file, and potentially the *_hype_generated_script.js file as well, like @h_classen recommended.
Another possibility is that if the app is expecting to make network calls to get resources to run that part of the script, you may need to enable iOS app permissions for outgoing connections in the ‘Signing & Capabilities’ section of the app target.
2020-03-02 16:01:58.598689-0500 AlphaPod[51534:3150014] [ProcessSuspension] 0x102ffd640 - ProcessAssertion() PID 51534 Unable to acquire assertion for process with PID 51534
2020-03-02 16:01:58.600199-0500 AlphaPod[51534:3150014] [ProcessSuspension] 0x102ffd690 - ProcessAssertion() PID 51534 Unable to acquire assertion for process with PID 51537
Using the same web inspector, check to see if the canvas is being added and if so is it in the correct place compared to where it is being placed in the online version.
What I mean is. In the inspector that you used to look at the console via safari. Use it’s elements tab and do a search for canvas. See if it is being created and populated. It may not be…
If you are using a ${resourcesFolderName} then it will not work with export scripts that modify the paths to resources, since such a magic variable is a simple text substitution assuming only one resources folder and it not being split up.
You may just want to upgrade to the macOS 10.15.4 beta with the Xcode 11.4 beta as well. In my testing the .hyperesources crash no longer happens, so if that is the reason your file no longer works then that would be solved.
Otherwise you will either need to post the xcode project or connect to the web view via the Safari developer tools and inspect the log for errors.