Open bukira opened 5 days ago
Hey @bukira,
Thanks for letting me know. Could you please show me the part of the code where you call the .registerPopups()
method, as a similar issue was recently created (#158) and I wonder if this is somehow related.
Thanks again for your help, Tomasz
Yes certainly
var body: some Scene {
WindowGroup {
RootView()
.registerPopups()
.logRender("RootView")
}
.onChange(of: phase) { newPhase in
switch newPhase {
case .active:
activePhase() //App became active
case .inactive:
inactivePhase() //App became inactive
case .background:
backgroundPhase() //App is running in the background no UI
@unknown default: break
//Fallback for future cases
}
}
}
@main
struct App: App {
@Environment(\.scenePhase) private var phase
@UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
init() {
setupFirebase()
setupConfig()
setupDependencies()
setupAppearance()
setupPageControl()
}
var body: some Scene {
WindowGroup {
RootView()
.registerPopups()
.logRender("RootView")
}
.onChange(of: phase) { newPhase in
switch newPhase {
case .active:
activePhase() //App became active
case .inactive:
inactivePhase() //App became inactive
case .background:
backgroundPhase() //App is running in the background no UI
@unknown default: break
//Fallback for future cases
}
}
}
}
@bukira, could you, for testing purposes comment out @Environment(`.scenePhase) private var phase
and see if the crash still occurs? If not, I think I know how I can fix it
doesnt crash with that commented out
Great. I mean not great, but at least I know how to fix it. I will provide you with a solution in a moment.
awesome and yeah great if we know the cause and super awesome for such a quick response :-)
Could you check if the patch-4.0.1
branch solves your problem?
Your the man, that fixed it cheers
Haha, glad to hear that. Unfortunately, I'll have to do some additional testing before this goes public, as there were reasons why I wanted to avoid such a solution 😅
Have a nice day @bukira!
Hi FulcrumOne, I also got this crash with iOS17, my registerPopups just like this.
Hey,
Did you try that branch? Thanks
I just tried it, and it really doesn't crash.
Updated to 3.0.0 and 4.0.0 and the popup still crashes for iOS 16 and below
iOS 17 and iOS 18 work fine
Thread 1: Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value
crashes on the line: await updatePopupAction(popup.updatedHeight(newHeight))
for centre and bottom popups
Printing description of newHeight: 0.0 Printing description of heightCandidate: 319.0 Printing description of popup.height: nil
Same popus didnt crash pre 3.0.0