Giter Site home page Giter Site logo

Comments (4)

Truba avatar Truba commented on July 30, 2024

Hi @hahuja ,

I'm really sorry that it took us this long to answer.

What you have just described here is memory leek. Your api call should not have a strong reference to your presenter / interactor / view. You should weakify self in the callback.

Also you should cancel the api call when the view / presenter / interactor delocates since you don't want to waste resources.

from ios-viper-xcode-templates.

kvaljeva avatar kvaljeva commented on July 30, 2024

Hi @hahuja,

is this issue still apparent or did you manage to fix this afterwards? If it was fixed, I would like to close the issue. If it's not, please, don't hesitate to continue the discussion and we'll try to help. 🙂

from ios-viper-xcode-templates.

mazmik25 avatar mazmik25 commented on July 30, 2024

i think this relates to my PR before

#40
We've tried to weakify the presenter inside the callback. but it still got this issue. that's why everytime we generate the files, we always weakify the presenter

from ios-viper-xcode-templates.

kvaljeva avatar kvaljeva commented on July 30, 2024

@mazmik25 By definition, an unowned reference in this use case should be safe unless you have memory leaks/retain cycles. If the API call you were using on a pushed view controller had a callback, which had a strong reference to that controller then it makes sense why the crash happens, as described. View was deallocated, but the presenter was retained until the closure wrapped up the execution, tried to reload data and didn't find an object.

To fix this, you should ideally do two things:

  1. References to the presenter in any of the callbacks needs to be weak. Since you mentioned you tried doing this, a code sample of the issue would be much appreciated, since this shouldn't end up happening if there are no references.
  2. API call should ideally be cancelled on the module that was removed from the stack. Since the object no longer exists, there is no point to wait for the API.

If it still happens then we'd definitely need a code sample (either in a sample project or a direct copy/paste from where you're encountering the issue). We'll then try checking that out and reproducing to see if there's a programmer error involved.

from ios-viper-xcode-templates.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.