Sometimes Snap Lenses failed to apply and Delay in loading

AliveNow Creative Tech
AliveNow Creative Tech Posts: 20 🔥
edited January 2023 in General #1

Hello @stevenxu and @arashp, I have integrated the Camera Kit into a new IOS project and tried the different Lenses that we built.

Sometimes the Lenses take so much time to load and in some cases, the Lenses gets fail to apply. I have seen this even in the Camera Kit IOS sample's GitHub repository. In Android the Lenses load immediately only in IOS I have seen this issue.

Please check this and give us a solution to overcome this issue.

Thank you.

Answers

  • stevenxu
    stevenxu Posts: 574 👻

    @AliveNow Creative Tech Thanks for reporting this. I just submitted a ticket to look into. I may have some follow up questions from our eng team. Hang tight

  • Shreyash Shah
    Shreyash Shah Posts: 3
    edited February 2023 #3

    @stevenxu I can confirm that we too have faced this issue, it's been there since quite a while now, we noticed this issue between 1.6 to 1.19.2.

    It seems like prefecter fails to cache other lenses when any one the lens in that batch fails to be downloaded. Although this is a rough observation from outside.

    @AliveNow Creative Tech , the way we worked around this is, by calling prefect(lenses:) on a single lens at a time when user applies the lens.

    Its like:

          snapSession.lenses.prefetcher.prefetch(lenses: [lensToApply], completion: { [weak self] didSucceed in
            guard let self = self else {
                completion?(false)
                return
            }
    
            guard didSucceed else {
                Logger.print(message: "Failed to fetch lens: \(lensToApply.name ?? "")")
                completion?(false)
                return
            }
    
            guard let processor = self.snapSession.lenses.processor else {
                completion?(false)
                return
            }
    
            processor.apply(lens: lensToApply,
                            launchData: self.launchData(for: lens)) {
                [weak self] success in
                guard let self = self else { return }
                completion?(success)
            }
        })
    
  • Just a suggestion:
    Try fetching single lens at a time,

  • arashp
    arashp Posts: 50 🔥

    Hi @AliveNow Creative Tech, thank you for reporting this issue. We are unable to reproduce the delay or failure to apply a Lens in the iOS sample app running SDK v1.20.0. To find the cause of this could you please answer the following questions?

    -- Is this happening with every Lens or some Lenses?
    -- Is it happening on iOS Camera Kit SDK v1.20.0
    -- Does it happen on both wifi and cell networks?
    -- Does it happen just on first launch or always?

    If it is happening with just some Lenses could you please open a ticket and send us the projects: https://docs.snap.com/camera-kit/support

    Thanks again