iOS Databases - "Fatal Error"

Hi there,

In Xcode itself I have a “cannot preview in this file” message, with a “Fatal Error in ModelContainer.Swift” message below. Despite this, I can preview it in the Simulator and everything works fine. Still, I am not content with it but I can’t seem to fix it myself. Can someone help me in the right direction?

Best,
Sem

Hi Sem,

What project is this related to?

Would you like to share your project and I’ll take a look?

Alternatively can you share your code that causing you issues by pasting your code in a reply.

If you want to share the project, here are some instructions on how to do that:

Compress the entire project into a zip file and share that via either Dropbox or Google Drive.

To compress the project, locate the project folder in Finder and then right click on the top level folder and select Compress ProjectName. The top level folder is the one that contains the file named ProjectName.xcodeproj and the folder named ProjectName.

Upload that zip file to either Dropbox or Google Drive and then create a share link then copy that link and paste that in a reply to this thread.

If you choose to use Google Drive then when you create the Share link, ensure that the “General Access” option is set to “Anyone with the Link” rather than “Restricted”.

1 Like

Hi Chris,

Thanks a lot!

Here’s the link.

https://drive.google.com/drive/folders/1LLcjrXnCYyKYbeBCX_i_dliCr9kv0fcP?usp=sharing

Best,
Sem

Hi Sem,

I downloaded your project and compiled and ran it on a simulator and there were no errors.

I managed to create 2 Projects and this is a screen shot.

Maybe what you have to do is delete the project from your simulator and try running it again.