Garrett McCullough
Garrett McCullough

Reputation: 980

Building a React Native bridge but a file within the framework can't be found

I'm trying to build a React Native wrapper for the RichRelevance iOS SDK.

I've created the wrapper project and imported it into my React Native app. I'm using Cocoapods to add the RichRelevance SDK to the app

I'm now attempting to import the RichRelevance SDK into the wrapper project using:
#import <RichRelevanceSDK/RichRelevanceSDK.h>

The problem I have is that when the compiler attempts to compile the RichRelevanceSDK, it throws an error that one of the files is not found: error message showing "'RichRelevanceSDK/RCHImportable.h' file not found"

Line 63 is the original import that was written in the SDK. I added Line 62 to show that the file can be found if the type of import is changed. However, this isn't really an option since I don't want to modify the SDK (I don't own it).

In either type of import, I'm able to cmd+click the file and go to the definition. So XCode seems to know about the file. Additionally, I see the file in the Project browser under: Pods -> Pods -> RichRelevanceSDK -> RCHImportable.h

The primary difference with this file is that, if I look in the file browser, that file is located in a sub-folder, relative to all of the other files in the SDK: screen shot of file system showing the file in the Import sub-folder

I'm hoping there's a way to change my wrapper project so that this file can be found, so I don't have to edit or fork the SDK files.

So far, I've attempted to update the various Search Paths in my wrapper project but with no luck. I've added the following two paths to all of the Search Paths: screen shot showing the search paths

UPDATE: I was able to make some progress and I can now get it to compile.

I ended up:

  1. cloning the SDK's repo to my computer
  2. removing the SDK from the Podfile
  3. adding the SDK's xcodeproj file to MyApp/Libraries
  4. adding the SDK.framework file to MyApp -> Embedded Binaries
  5. I can now import the SDK into my bridge module

I would still prefer to find a better way to do this though. This method either involves me committing the SDK to our repo or asking all of my colleagues to clone the repo to their machine. NPM can't seem to install the repo; my guess is this is due to the repo missing a package.json file

Upvotes: 0

Views: 752

Answers (1)

Chris Ahlering
Chris Ahlering

Reputation: 26

There does appear to be something wrong with the packaging, as the header in question would appear to be captured in the public_header_files glob in the Podspec.

However, I think more direct path is to simply include the RCHSDK.h file, as RCHSDK is the entrypoint to the SDK functions. The RichRelevanceSDK.h serves primarily as a shorthand for importing additional headers versus specifying them individually.

Alternatively, you can follow the instructions in Include of non-modular header inside framework module, this seemed to correct the issue in local tests.

Upvotes: 1

Related Questions