Skip to content
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

weird background error that Doesn't crash the app? #58

Open
biblicabeebli opened this issue Mar 12, 2024 · 1 comment
Open

weird background error that Doesn't crash the app? #58

biblicabeebli opened this issue Mar 12, 2024 · 1 comment

Comments

@biblicabeebli
Copy link
Member

Getting these errors on at least my development build.... but not consistently. App doesn't crash. Am confused.

Main Thread Checker: UI API called on a background thread: -[UIApplication delegate]
PID: 34781, TID: 1988520, Thread name: (none), Queue name: com.apple.root.background-qos, QoS: 9
Backtrace:
4   GoogleUtilities                     0x0000000105c2468c __47+[GULAppDelegateSwizzler proxyOriginalDelegate]_block_invoke + 44
5   libdispatch.dylib                   0x000000010659ab34 _dispatch_client_callout + 20
6   libdispatch.dylib                   0x000000010659c690 _dispatch_once_callout + 140
7   GoogleUtilities                     0x0000000105c246ec +[GULAppDelegateSwizzler proxyOriginalDelegateIncludingAPNSMethods] + 44
8   Beiwe2                              0x00000001048d1950 -[FIRMessagingRemoteNotificationsProxy swizzleMethodsIfPossible] + 48
9   Beiwe2                              0x00000001048c18a4 -[FIRMessaging configureNotificationSwizzlingIfEnabled] + 128
10  Beiwe2                              0x00000001048c17cc __36+[FIRMessaging componentsToRegister]_block_invoke + 236
11  Beiwe2                              0x00000001048a2ae4 -[FIRComponentContainer instantiateInstanceForProtocol:withBlock:] + 68
12  Beiwe2                              0x00000001048a2c5c -[FIRComponentContainer instanceForProtocol:] + 184
13  Beiwe2                              0x00000001048c1350 +[FIRMessaging messaging] + 88
14  Beiwe2                              0x0000000104713d74 $s6Beiwe211AppDelegateC12firebaseLoopyyFyyYbcfU_ + 436
15  Beiwe2                              0x0000000104629b94 $sIegh_IeyBh_TR + 48
16  libdispatch.dylib                   0x0000000106598f50 _dispatch_call_block_and_release + 32
17  libdispatch.dylib                   0x000000010659ab34 _dispatch_client_callout + 20
18  libdispatch.dylib                   0x00000001065aef0c _dispatch_root_queue_drain + 968
19  libdispatch.dylib                   0x00000001065af6cc _dispatch_worker_thread2 + 188
20  libsystem_pthread.dylib             0x0000000219613928 _pthread_wqthread + 228
21  libsystem_pthread.dylib             0x0000000219613a04 start_wqthread + 8
Main Thread Checker: UI API called on a background thread: -[UIApplication delegate]
PID: 34781, TID: 1988520, Thread name: (none), Queue name: com.apple.root.background-qos, QoS: 9
Backtrace:
4   GoogleUtilities                     0x0000000105c2468c __47+[GULAppDelegateSwizzler proxyOriginalDelegate]_block_invoke + 44
5   libdispatch.dylib                   0x000000010659ab34 _dispatch_client_callout + 20
6   libdispatch.dylib                   0x000000010659c690 _dispatch_once_callout + 140
7   GoogleUtilities                     0x0000000105c246ec +[GULAppDelegateSwizzler proxyOriginalDelegateIncludingAPNSMethods] + 44
8   Beiwe2                              0x00000001048d1950 -[FIRMessagingRemoteNotificationsProxy swizzleMethodsIfPossible] + 48
9   Beiwe2                              0x00000001048c18a4 -[FIRMessaging configureNotificationSwizzlingIfEnabled] + 128
10  Beiwe2                              0x00000001048c17cc __36+[FIRMessaging componentsToRegister]_block_invoke + 236
11  Beiwe2                              0x00000001048a2ae4 -[FIRComponentContainer instantiateInstanceForProtocol:withBlock:] + 68
12  Beiwe2                              0x00000001048a2c5c -[FIRComponentContainer instanceForProtocol:] + 184
13  Beiwe2                              0x00000001048c1350 +[FIRMessaging messaging] + 88
14  Beiwe2                              0x0000000104713d74 $s6Beiwe211AppDelegateC12firebaseLoopyyFyyYbcfU_ + 436
15  Beiwe2                              0x0000000104629b94 $sIegh_IeyBh_TR + 48
16  libdispatch.dylib                   0x0000000106598f50 _dispatch_call_block_and_release + 32
17  libdispatch.dylib                   0x000000010659ab34 _dispatch_client_callout + 20
18  libdispatch.dylib                   0x00000001065aef0c _dispatch_root_queue_drain + 968
19  libdispatch.dylib                   0x00000001065af6cc _dispatch_worker_thread2 + 188
20  libsystem_pthread.dylib             0x0000000219613928 _pthread_wqthread + 228
21  libsystem_pthread.dylib             0x0000000219613a04 start_wqthread + 8
=================================================================
Main Thread Checker: UI API called on a background thread: -[UIApplication setDelegate:]
PID: 34781, TID: 1988520, Thread name: (none), Queue name: com.apple.root.background-qos, QoS: 9
Backtrace:
4   GoogleUtilities                     0x0000000105c24efc +[GULAppDelegateSwizzler reassignAppDelegate] + 88
5   GoogleUtilities                     0x0000000105c266fc +[GULAppDelegateSwizzler proxyAppDelegate:] + 132
6   GoogleUtilities                     0x0000000105c246ac __47+[GULAppDelegateSwizzler proxyOriginalDelegate]_block_invoke + 76
7   libdispatch.dylib                   0x000000010659ab34 _dispatch_client_callout + 20
8   libdispatch.dylib                   0x000000010659c690 _dispatch_once_callout + 140
9   GoogleUtilities                     0x0000000105c246ec +[GULAppDelegateSwizzler proxyOriginalDelegateIncludingAPNSMethods] + 44
10  Beiwe2                              0x00000001048d1950 -[FIRMessagingRemoteNotificationsProxy swizzleMethodsIfPossible] + 48
11  Beiwe2                              0x00000001048c18a4 -[FIRMessaging configureNotificationSwizzlingIfEnabled] + 128
12  Beiwe2                              0x00000001048c17cc __36+[FIRMessaging componentsToRegister]_block_invoke + 236
13  Beiwe2                              0x00000001048a2ae4 -[FIRComponentContainer instantiateInstanceForProtocol:withBlock:] + 68
14  Beiwe2                              0x00000001048a2c5c -[FIRComponentContainer instanceForProtocol:] + 184
15  Beiwe2                              0x00000001048c1350 +[FIRMessaging messaging] + 88
16  Beiwe2                              0x0000000104713d74 $s6Beiwe211AppDelegateC12firebaseLoopyyFyyYbcfU_ + 436
17  Beiwe2                              0x0000000104629b94 $sIegh_IeyBh_TR + 48
18  libdispatch.dylib                   0x0000000106598f50 _dispatch_call_block_and_release + 32
19  libdispatch.dylib                   0x000000010659ab34 _dispatch_client_callout + 20
20  libdispatch.dylib                   0x00000001065aef0c _dispatch_root_queue_drain + 968
21  libdispatch.dylib                   0x00000001065af6cc _dispatch_worker_thread2 + 188
22  libsystem_pthread.dylib             0x0000000219613928 _pthread_wqthread + 228
23  libsystem_pthread.dylib             0x0000000219613a04 start_wqthread + 8
Main Thread Checker: UI API called on a background thread: -[UIApplication setDelegate:]
PID: 34781, TID: 1988520, Thread name: (none), Queue name: com.apple.root.background-qos, QoS: 9
Backtrace:
4   GoogleUtilities                     0x0000000105c24efc +[GULAppDelegateSwizzler reassignAppDelegate] + 88
5   GoogleUtilities                     0x0000000105c266fc +[GULAppDelegateSwizzler proxyAppDelegate:] + 132
6   GoogleUtilities                     0x0000000105c246ac __47+[GULAppDelegateSwizzler proxyOriginalDelegate]_block_invoke + 76
7   libdispatch.dylib                   0x000000010659ab34 _dispatch_client_callout + 20
8   libdispatch.dylib                   0x000000010659c690 _dispatch_once_callout + 140
9   GoogleUtilities                     0x0000000105c246ec +[GULAppDelegateSwizzler proxyOriginalDelegateIncludingAPNSMethods] + 44
10  Beiwe2                              0x00000001048d1950 -[FIRMessagingRemoteNotificationsProxy swizzleMethodsIfPossible] + 48
11  Beiwe2                              0x00000001048c18a4 -[FIRMessaging configureNotificationSwizzlingIfEnabled] + 128
12  Beiwe2                              0x00000001048c17cc __36+[FIRMessaging componentsToRegister]_block_invoke + 236
13  Beiwe2                              0x00000001048a2ae4 -[FIRComponentContainer instantiateInstanceForProtocol:withBlock:] + 68
14  Beiwe2                              0x00000001048a2c5c -[FIRComponentContainer instanceForProtocol:] + 184
15  Beiwe2                              0x00000001048c1350 +[FIRMessaging messaging] + 88
16  Beiwe2                              0x0000000104713d74 $s6Beiwe211AppDelegateC12firebaseLoopyyFyyYbcfU_ + 436
17  Beiwe2                              0x0000000104629b94 $sIegh_IeyBh_TR + 48
18  libdispatch.dylib                   0x0000000106598f50 _dispatch_call_block_and_release + 32
19  libdispatch.dylib                   0x000000010659ab34 _dispatch_client_callout + 20
20  libdispatch.dylib                   0x00000001065aef0c _dispatch_root_queue_drain + 968
21  libdispatch.dylib                   0x00000001065af6cc _dispatch_worker_thread2 + 188
22  libsystem_pthread.dylib             0x0000000219613928 _pthread_wqthread + 228
23  libsystem_pthread.dylib             0x0000000219613a04 start_wqthread + 8
@biblicabeebli
Copy link
Member Author

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)
                }
            }
        }
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant