CleverTap / clevertap-react-native

CleverTap React Native SDK
Other
59 stars 71 forks source link

'CleverTap-iOS-SDK/CleverTap.h' file not found, after use_frameworks #340

Closed LukasMod closed 1 year ago

LukasMod commented 1 year ago

Hey, I updated the firebase packages in the project, which now require use_frameworks. Now I can't finish building the application on iOS, I always get error: 'CleverTap-iOS-SDK/CleverTap.h' file not found from AppDelegate.mm, where I have:

#import <CleverTap-iOS-SDK/CleverTap.h>
#import <clevertap-react-native/CleverTapReactManager.h>

I looked through the threads and documentation but all attempts failed. I admit that I don't understand the import technique in iOS, but I think I've tried all the combinations from similar threads and I'm out of ideas.

this is my podfile:

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, min_ios_version_supported
prepare_react_native_project!

flipper_config = FlipperConfiguration.disabled 

linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
  Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
  use_frameworks! :linkage => linkage.to_sym
end

def project_pods
  config = use_native_modules!
  use_frameworks! :linkage => :static
  flags = get_default_flags()

  use_react_native!(
                    :path => config[:reactNativePath],
                    :hermes_enabled => flags[:hermes_enabled],
                    :fabric_enabled => flags[:fabric_enabled],
                    :flipper_configuration => flipper_config,
                    :app_path => "#{Pod::Config.instance.installation_root}/.."
                    )

                    pod 'clevertap-react-native', :path => '../node_modules/clevertap-react-native'
                    pod 'CleverTap-iOS-SDK'
                    pod 'Google-Mobile-Ads-SDK'
end

From package.json:

"clevertap-react-native": "^1.1.1",
 "react-native": "0.71.10",

From Podfile.lock:

  - CleverTap-iOS-SDK (5.0.1):
    - SDWebImage (~> 5.11)
  - clevertap-react-native (1.1.1):
    - CleverTap-iOS-SDK (= 5.0.1)
    - React-Core

I would like to ask for help in indicating what the podfile should look like in case we use use_frameworks! :linkage => :static and how to correctly import this inside AppDelegate.mm

maulik54e commented 1 year ago

try import as

#import "CleverTap.h"
#import "CleverTapReactManager.h"

i'm on RN 0.72.3

LukasMod commented 1 year ago

@maulik54e Thank you for your help, after changing to

#import "CleverTap.h"
#import "CleverTapReactManager.h"

build succeeded.

Accordingly I've also changed to #import "CleverTap.h" inside NotificationService.

All looks fine after quick analytic and push notification testing.