Answered

Why is the iOS SDK crashing our app any time a push notification is received in the background?

  • 7 October 2020
  • 7 replies
  • 277 views

The iOS SDK is crashing our app anytime a push notification is received in the background and sometimes even in the foreground on iOS 14.

 

** I have attempted to report this to Intercom via the messenger and haven't received a response in > 4 days. **

 

Our mobile app is built on Ionic and we are using Firebase messaging as our main push notification service.

 

If the Intercom SDK is installed in the project - the app will crash when a background notification is received - and on iOS 14 - sometimes even when in the foreground.

 

This has required us to completely remove the SDK.

 

It has been identified that the mere presence of the SDK - even if we don't call or reference it in code - causes this issue.

 

We have since removed it and had 0 crashes.

icon

Best answer by Brandon @ 14 October 2020, 17:10

View original

7 replies

Userlevel 1

Hey @brandon @​, looks like you've shared the crash details with us through the Messenger, I'll take a look here and get back to you as soon as I have an update.

Userlevel 1

Our mobile team has informed me that this was a serverside issue, for which a fix was shipped yesterday. You should be able to re-install our SDK and receive push notifications without issue now!

 

However, do let me know if that's not the case and you're still being impacted. If you are, please share the crash logs with me here so that we can dive in further.

@eric f11​ Unfortunately we are still seeing this issue.

 

Our dev team has now upgraded to XCode 12 so we are using the latest 8.0.0 Pod/SDK. Also - the issue seems to be broader than described - EVERY push notification triggers a crash - whether in foreground or background on iOS14. This starts occurring as soon as we install the Pod. No other code changes. (so skipping the Intercom Cordova plugin all together and just installing the Pod via Xcode and hitting Run)

 

Also - to clarify - these push notifications are coming from our servers through FCM - these are not Intercom generated push messages.

 

The crash is actually occurring in AppDelegate+FirebaseMessagingPlugin.m in application.didReceiveRemoteNotification() on call to the completionHandler():

 

// handle incoming notification messages while app is in the background

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo

fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {

  BOOL value = application.applicationState != UIApplicationStateActive;  

[self postNotification:userInfo background:value];  

completionHandler(UIBackgroundFetchResultNewData); <-- HERE

}

 

Crash is: EXC_BREAKPOINT (code=1, subcode=0x1051f2fd8)

 

What is interesting that we are seeing - is this is in the background notification call - which is being triggered even if the app is in the foreground. Which is probably the reason for the crash.

 

When the message comes in - the foreground handler is triggered successfully - but then the background handler fires next - even when it should.

 

Uninstalling the Pod and the background handler stops firing incorrectly.

 

That all said - when the app is in the background - that same line crashes as well and there is no duplication. But again - only if the Intercom pod is installed. Works fine otherwise.

 

---

 

Here is an example foreground crash report:

 

Date/Time: 2020-10-08 12:11:42.000 -0500

OS Version: iOS 14.0.1 (18A393)

Report Version: 104

 

Exception Type: EXC_BREAKPOINT (5)

Exception Codes: 0x00000000 at 0x000000018f2fdef0

Crashed Thread: 0

 

Thread 0 Crashed:

0 libdispatch.dylib 0x000000018f2fdef0 0x18f295000 + 429808

1 libdispatch.dylib 0x000000018f2c7488 0x18f295000 + 205960

2 GamePlus 0x0000000100c323f8 -[AppDelegate(FirebaseMessagingPlugin) application:didReceiveRemoteNotification:fetchCompletionHandler:] + 208

3 GoogleUtilities 0x00000001017d2a08 -[GULAppDelegateSwizzler application:donor_didReceiveRemoteNotification:fetchCompletionHandler:] + 408

4 UIKitCore 0x0000000191f1f790 0x1913db000 + 11814800

5 PushKit 0x00000001b65823a4 0x1b657e000 + 17316

6 libdispatch.dylib 0x000000018f2f5298 0x18f295000 + 393880

7 libdispatch.dylib 0x000000018f2f6280 0x18f295000 + 397952

8 libdispatch.dylib 0x000000018f2d85b8 0x18f295000 + 275896

9 CoreFoundation 0x000000018f63cc30 0x18f5a3000 + 629808

10 CoreFoundation 0x000000018f6370e8 0x18f5a3000 + 606440

11 CoreFoundation 0x000000018f636200 CFRunLoopRunSpecific + 572

12 GraphicsServices 0x00000001a5731598 GSEventRunModal + 160

13 UIKitCore 0x0000000191efc004 0x1913db000 + 11669508

14 UIKitCore 0x0000000191f015d8 UIApplicationMain + 164

15 GamePlus 0x0000000100bfcd58 main + 64

16 libdyld.dylib 0x000000018f315598 0x18f314000 + 5528

 

Amending my comments above - the didReceiveRemoteNotification() is called when the app is in the foreground as well when Intercom is not installed - it just doesn't crash

 

One note - we do specify "content-available": 1 in our message payload. Not sure if that is relevant here.

 

So I think the key takeways are:

 

  • Ionic / Cordova Application (Ionic: 5.3.4; Cordova iOS: 6.1.1)
  • Firebase Messaging Plugin (Plugin: 4.6.1; Pod: 6.32.2)
  • Intercom Pod 8.0.0 (whether via Intercom Cordova plugin or manual Pod add)
  • App crashes on receiving push notification from FCM.
Userlevel 1

Thanks so much for your detailed reply here, @brandon @​. As this looks to be an issue that's quite specific to your own build, I've asked one of our mobile engineers to contact you through the Messenger, they'll be in touch as soon as they can!

Sharing our resolution here for anyone else encountering this problem. The intercom engineering team shared there is an Info.plist setting that can be added to disable the iOS SDKs automatic push notification handling:

 

IntercomAutoIntegratePushNotifications = NO

 

For our Cordova implementation, we forked the plugin, removed the push notification swizzling, and added a plugin.xml setting to add this config value to the plist. Our implementation can be seen here:

 

https://github.com/objectstudio/intercom-cordova/p>

Userlevel 1

Thanks so much for sharing the resolution, @brandon @​ - glad you were able to get this resolved, and thanks for posting it here so that other Connectors can learn from it, too!

Reply