Search code examples
iosreact-nativeintercomintercom.jsintercom-ios

Use of undeclared identifier 'Intercom' in AppDelegate.m - react-native-intercom


I am using react-native-intercom to manage Intercom in my app. I have installed the Intercom iOS SDK using CocoaPods, and linked the react-native-intercom. But Build failed with error Use of undeclared identifier 'Intercom' in AppDelegate.m - react-native-intercom

steps 1 (Install and Link Intercom)

npm install react-native-intercom
react-native link react-native-intercom

step 2 (Import Intercom in AppDelegate.m)
#import "Intercom/intercom.h"


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[Intercom setApiKey:@"myApiKey" forAppId:@"myAppId"];
[Intercom registerUnidentifiedUser];

}

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken 
{
[Intercom setDeviceToken:deviceToken];
}

Solution

  • I am using react-native and fixed this issue by changing intercom into Intercom.

    #import "Intercom/Intercom.h"

    use #import "Intercom/Intercom.h" instead of #import "Intercom/intercom.h" in AppDelegate.m file

    If you go into the framework's Headers folder in your workspace (Workspace -> Intercom.framework -> Headers) you will see the Intercom.h file.