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

[Bug]: In AppboyAppDelegate, the fetchCompletionHandler is called twice #107

Open
pletoss opened this issue Feb 14, 2025 · 2 comments
Open
Labels

Comments

@pletoss
Copy link

pletoss commented Feb 14, 2025

Braze Unity SDK Version

7.1.0

Steps To Reproduce

The fetchCompletionHandler in AppboyAppDelegate is invoked twice:
• First Call: Link to first occurrence
• Second Call: Link to second occurrence

Normally, calling the completion handler twice might not be an issue. However, when combined with FirebaseMessaging/GoogleUtilities’ swizzled code (see this exception trigger), it provokes an exception because GoogleUtilities does not expect multiple invocations.

For reference, here’s the crash stack trace:

Crashed: com.apple.main-thread
0  libdispatch.dylib              0x39e5c dispatch_group_leave.cold.1 + 36
1  libdispatch.dylib              0x4e20 _dispatch_group_wake + 134
2  BrazeKit                       0x1b4e3c OUTLINED_FUNCTION_0 + 12160
3  BrazeKit                       0x86d1c OUTLINED_FUNCTION_4 + 584
4  libdispatch.dylib              0x2248 _dispatch_call_block_and_release + 32
5  libdispatch.dylib              0x3fa8 _dispatch_client_callout + 20
6  libdispatch.dylib              0x12a34 _dispatch_main_queue_drain + 984
7  libdispatch.dylib              0x1264c _dispatch_main_queue_callback_4CF + 44
8  CoreFoundation                 0x79bcc __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
9  CoreFoundation                 0x761c0 __CFRunLoopRun + 1996
10 CoreFoundation                 0xc8284 CFRunLoopRunSpecific + 588
11 GraphicsServices               0x14c0 GSEventRunModal + 164
12 UIKitCore                      0x3ee674 -[UIApplication _run] + 816
13 UIKitCore                      0x14e88 UIApplicationMain + 340
14 UnityFramework                 0x17e54 -[UnityFramework runUIApplicationMainWithArgc:argv:] + 102 ([main.mm:102](http://main.mm:102/))
15 GameName             0x412c main + 28 ([main.mm:28](http://main.mm:28/))
16 ???                            0x1ba521de8 (Missing

Expected Behavior

fetchCompletionHandler should be called exactly once.

Actual Incorrect Behavior

It is called twice—once via the superclass’s didReceiveRemoteNotification:fetchCompletionHandler and once within BrazeKit—triggering an exception in FirebaseMessaging/GoogleUtilities.

@pletoss
Copy link
Author

pletoss commented Feb 14, 2025

Here's a proposed solution that worked for our project: #108. It's heavily inspired by GoogleUtilities's pattern for this exact same situation.

@nigelfaustino
Copy link

Thank you for contributing; we will look into this.

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

No branches or pull requests

2 participants