Open biblicabeebli opened 8 months ago
This is the content of the function, we are trying to call that inside main.async. is that wrong?
func firebaseLoop() {
// The app cannot register with firebase until it gets a token, which only occurs at registration time, and it needs access to the appDelegate.
// This must be called after FirebaseApp.configure(), so we dispatch it and wait until the app is initialized from RegistrationViewController...
GLOBAL_BACKGROUND_QUEUE.async {
while !StudyManager.real_study_loaded {
sleep(1) // print("waiting for study to load")
}
while FirebaseApp.app() == nil { // FirebaseApp.app() emits the firebase spam log
sleep(1) // print("waiting firbase app to be ready")
}
Messaging.messaging().delegate = self
UNUserNotificationCenter.current().delegate = self
// App crashes if this isn't called on main thread
DispatchQueue.main.async {
UIApplication.shared.registerForRemoteNotifications()
if let token = Messaging.messaging().fcmToken {
self.sendFCMToken(fcmToken: token)
}
}
}
}
Getting these errors on at least my development build.... but not consistently. App doesn't crash. Am confused.