Luis Felipe Zaguini
Luis Felipe Zaguini

Reputation: 43

React Native iOS module Pod dependency

I'm trying to use a dependency installed from a Podfile inside my custom native module, but I'm not having success. When I install my pods I can use them normally inside my project, but looks like the Library (a React Native native module) can't use the installed pod.

Just to remember: my Podfile is ok, I can even work with the installed dependency in the main project, but not in the Native Module.

I always get the "Module XXX not found" error in the .m/.swift file inside the custom Library.

Am I missing something? Sorry if I'm misexplaining, I'm sleepy...

Upvotes: 1

Views: 1266

Answers (1)

David Chavez
David Chavez

Reputation: 391

I'm assuming your native module is being imported by dragging in the .xcproj into your main project.

In the native module's project: Go to Build Settings > Header Search Paths and add: {PATH_TO_IOS_BASE}/Pods/{NAME_OF_POD} and set it to recursive you should then be able to import it from your ObjC files.

Note: You can also just drag the respective pod folder into the Search Header Paths.

For example for a native module installed through npm I'd use: $(SRCROOT)/../../../../ios/Pods/{NAME_OF_POD}.

Upvotes: 1

Related Questions