zoho / SalesIQ-Mobilisten-iOS

Your mobile app's ideal live chat partner. Power up your iOS App with the SalesIQ Mobilisten iOS SDK.
https://mobilisten.io
11 stars 4 forks source link

Does not work with React-Native #3

Closed AustinHunt closed 4 years ago

AustinHunt commented 4 years ago

I get Use of undeclared identifier 'ZohoSalesIQ' .

I'm attempting to create a React-Native bridge for your project within my application, but whenever I try to import your project it does not work. This is hard-stopping me.

//
//  SalesIQBridge.m
//  HailTrace
//
//  Created by Austin Hunt on 11/11/19.
//  Copyright © 2019 Facebook. All rights reserved.
//
#import <Mobilisten/Mobilisten.h>
#import "SalesIQBridge.h"

@implementation SalesIQWrapper

RCT_EXPORT_MODULE();

RCT_EXPORT_METHOD(testMethod: (NSDictionary *) options resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
  NSLog(@"Test!!");
  resolve(@"test response");
}

RCT_EXPORT_METHOD(init: (NSDictionary *) options resolver: (RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
  NSString * appKey = options[@"appKey"];
  NSString * accessKey = options[@"accessKey"];
  [ZohoSalesIQ initWithAppKey: appKey accessKey: accessKey completion:^(BOOL completed) {
    if (completed) {
      resolve();
    } else {
      reject(@"Error intializing ZohoSalesIQ");
    }
  }]
}

@end

Here is my pod file:

# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'

target 'HailTrace' do

  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  #use_frameworks!

  # Pods for HailTrace
  pod 'Mobilisten','1.1.0'
  pod 'Firebase/Core', '~> 5.20.2'
  pod 'Firebase/Messaging', '~> 5.20.2'
  pod 'Intercom'

  rn_path = '../node_modules/react-native'
  rn_maps_path = '../node_modules/react-native-maps'

  # See http://facebook.github.io/react-native/docs/integration-with-existing-apps.html#configuring-cocoapods-dependencies

  pod 'React', path: rn_path, subspecs: [
  'Core',
  'CxxBridge',
  'DevSupport',
  'RCTActionSheet',
  'RCTAnimation',
  'RCTGeolocation',
  'RCTImage',
  'RCTLinkingIOS',
  'RCTNetwork',
  'RCTSettings',
  'RCTText',
  'RCTVibration',
  'RCTWebSocket'
  ]

  # Explicitly include Yoga if you are using RN >= 0.42.0
  pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

  # Third party deps podspec link
  pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
  pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'

  pod 'react-native-video', :path => '../node_modules/react-native-video'
  pod 'react-native-maps', path: rn_maps_path
  pod 'react-native-intercom', path: '../node_modules/react-native-intercom'

  # CodePush plugin dependency
  pod 'CodePush', :path => '../node_modules/react-native-code-push'

  post_install do |installer|
    installer.pods_project.targets.each do |target|
      if target.name == "React"
        target.remove_from_project
      end
      if target.name == "yoga"
          target.remove_from_project
      end
    end
  end
  target 'HailTraceTests' do
    inherit! :search_paths
    # Pods for testing
  end

end

target 'HailTrace-tvOS' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!

  # Pods for HailTrace-tvOS

  target 'HailTrace-tvOSTests' do
    inherit! :search_paths
    # Pods for testing
  end

end
AustinHunt commented 4 years ago

Update: I think I've narrowed this down. The framework is not compiled for the latest iOS.

AustinHunt commented 4 years ago

Update 2: The issue is that this framework does not link correctly when trying to target an iOS simulator. I'm pretty certain the issue is related to an Xcode configuration, but I'm unsure.

RishabhRaghunath commented 4 years ago

Could you confirm that the Mobilisten pod was installed correctly without any issues when the pod install takes place for the project? If the installation via Cocoapods has taken place correctly, for Objective-C projects please ensure that you are able to build the project with an actual device selected or "Generic iOS Device" as your run target(Do not have a simulator selected).

AustinHunt commented 4 years ago

The install was correct @RishabhRaghunath. Is there any reason why the library cannot run on iOS Simulator?

AustinHunt commented 4 years ago

We got it working in our testing environment on an actual device.

DimpyLadva commented 4 years ago
Screenshot 2020-01-06 at 7 01 55 PM
DimpyLadva commented 4 years ago

Can anyone please help to solve this issue? How do I import ZohoSalesIQ in this file?

Rishabh-Raghunath commented 4 years ago

This is caused due to a known issue introduced in XCode 10.2 while building universal frameworks. We will explore a workaround solution for this and have the fix merged in the next release of Mobilisten. Until then, If your project uses Objective-C and you get this error, please run on the device to test the support features. You may also comment out the APIs used to run the app on the simulator alone. This won't be an issue while running on an iOS device. We will update once this issue is resolved.