rive-app / rive-ios

iOS runtime for Rive
MIT License
484 stars 55 forks source link

Can't view animation over https, sample SwiftUI included. #222

Closed imougy closed 2 years ago

imougy commented 2 years ago

The below very simple code doesn't work, RiveViewModel(fileName: ...) works fine! Is there a way to debug the library, I am using swift manager to include the rive runtime but any break points inside the renderer is not triggered.

Do I have to workaround and download the file myself and save it, then play it?! Thanks,

struct ContentView: View {

    var body: some View {
        HStack{
//            RiveViewModel(fileName: "2861-5945-dino").view()  // 2861-5945-dino is a local .riv animation file 
            RiveViewModel(webURL: "https://cdn.rive.app/animations/vehicles.riv").view()
        }
    }
}
zplata commented 2 years ago

Hi @imougy - what error are you seeing on your end when using the webURL?

imougy commented 2 years ago

Hi @zplata , I get really a crash, here is what I get below. If you suggest any debug tips, please let me know and I wil do it.

Screen Shot 2022-08-08 at 3 01 15 PM
zplata commented 2 years ago

Got it, thanks! We're able to repro this locally, and the error seems to come from a lower-level part of the internal stack, so there's nothing you're doing wrong here. We'll push a fix up for this shortly, thanks for bringing this up!

imougy commented 2 years ago

Awesome! Thank you so much. Will be waiting for the fix and report accordingly.

zplata commented 2 years ago

Hey @imougy ! Just as an update here - we did get a patch out for this issue of not being able to use the webURL in 3.0.2. However, it seems the specific Rive file and default artboard you are reporting about is having a separate issue 😅 we can look into. Other URLs may work, for example, if you get a Rive file from the community.

imougy commented 2 years ago

@zplata This is awesome! I am confirming that it works now (I have my animation local hosted but for the sake of bug illustration, I just put a community file). Feel free to close the issue. I also like that the dev team reference the issue when they fix it so we can see the changelist, great job! BTW, I was one of the dev that implemented SVG back in the 2000 at Adobe Illustrator, and I am happy to see Rive flourish.

imougy commented 2 years ago

@zplata , what is the best practice if the riv file is not there or corrupt? We don't want to crash for sure but I am not clear which direction I should go. If the riv file is an invalid link that was input by a user from a text field for example, should I check the url is valid, but even that, what if the link is a .riv file but corrupt, this will crash the app. Thoughts or should I open a new issue as enhancements for the API (to throw an error for example instead of crashing).

zplata commented 2 years ago

Great question! We might consider showing nothing, or providing a way to fallback on some piece of UI. Feel free to open a new issue around this.

imougy commented 2 years ago

Awesome, I created an issue #224. Feel free to close this one because it is fixed.