-
-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
iOS Lifecycle is destroyed for some reason only on certain devices when using camera. #185
Comments
The Camera screen, is it a separate screen/app or a Decompose component? How do you manage the root lifecycle in iOS? |
The Camera screen is a separate Decompose Content and Component in the same App. |
In this case I recommend checking if the root Lifecycle doesn't gets destroyed for some reason. And also checking the navigation logic in the parent component responsible for navigation. |
What should I be checking here? What steps should I be taking whether I find that the RootComponent's Lifecycle is destroyed or not when compared to the Component with the destroyed Lifecycle (which is the SelfieComponent)?
This is what my RootContent looks like, with the two screens in question:
The StackView is mostly the same as the one your Decompose repository, with 2 minor changes being that I removed the
|
You can add logs in your RootComponent as follows (replace
Also, it would be nice to see your |
|
At first glance I don't see anything wrong. I suggest to start with adding lifecycle logs to RootComponent and to both child components and see what happens there. Also, I recommend checking that every child component receives correct instances of
|
I would assume that the RootComponent should be correct. After all, the app is working perfectly fine for all except for that one device. I will try and add some log on these lifecycle subscriptions, although it may be hard as I believe Firebase Crashlytics has some size limits on how much I can log for iOS. Any idea why the Lifecycle may get destroyed though? Instead of the issue being the code, I would assume that the Camera is triggering something that causes the Lifecycle to think it has stopped. |
Honestly I don't have any ideas for now. The only ways the previous component's lifecycle can be destroyed is:
You can also report stack traces from onDestroy callbacks to see the cause. |
I have a problem that I need some assistance with, since I have no idea why this happens and my client isn't really being cooperative in assisting us debug this issue. I have a project that is using Decompose and iOS is using SwiftUI. The app is working fine for us, but when I gave this app to our client for UAT, one person is encountering a strange issue that I cannot replicate.
We have a screen where the user can select a picture or take a photo, and if they choose to take a photo, it will launch a new screen with a
CameraView
and the captured photo will be passed back to the 1st screen. This works fine for almost everyone, but for that one specific person's device, when they return to the first screen, none of the Component functions work.Unfortunately debugging this has been hard because we do not have access to the only device that is reproducing this issue, and as mentioned, the client isn't exactly being cooperative and only tests it once a day at around midnight before they go to sleep. I've placed some logging in the app and what I find is that the Lifecycle inside the Component is in the Destroyed state upon returning to the first screen, which is why none of the Component's functions are responding as the
coroutineScope
is cancelled when the Lifecycle is destroyed. The Component's Lifecycle is not in the Destroyed state if the user does other actions such as using the photo picker, or going to an another screen and then returning back; it only specifically gets Destroyed after using the Camera.Do you have any idea why the Lifecycle would get destroyed in this scenario? The device is an iPhone 11 using iOS 17.2, although I don't think this matters too much as we also tried with our own iPhone 11 using iOS 17.2.
How I can prevent this or alternatively is there anyway to restart the lifecycle?
Is there any more info you would like me to collect to help assist you?
Versions:
com.arkivanov.decompose:decompose:3.2.2
com.arkivanov.essenty:lifecycle:2.4.0
The text was updated successfully, but these errors were encountered: