apptentive / apptentive-react-native

Apptentive SDK module for React Native

Home Page:https://learn.apptentive.com/article-categories/react-native/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Apptentive/Apptentive.h file not found

aidanlvlup opened this issue · comments

i have ran into this error on ios working fine on android i have run npm install, react-native link and installed using cocoapods, example of podfile below.

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

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

  # Pods for RNApp
  pod "apptentive-ios"
end

post_install do |pi|
    pi.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            unless pi.podfile.defined_in_file.read().include? "\nuse_frameworks!\n"
                config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)']
                config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'NO_USE_FRAMEWORKS=1'
            end
        end
    end
end

also tried clean in xcode after this and still getting the same error on RNApptentiveModule.m line 2

Can you try uncommenting use_frameworks! and run pod install again? Even if you aren't able to use that setting in production, that should help us diagnose what's going on.

@frankus Hello thank you for the quick reply i have tried use_frameworks but is just getting the same error the same error node_modules/apptentive-react-native/ios/RNApptentiveModule.m:2:9: 'Apptentive/Apptentive.h' file not found. I had to remove some other pods as they did not work with this setting on.

I think what's going on is that the "header search paths" build setting in the RNApptentiveModule project file doesn't include the location where CocoaPods is installing the header files.

Basically we want to find the location of Apptentive.h on disk and then compare it to the header search paths. The former is probably in ios/Pods/apptentive-ios/Apptentive/Apptentive/.

If you're not super familiar with Xcode, you can see the build setting by opening ios/<Your project>.xcworkspace in Xcode, choosing the RNApptentiveModule.xcodeproj from the Project Navigator (⌘1 and then it will probably be in /Libraries). Then click Build Settings and you can use the search box to find "header search paths". You have to double-click the setting and you'll see something like $(SRCROOT)/../../../ios/Pods. $(SRCROOT) points to where the RNApptentiveModule.xcodeproj file lives on disk (which you can find by right-clicking the icon and choosing Show In Finder). Then just make sure the path points to the right place. You'll most likely want the "recursive" option set as well.

Thanks i will give that a go and get back to you 👍

Hello after trying for a while i gave up on cocoapods and cloned the library from git and set it up using the sub project instructions here https://learn.apptentive.com/knowledge-base/ios-integration-reference/ it now works fine. Linking to the library in cocoapods was just never finding the Apptentive.h file for some reason feel free to close this as i found a work around for my problem. It may work with use_framework for cocoapods for other people but that wasn't an option in my case thanks so much for your help.

Hi @aidan2129,

What cocoapods version do you use? You can check it but running pod --version

Hi @weeeBox
I upgraded it to the most recent version while trying to fix it version 1.5.0

Since @aidan2129 has a workaround and we weren't able to directly reproduce it, I'm going to go ahead and close this for now.