You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is then passed on to all the network services in the app.
Internally, each service creates a new NetworkDataResourceService.
The problem is that once a network service is no longer needed, it is deallocated and with it it brings down the NetworkDataResourceService, which calls session.invalidateAndCancel().
Later, when I create a new network service and try to make a request, the app crashes because I'm trying to use an invalid session.
Discussion
It appears that NetworkDataResourceService takes full ownership of the session. Is this the right thing to do?
I could inject a single NetworkDataResourceService everywhere in the app, and this would guarantee that the session is not invalidated.
If this is the suggested approach, I would like NetworkDataResourceService to conform to a protocol, so I can stub it out in my tests. For the time being, I can just subclass.
The text was updated successfully, but these errors were encountered:
Use Case
My client creates a secure session which is configured for certificate pinning.
When the app starts, I create a new session like so:
This is then passed on to all the network services in the app.
Internally, each service creates a new
NetworkDataResourceService
.The problem is that once a network service is no longer needed, it is deallocated and with it it brings down the
NetworkDataResourceService
, which callssession.invalidateAndCancel()
.Later, when I create a new network service and try to make a request, the app crashes because I'm trying to use an invalid session.
Discussion
It appears that
NetworkDataResourceService
takes full ownership of the session. Is this the right thing to do?I could inject a single
NetworkDataResourceService
everywhere in the app, and this would guarantee that the session is not invalidated.If this is the suggested approach, I would like
NetworkDataResourceService
to conform to a protocol, so I can stub it out in my tests. For the time being, I can just subclass.The text was updated successfully, but these errors were encountered: