rive-app / rive-ios

iOS runtime for Rive
MIT License
468 stars 53 forks source link

Fatal error: failed to locate filename in bundle #239

Closed damondeletter closed 1 year ago

damondeletter commented 1 year ago

Description

Hey, so I'm making an app in swiftUI for my final project. I wanted to add some custom animated icons (using rive), but it is not working. I've made a complete new project and for some reason, it works there. Since I made some connections to services like firebase, I don't want to copy/paste it the the new project. The problem is the following:

I have tried putting the .riv files in different folders, seperate,...

Source .riv/.rev file

I have tried different .riv files, but here are some basis files that didnt' work.

Expected behavior

Hopefully someone can help me with this error, since Rive animations looks pretty promising.

Screenshots

<-- If applicable, add screenshots to help explain your problem. -->

Screenshot 2022-12-21 at 09 45 54

Screenshot 2022-12-21 at 09 46 13 Screenshot 2022-12-21 at 09 46 46 Screenshot 2022-12-21 at 09 46 59 Screenshot 2022-12-21 at 09 47 22 house.riv.zip

Device & Versions (please complete the following information)

Additional context

The only other package that I'm using is Firebase, but that can't cause the problem.

nickfrazier27 commented 1 year ago

I have the same problem

damondeletter commented 1 year ago

@mjtalbot any suggestions?

Kaid00 commented 1 year ago

I am experiencing the same problem as well

Kaid00 commented 1 year ago

@damondeletter, @nickfrazier27 for each of your '.riv' files in the Rive folder, set each file's Target membership to point to your app (iOS-app-gym) You can access Target membership by selecting a file and opening File Inspector, at the bottom of the file inspector menu, find Target Membership. If you select '.riv' file within the Rive folder and do not see the Target membership in the file inspector menu, then drag and drop the '.riv' file out of the Rive folder

mjtalbot commented 1 year ago

Hi @damondeletter, @Kaid00 is correct, this is very likely because the files are not added to the "bundle resources".

There is some documentation on this by apple. There are also quite a few stackoverflows that should help with this.

Closing this for now, but if this does not solve the problem please feel free to re-open the issue

rogerluan commented 1 year ago

I faced this same problem, and the issue was that the file had no extension. Make sure your file has the .riv extension, and in the code you can call it without the .riv extension, e.g. RiveViewModel(fileName: "unlock")