Answered

Seeing crash on Intercom SDK initialization on react native iOS app: "Unrecognized selector sent to instance" on re


Here is the crash log, also noticing the error about email not present. I am not sending user email to intercom. 

```

INTERCOM ERROR - 'email' must be an NSString and can't be nil or empty
 [Intercom] ERROR - Tried to update user, but there was a problem with the SDK's initialisation.
[Intercom] ERROR - Tried to send metrics, but there was a problem with the SDK's initialisation.
 -[NSNull code]: unrecognized selector sent to instance 0x111a1d590
2023-05-01 16:56:50.683285-0700 ZiggyReactNative[42315:4564543] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull code]: unrecognized selector sent to instance 0x111a1d590'
*** First throw call stack:
(
    0   CoreFoundation                      0x00000001117b778b __exceptionPreprocess + 242
    1   libobjc.A.dylib                     0x000000010dc37b73 objc_exception_throw + 48
    2   CoreFoundation                      0x00000001117c68c4 +[NSObject(NSObject) instanceMethodSignatureForSelector:] + 0
    3   CoreFoundation                      0x00000001117bbc66 ___forwarding___ + 1443
    4   CoreFoundation                      0x00000001117bde08 _CF_forwarding_prep_0 + 120
    5   React                               0x000000010d60a6dc RCTJSErrorFromCodeMessageAndNSError + 548
    6   React                               0x000000010d60a485 RCTJSErrorFromNSError + 197
    7   React                               0x000000010d5daef1 __41-[RCTModuleMethod processMethodSignature]_block_invoke_4.84 + 74
    8   Intercom                            0x0000000109d82115 shouldRenderOnNewLine + 35719
    9   Intercom                            0x0000000109d4c23a IntercomSDK_PINRemoteImageManagerSubclassOverridesSelector + 273039
    10  Intercom                            0x0000000109d4c49b IntercomSDK_PINRemoteImageManagerSubclassOverridesSelector + 273648
    11  Intercom                            0x0000000109d45594 IntercomSDK_PINRemoteImageManagerSubclassOverridesSelector + 245225
    12  Intercom                            0x0000000109d81e13 shouldRenderOnNewLine + 34949
    13  Intercom                            0x0000000109d69966 IntercomSDK_PINRemoteImageManagerSubclassOverridesSelector + 393659
    14  Intercom                            0x0000000109d6ab96 IntercomSDK_PINRemoteImageManagerSubclassOverridesSelector + 398315
    15  libdispatch.dylib                   0x0000000112478e40 _dispatch_call_block_and_release + 12
    16  libdispatch.dylib                   0x000000011247a0d9 _dispatch_client_callout + 8
    17  libdispatch.dylib                   0x0000000112489b86 _dispatch_main_queue_drain + 1330
    18  libdispatch.dylib                   0x0000000112489646 _dispatch_main_queue_callback_4CF + 31
    19  CoreFoundation                      0x00000001117156cc __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
    20  CoreFoundation                      0x000000011170ffbe __CFRunLoopRun + 2429
    21  CoreFoundation                      0x000000011170f264 CFRunLoopRunSpecific + 560
    22  GraphicsServices                    0x000000011613424e GSEventRunModal + 139
    23  UIKitCore                           0x0000000127a1f7bf -[UIApplication _run] + 994
    24  UIKitCore                           0x0000000127a245de UIApplicationMain + 123
    25  ZiggyReactNative                    0x0000000100130cf8 ZiggyReactNative + 23800
    26  dyld                                0x0000000108a74384 start_sim + 10
    27  ???                                 0x000000020060141f 0x0 + 8596231199
)
libc++abi: terminating due to uncaught exception of type NSException

```

icon

Best answer by Racheal 4 May 2023, 21:39

View original

16 replies

Noticed few problem with the iOS sdk 

 

  1. iOS code is expecting an email even it is a option attribute: https://github.com/intercom/intercom-react-native/blob/caa48dd963d07e8ec737833d358b49cea9b0528f/ios/IntercomModule.m#L114
  2. Looks like IOS SDK is not handling the case the SDK might not be initialized, instead of throwing error it fails. 
  3. Would be nice for way to expose an API if initialization was successfully done for consuming apps

 

Userlevel 4
Badge

Hey @Shiva Srivastava Racheal from the support engineer team here👋 

 

It looks like you were in touch with my teammate Ayk on this and were able to resolve the issue. For future viewers, the issue is resolved on 14.2.0 but since the latest React Native SDK still points to an earlier version the issue still occurs in there. Once our team releases a new React Native SDK version which will be pointing to v14.2.0+ the issue will be resolved in that SDK too!

This is still an issue on intercom-react-native@5.1.1 with iOS SDK 15

 

This is still an issue on intercom-react-native@5.1.1 with iOS SDK 15

 

I’m also having this issue

Same issue RN 0.71.11

Same issue using intercom-react-native@5.1.1 with iOS SDK 15 ,  react native 0.65. This should not be marked as solved.

This is my stack trace captured by sentry

 

 

+1

+1

 

+1

+1 We’re also running into this issue with 5.2.0

+1, we’re seeing this issue with “intercom-react-native” 5.2.0 and “react-native” 0.71.8

+1, we are also seeing this issue on the latest React native version. 

 

"react-native": "0.72.4",or     "react-native": "0.71.4",
"@intercom/intercom-react-native": "^5.2.0",

maybe i’m doing some wrong thing, but when login user I got the details about it and do such a code: 

useEffect(() => {
if (user) {
Intercom.setUserHash(user?.uuid).then(() => {
Intercom.loginUserWithUserAttributes({
email: user?.email,
userId: user?.uuid,
languageOverride: 'en',
signedUpAt: Date.now(),
unsubscribedFromEmails: false,
});
});
}
}, [user]);

also tried without setUserHash and only with email and uuid. 
 

 

Same problem, any update from the intercom dev team?

We’re also experiencing this issue:

"@intercom/intercom-react-native": "^5.2.0"
"react-native": "0.72.3",

+1, exactly the same issue"@intercom/intercom-react-native": "^5.3.1",
"react-native": "0.72.4",

+1, we are also seeing this issue on the latest React native version. 

 

"react-native": "0.72.4",or     "react-native": "0.71.4",
"@intercom/intercom-react-native": "^5.2.0",

maybe i’m doing some wrong thing, but when login user I got the details about it and do such a code: 

useEffect(() => {
if (user) {
Intercom.setUserHash(user?.uuid).then(() => {
Intercom.loginUserWithUserAttributes({
email: user?.email,
userId: user?.uuid,
languageOverride: 'en',
signedUpAt: Date.now(),
unsubscribedFromEmails: false,
});
});
}
}, [user]);

also tried without setUserHash and only with email and uuid. 
 

 

 

Userlevel 2
Badge +2

Hi

This is fixed in [Release 6.0.1](https://github.com/intercom/intercom-react-native/releases/tag/6.0.1)

Thanks

Reply