🚀 New: Reach customers automatically with AI-powered outbound voice campaigns.

Book your AI agent demo
Start for free
Table of Content

    React Native iOS SDK

    • September 9, 2025
    • 3 mins read

    Table of Content

      REVE Chat’s iOS SDK can be seamlessly integrated with your mobile apps and enable your team deliver in-app messaging to your app users for better engagement and customer support.

      Getting Started with React Native iOS SDK

      This documentation shows you how to embed REVE Chat iOS SDK in an React Native application and get started in a few minutes. Necessary or minimum requirements:

      • Xcode 26 or above
      • iOS 15.1 or above
      • React-native environment setup

      Note: iOS testing requires a physical device. The SDK framework is device-only (arm64) and will not link against the iOS Simulator.

      React Native iOS SDK integration process

      To integrate React Native iOS SDK with your iOS mobile app, please follow the below mentioned steps:

      Step1: Update podfile

      Go to your projects iOS folder. Replace your Podfile with the following, keeping your own target name and any pods you already use.

      # Required on React Native 0.77+. RN ships its own SocketRocket inside the
      # prebuilt ReactNativeDependencies.framework, which never gets embedded, so the
      # app crashes at launch with:
      #   dyld: Library not loaded: @rpath/SocketRocket.framework/SocketRocket
      # These two lines build RN's dependencies from source instead.
      ENV['RCT_USE_RN_DEP'] = '0'
      ENV['RCT_USE_PREBUILT_RNCORE'] = '0'
      
      # ... keep the require/platform/prepare_react_native_project! lines ...
      
      # ReveChatSDK ships as a prebuilt dynamic framework.
      use_frameworks! :linkage => :dynamic
      
      target 'YourApp' do
        config = use_native_modules!
      
        use_react_native!(
          :path => config[:reactNativePath],
          :app_path => "#{Pod::Config.instance.installation_root}/.."
        )
      
        pod 'ReveChatSDK', '3.0.2.10'
      
        post_install do |installer|
          react_native_post_install(
            installer,
            config[:reactNativePath],
            :mac_catalyst_enabled => false
          )
      
          # Xcode 27 rejects any deployment target below 15.0 outright.
          installer.pods_project.targets.each do |target|
            target.build_configurations.each do |config|
              current = config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].to_f
              if current > 0 && current < 15.0
                config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '15.0'
              end
            end
          end
      
          # Xcode 26+ rejects AFNetworking's <netinet6/in6.h> import (private header).
          af_dir = File.join(installer.sandbox.root, 'AFNetworking', 'AFNetworking')
          if File.directory?(af_dir)
            import_line = '#import <netinet6/in6.h>'
            Dir.glob(File.join(af_dir, '**', '*.{h,m}')).each do |path|
              lines = File.readlines(path)
              filtered = lines.reject { |l| l.strip == import_line }
              next if filtered.size == lines.size
      
              mode = File.stat(path).mode & 0o7777
              File.chmod(0o644, path)
              File.write(path, filtered.join)
              File.chmod(mode, path)
            end
          end
        end
      end

      Now run pod install in the iOS directory from command line.

      Step 2: Update your plist

      The iOS SDK uses the camera and photo library in iOS.

      If your app does not already request permissions for these features, you should update your info.plist file with a usage description for NSPhotoLibraryUsageDescription and NSCameraUsageDescription.

      /* You can do this by adding the following lines in your plist source code */
      <key>NSPhotoLibraryUsageDescription</key>
      <string><description to use photo library></string>
      <key>NSCameraUsageDescription</key>
      <string><description to use camera></string> 
      <key>NSAppTransportSecurity</key>        <dict>
      <key>NSAllowsArbitraryLoads</key>
      <true/></dict>
      <key>NSMicrophoneUsageDescription</key>
      <string><Add your description here></string>

      Step 3: Create REVEChatSDKModule.h

      Create REVEChatSDKModule.h file and write bellow code:

      import Foundation
      import React
      import ReveChatSDK
      import UIKit
      
      @objc(ReveChatSDKModule)
      class ReveChatSDKModule: NSObject {
      
        /// Must outlive the call: the SDK keeps using this object while the chat is open.
        private let reveChatManager = ReveChatManager()
      
        @objc
        func startChat(_ accountId: String,
                       userName: String,
                       userEmail: String,
                       phone: String,
                       resolver resolve: @escaping RCTPromiseResolveBlock,
                       rejecter reject: @escaping RCTPromiseRejectBlock) {
      
          // React Native calls this on its own queue, not the main thread, and
          // everything below touches UIKit.
          DispatchQueue.main.async {
            guard let presenter = Self.topViewController() else {
              reject("NO_PRESENTER", "No view controller to present the chat from", nil)
              return
            }
      
            self.reveChatManager.setupAccount(with: accountId)
            self.reveChatManager.initiateReveChat(with: userName,
                                                  visitorEmail: userEmail,
                                                  visitorMobile: phone,
                                                  on: presenter)
            resolve("success")
          }
        }
      
        private static func topViewController() -> UIViewController? {
          let scene = UIApplication.shared.connectedScenes
            .compactMap { $0 as? UIWindowScene }
            .first { $0.activationState == .foregroundActive }
            ?? UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene }.first
      
          guard var top = scene?.windows.first(where: \.isKeyWindow)?.rootViewController
                  ?? scene?.windows.first?.rootViewController else {
            return nil
          }
          while let presented = top.presentedViewController {
            top = presented
          }
          return top
        }
      
        @objc
        static func requiresMainQueueSetup() -> Bool {
          true
        }
      }
      

      Step 4: Create REVEChatSDKModule.m

      Create REVEChatSDKModule.m and write bellow code:

      #import <React/RCTBridgeModule.h>
      
      @interface RCT_EXTERN_MODULE (ReveChatSDKModule, NSObject)
      
      RCT_EXTERN_METHOD(startChat:(NSString *)accountId
                        userName:(NSString *)userName
                        userEmail:(NSString *)userEmail
                        phone:(NSString *)phone
                        resolver:(RCTPromiseResolveBlock)resolve
                        rejecter:(RCTPromiseRejectBlock)reject)
      
      @end
      

      in Xcode, add both files to the app target (File > Add Files to …, with the app target ticked). Creating them on disk is not enough — they will not be compiled, and JavaScript will see no native module. When Xcode offers to create a bridging header, accept it.

      Step 5: Enable Notification

      You can enable the notification when the app is in background mode. Use the below code:

      * Objective-c
      // In Scenedelegate.h add the following property:
      @property (nonatomic,assign) UIBackgroundTaskIdentifier backgroundUpdateTask;
      
      // In Scenedelegate.m add the following function:
      -(void) endBackgroundUpdateTask {
          [UIApplication.sharedApplication endBackgroundTask:self.backgroundUpdateTask];
          self.backgroundUpdateTask = UIBackgroundTaskInvalid;
      }
      
      // In Scenedelegate.m’s willConnectToSession function add the bellow line:
      self.backgroundUpdateTask = UIBackgroundTaskInvalid;
      
      // In Scenedelegate.m’s sceneDidBecomeActive function add the bellow line:
      [self endBackgroundUpdateTask];
      
      // In Scenedelegate.m’s sceneWillResignActive function add the bellow line:
      self.backgroundUpdateTask = [UIApplication.sharedApplication beginBackgroundTaskWithExpirationHandler:^{
              [self endBackgroundUpdateTask];
      }];
      
      // In Scenedelegate.m’s sceneWillEnterForeground function add the bellow line: 
      [UIApplication sharedApplication].applicationIconBadgeNumber = 0;
      
      * Swift 
      
      var backgroundUpdateTask: UIBackgroundTaskIdentifier = UIBackgroundTaskIdentifier(rawValue: 0)
      
      Method name : “sceneDidBecomeActive” or “applicationDidBecomeActive”
      self.endBackgroundUpdateTask()
      
      Method name “sceneWillResignActive” or “applicationWillResignActive”
      self.backgroundUpdateTask = UIApplication.shared.beginBackgroundTask(expirationHandler: {
                      self.endBackgroundUpdateTask()
                  })
      
      func endBackgroundUpdateTask() {
              UIApplication.shared.endBackgroundTask(self.backgroundUpdateTask)
              self.backgroundUpdateTask = UIBackgroundTaskIdentifier.invalid
          }
      
      // In applicationDidBecomeActive function
      application.applicationIconBadgeNumber = 0

      Additional changes(optional)

      * Objective c
      /* for title while chatting */
      [ReveChatManager sharedManager].title = @"me talking";
      /* for theme color while chatting */
      [ReveChatManager sharedManager].themeColor = [UIColor blueColor];
      /* for background color */
      [ReveChatManager sharedManager].backgroundColor = [UIColor yellowColor];
      /* for navigation bar color */
      [ReveChatManager sharedManager].navBarColor = [UIColor orangeColor];
      /* for tint color of navigation bar while chatting */
      [ReveChatManager sharedManager].headerTintColor = [UIColor whiteColor];
      /* for title color while chatting */
      [ReveChatManager sharedManager].headerTextColor = [UIColor whiteColor];
      /* for incoming chat bubble color */
      [ReveChatManager sharedManager].incomingBubbleColor = [UIColor blueColor];
      /* for outgoing chat bubble color */
      [ReveChatManager sharedManager].outgoingBubbleColor = [UIColor blueColor];
      * Swift
      /* for title while chatting */
      reveChatManager.setChatTitle("Lets chat")
      /* for theme color while chatting*/
      reveChatManager.themeColor = UIColor.blue
      /* for background color*/
      reveChatManager.backgroundColor = UIColor.yellow
      /* for navigation bar color*/
      reveChatManager.navBarColor = UIColor.gray
      /* for tint color of header */
      reveChatManager.headerTintColor = UIColor.red
      /* for title color while chatting*/
      reveChatManager.headerTextColor = UIColor.black
      /* for incoming chat bubble color*/
      reveChatManager.incomingBubbleColor = UIColor.blue
      /* for outgoing chat bubble color*/
      reveChatManager.outgoingBubbleColor = UIColor.yellow

      FAQs (General issues faced while integrating)

      1.Getting Crash when initiating revechat sdk reason: the pod has been updated on the cocoa pods solution: run ‘pod update‘ in the terminal on your project path

      2. Build fails with: Use of private header from outside its module: ‘netinet6/in6.h’

      Reason: the post_install hook is missing from your Podfile.
      Solution: add the hook from Step 1, then run pod install again.

      3.Build fails with: the range of supported deployment target versions is 15.0 to 27.x

      Reason: Xcode 27 rejects a deployment target below 15.0, where Xcode 26 only warned.
      Solution: add the deployment-target loop from Step 1, then run pod install again.

      4.App crashes at launch with: Library not loaded: @rpath/SocketRocket.framework/SocketRocket

      Reason: the two ENV lines are missing from the top of the Podfile, so React Native uses its prebuilt dependencies and no SocketRocket framework is embedded.
      Solution: add both lines, delete ios/Pods and ios/build, then run pod install again.

      5.App crashes when the chat is opened, with: UIApplication.connectedScenes must be used from main thread only

      Reason: the module body is not on the main thread. React Native calls native methods on its own queue; requiresMainQueueSetup only governs module initialisation.
      Solution: wrap the body of startChat in DispatchQueue.main.async, as shown in Step 3.

      6.Build fails on the iOS Simulator with an architecture or “framework not found” error

      Reason: the SDK framework is device-only (arm64) and has no Simulator slice.
      Solution: run on a physical iOS device.

      AUTHOR’S BIO

      Khalid Hassan Emran is a Senior Technical Content Writer with more than 5 years of experience in technical documentation, content marketing, and blog writing. He specializes in simplifying complex technical concepts into clear, engaging content. In addition, he is an ...

      0:00 / 0:00
      ×