Main app can't reference framework used in React Native Library

493 views Asked by At

I need some advice about building react native library that using framework. I'm trying to build one using this library. My react native library contains these files:

Sample-Bridging-Header.h
Sample.m
Sample.swift
Sample.xcodeproj/
Utilities/Utility.swift
Utilities/Helper.swift
Test.framework

Inside my Utility.swift and Helper.swift, I import library Test and there is no issue there.

However, when I build the sample app which uses the library, it will not build and it gives the error no such module 'Test'.

So it looks like if the main application try to use the react native library, and if the library uses a framework, the main application can't reference the framework. I'm not sure if this is the right approach or not.

I built react native library before and it worked for me but I never have to reference any framework.

Appreciate any help! Thanks!

1

There are 1 answers

0
chuongle On

Actually I just figured out how to handle this. I just need to update the podspec to include the framework by using s.ios.vendored_frameworks = ios/Test.framework.

Once I did that, I run pod install again for my example project. So now it can pull the framework in properly.