forked from parse-community/Parse-Swift
-
- Notifications
You must be signed in to change notification settings - Fork 6
Labels
bugSomething isn't workingSomething isn't working
Description
Discussed in #167
Originally posted by project-saf March 28, 2024
Very infrequently, I run in to a crash along the lines of:
ParseSwift/Parse.swift:106: Fatal error: Unexpectedly found nil while unwrapping an Optional valueHere is my AppDelegate:
@main class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { Task { guard let AppID = Secrets.App_ID, let ClientKey = Secrets.Cli_ID, let AppURL, let LiveURL else { fatalError("Incorrect implementation of Secrets") } let config = ParseConfiguration(AppID, ClientKey, AppURL, LiveURL) try await initialize(configuration: config) } return true } }I was hesitant to report it since I can't reproduce it consistently, but I thought I'd flag it anyway just in case you:
(a) wanted to know, and/or
(b) had any insight as to what might be causing the issue.
It definitely does crash with the same error if I comment out the Task in didFinishLaunching and then run a query.
My guess therefore is that it is some sort of issue with the login task being de-prioritised over some other Parse function like a query.
Line 106 is the following:
l104 /// The current `ParseConfiguration` for the ParseSwift client. l105 public var configuration: ParseConfiguration { l106 Parse.configuration l107 }Questions
- Is my AppDelegate code the intended way for Parse to be initialised?
- Is there a way to guarantee the login task completes either before returning from
didFinishLaunching, or at least completes first before any other Tasks? - Is it wise/possible to 'bake' into ParseSwift a means of ensuring that a query won't run until after the
initializefunction has completed? For example, a flag that makes those other tasks continue waiting until after initialize has returned.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working