Ionic Angular Tutorial App Fails to Run on iOS Device

I’m going through the tutorial for building an Ionic Angular app. Everything works as expected on web & on Android. On iOS, the app builds successfully, but when it runs, it opens up and instantly closes, with the following output:

ERROR: Unable to load public/index.html
⚡️  This file is the root of your web app and must exist before
⚡️  Capacitor can run. Ensure you've run capacitor copy at least
⚡️  or, if embedding, that this directory exists as a resource directory.

I’ve tried running ionic cap copy and restarting Xcode, as well as cleaning out the Dervied Data folder. I can confirm that there is in fact a public/index.html file in the root of the project, as well as in the iOS project folder. However, the behavior when running the app remains the same.

Current system info:
OS: Catalina 10.15.7
XCode: 12.2
Node: 12.16.1
Ionic: 6.12.2

Let me know if I can provide any other useful info. Thanks!

Tutorial author here :slight_smile:

Can you try ionic cap sync?

Are you trying to run the iOS project from the sample repo here or a freshly generated copy?

Thanks for your tutorial! I did try ionic cap sync as well, and got the same result. And I did a freshly-generated project–not a clone of the github source code.

Update – looks like it’s running after most recent ionic cap sync! It’s possible (though I’m not sure) that earlier, I hadn’t cleaned out the Derived Data folder, and xcode was still building an un-synced version.

However, it also looks like it’s not saving the photos on my iPhone when stopping/re-starting the app: I get an empty box for each photo taken during a previous session:

Do you know if there’s something special that I need to configure to get the photos saving on iOS 14? It’s also not impossible there’s an issue with my dinosaur phone (old iPhone SE).

So this may occur with local debug builds. If you start/stop debugging, iOS may assign a new GUID to the app, which effectively means it’s a different app. Hence why the photos stop appearing, they technically don’t exist anymore.

If you take a photo now does it display?

Gotcha. Yeah, the photos display when taking a new one. I guess it makes sense that it treats it as a whole new app on debug builds.

Thanks for your help!

1 Like