Comments (4)
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.
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.
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.
@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:
- 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.
- 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)
- Wireframe init requires navigationController not viewController as current HOT 2
- ModuleViewController generation without Storyboard HOT 5
- How to handle the communication between the two modules ? HOT 3
- How to use module generator?
- Implementing multiple UINavigationControllers for UITabbarController HOT 1
- Viper Wireframes option to be storyboard based or programmatically view controller based HOT 2
- Question about Presenter Template... HOT 2
- Interactor question HOT 2
- Rename of configure in ViewController in RxModule HOT 2
- Presenter: replace UIKit import with Foundation import HOT 3
- Customizing base classes HOT 2
- Interfaces ordering in the Interface file (Rx template)
- Interfaces ordering in the Interface file (Rx template)
- I clicked on the makefile executable of version 2, and it deleted all the files from my documents folder HOT 3
- Wireframe V2 HOT 3
- UITabBar support HOT 3
- Interactor example HOT 5
- Generated variable names are wrong
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ios-viper-xcode-templates.