Alternative to override willFinishLaunching in the AppDelegate #98
-
What Stanford Spezi module is your challenge related to?Spezi DescriptionI need to register a background task (for a custom identifier), start app metrics, and currently, for convenience, register user defaults. I have been doing this as an override of application(willFinishLaunchingWithOptions:) with the intent to migrate to LifeCycleHandler. Some Spezi docs still imply that this is correct. However, the code declares those methods as deprecated as well. What do you think is the best way to handle this? The background task registration needs to occur before the delegate method returns. ReproductionCurrent functionality works with the deprecation notice. Most LifeCycleHandler mentions are fleeting, such as the tip in Spezi/Module and Spezi/Interactions with SwiftUI. But noticeably gone from Spezi/Interactions with Application. Expected behaviorAny alternatives to avoid the deprecation notice? I may just be missing something obvious, but I am not sure. Additional contextNo response Code of Conduct
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Thank you for reaching out @Dlemex! Overriding the methods and calling the super methods should be the way to go. Can you share some more details about the code and the example that triggers the deprivation warning? Once we have that @Supereg can probably provide some additional context on this 👍 |
Beta Was this translation helpful? Give feedback.
-
unless i'm missing something here, the easiest approach would be to simply define a custom AFAIK, all modules are intialized and configured before |
Beta Was this translation helpful? Give feedback.
unless i'm missing something here, the easiest approach would be to simply define a custom
Module
, add it to the app's SpeziConfiguration
, and use the module'sconfigure()
function to register the background task.AFAIK, all modules are intialized and configured before
willFinishLaunching
returns