Answered

Why does my React Native app keep crashing on iOS?


Hey I'm trying to integrate Intercom with the current React Native app we're working on and while it's working perfectly fine on Android, the iOS keeps crashing.

 

Here are the error details:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[Intercom setReactNativeVersion:]: unrecognized selector sent to class 0x112eaf318'
terminating with uncaught exception of type NSException

P.S. I tried adding "react native" as one of the forum question topics but it wasn't available. 

icon

Best answer by Eric Fitz 5 August 2021, 16:36

View original

15 replies

Userlevel 1

Hey @spud​, just to confirm that you're using our official React Native SDK for this?

Yes I'm using the one made by Intercom.

Link: intercom/intercom-react-native: React Native wrapper to bridge our iOS and Android SDK (github.com)

 

Userlevel 1

Thanks for confirming that for me! What version of Cocoapods are you using?

I am using gem version 1.10.1.

Userlevel 1

It looks like you have version 10.0.0 of the Intercom iOS SDK bundled in the React Native wrapper. You need to run version 10.0.1. By running 

`pod update Intercom` in the iOS directory in our React Native plugin, this will fetch the correct Intercom iOS SDK for you. If you try running your app again after doing this, the error should be gone.

I updated the pod, however it did not solve my problem. Here are the versions of Intercom used in the Podfile.lock:

- Intercom (10.0.3)
- intercom-react-native (1.0.3):
- Intercom (~> 10.0)
- React-Core

 

I looked at the "intercom-react-native.podspec" in the intercom react-native GitHub repository and at the bottom of the file, it sets the dependency to 10.0.

Link:

intercom-react-native/intercom-react-native.podspec at main · intercom/intercom-react-native (github.com)

Update: updating the s.dependency for Intercom to 10.0.1 or 10.0.3 did not solve the problem.

 

Userlevel 1

Hey @spud​, can you also link to the GitHub code block where you've experienced this after updating to 10.0.1 and 10.0.3?

#5 0x0000000101738414 in +[IntercomModule initialize:withAppId:] at /Users/Unfocused/Documents/Projects/SpudApp/node_modules/@intercom/intercom-react-native/ios/IntercomModule.m:41

 

#6 0x0000000100d75828 in -[AppDelegate application:didFinishLaunchingWithOptions:] at /Users/Unfocused/Documents/Projects/SpudApp/ios/SpudApp/AppDelegate.m:58

 

[IntercomModule initialize:@"KEY IS HERE" withAppId:@"APP ID IS HERE"];

 

 

That's as far as the stack trace goes in the swift/objc code, the rest is assembly instructions

 

In the library, it crashes here:

[Intercom setReactNativeVersion:version]; <-- This line

Intercom setApiKey:apiKey forAppId:appId];

 

Line 41 of IntercomModule.m

 

It works if I manually put my information in the example build from your GitHub so this leads me to believe it is related to the build_frameworks.sh build script.

 

Unrecognized selector in this case I believe refers to the fact that the header file or somewhere in the code it says the function exists but it is not defined anywhere and so it crashes. Seems like an issue with the library generated for release.

 

Those are my initial thoughts. Would love to hear your thoughts on this!

Having the same issue with intercom-react-native (1.0.5) and Intercom 10.1.x.

With debugging I can see that a value is passed to `setReactNativeVersion`.

Commenting out setReactNativeVersion stops the crash.

Any update about this? I have the same problem.

I followed the installation guide (https://developers.intercom.com/installing-intercom/docs/react-native-installation and I can build it for Android (and chat is working), but not for iOS.

Exception NSException * "+[Intercom setReactNativeVersion:]: unrecognized selector sent to class 0x110951720" 0x0000600000f19830

Podfile.lock:

- React (0.63.3):
...
- Intercom (10.1.4)
- intercom-react-native (1.0.5):
- Intercom (~> 10.1.0)
- React-Core

 

Userlevel 1

Hey @user800​, other customers experienced this issue reported that running the most recent version of our React Native SDK and clearing their cache resolved the issue. Can you advise if you've followed both of these steps?

@eric f11​ Yes I followed both of them. Isn't my version the latest?

Where can I find these other users' comments or any other help?

Userlevel 1

@user800​, this solution was presented to me by our Mobile team directly. I would advise you to contact our Support team directly about this issue - you can message them through the Messenger on your Intercom workspace. Please let me know when you've done this and I'll make sure that your conversation is routed correctly.

Reply