Baby boomer needing help please

I am trying to run/test my app on iPad but get fatal error message in Xcode - I don't understand what it means as I know so little about code but Apple Developer Support told me I have to ask this Code Forum to find my answer, thanks for your time and help, lindybelinda

Replies

It looks like the file "preloader.html" does not exist at the specified location, "htmlPath".

htmlPath is nil, so by force-unwrapping it (using htmlPath!), your app crashes.

  • Appreciative of quick reply. Will remove preloader.jpg plus some code I dropped in to display the jpg - can use Hype scenes default loading

Add a Comment

You have declared:

let htmlPath = Bundle.main.path(forResource: "preloader", ofType: "html")

This creates an optional, which is nil if it fails.

So later, when you unwrap in contentsOfFile: htmlPath!

you crash.

First thing would be to avoid the crash:

if let htmlPath = Bundle.main.path(forResource: "preloader", ofType: "html") {
  let folderPath…
 // next to after catch
  
}

Second, need to understand why it's nil.

Are you sure to have included in the project a resource file named preloader.html ? It must be the exact name, including upper/lowercase.

Thanks so much Claude31. Will remove preloader.jpg plus code I dropped in to display jpg image - will use Hype scenes default loading image instead