SDWebImage / SDWebImageSwiftUI

SwiftUI Image loading and Animation framework powered by SDWebImage
https://sdwebimage.github.io/SDWebImageSwiftUI
MIT License
2.14k stars 219 forks source link

Opening gs links #184

Closed SnowballAntrobus closed 3 years ago

SnowballAntrobus commented 3 years ago

@dreampiggy hello friend I'm confused about this simple code:

    SDImageLoadersManager.shared.loaders = [FirebaseUI.StorageImageLoader.shared]
    SDWebImageManager.defaultImageLoader = SDImageLoadersManager.shared
    let ref = Storage.storage().reference().child(imageName)
    print(ref) //gives the gs link
    let url = NSURL.sd_URL(with: ref)! as URL
    return WebImage(url: url)

When I run this I get a Code=-1002 "unsupported URL" error. Could you please help me?

SnowballAntrobus commented 3 years ago

I was trying to follow #70 but I got confused.

dreampiggy commented 3 years ago

This should works. Because it's supported via: https://github.com/firebase/FirebaseUI-iOS/pull/841

Maybe you're using the old version of FirebaseUI ?

Provide all your Pod's version, including:

Or a demo to reproduce this issue ?

SnowballAntrobus commented 3 years ago

Thanks! Here they are from my pod file:

If this is not enough I added you to my project the test code is in testView and the original function is in the ClothItem model

dreampiggy commented 3 years ago

The dependency version looks correct.

Maybe this because of some bugs. Can you provide some Firebase Storage URL (without authoritation) for me to test ?

A little demo is better.

SnowballAntrobus commented 3 years ago

@dreampiggy sounds good I'll set it up in a bit

SnowballAntrobus commented 3 years ago

@dreampiggy done! I invited you to the demo the URL in the demo should work. Demo is WebImageGSDemo

dreampiggy commented 3 years ago

@SnowballAntrobus Seems works.

You should put that SDK initialize code into App.swift, like this

image

Not the onAppear logic, when the onAppear called, your image request already been sent and since URLSession does not support gs:// URL, it will fail.

dreampiggy commented 3 years ago

I can add this into the readme or wiki about How to use some codec / loaders with SwiftUI.

dreampiggy commented 3 years ago

Done. See: Using with external loaders/caches/coders

SnowballAntrobus commented 3 years ago

Thanks so much my friend!!!