Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

My native module can't be integrated as Cocoapods static library due to AFNetworking dependency #165

Closed
yoshifumi4423 opened this issue Sep 25, 2019 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@yoshifumi4423
Copy link

Hi, thanks to developing the great tool!

I've been struggled with pod installation.
Please help me to solve this problem.

Thanks.

Environment

  • create-react-native-module: 0.10.2

  • CocoaPods: 1.7.5

  • Platform: (only) iOS

  • Xcode: 10.3

  • example's react: 16.8.6

  • example's react-native: 0.60.5

Repository
react-native-test-native-module

Short description of the issue
Cocoapods (1.7.5) can't integrate Obj-C and Swift mixed native module: react-native-test-native-module as a static library in example which is generated by create-react-native-module --generate-example

Expected outcome
pod install succeeds.

What actually happens
pod install fails and threw below error.

[!] The following Swift pods cannot yet be integrated as static libraries:

The Swift pod `react-native-test-native-module` depends upon `AFNetworking`, which does not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may set `use_modular_headers!` globally in your Podfile, or specify `:modular_headers => true` for particular dependencies.

What I have tried

  • Add use_modular_headers! to top of the Podfile.

It worked on pod install, but it didn't work on react-native run-ios and threw below error.

** BUILD FAILED **

The following build commands failed:
        CompileC <PATH>/react-native-test-native-module/example/ios/build/example/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Folly.build/Objects-normal/x86_64/Unicode.o  <PATH>/react-native-test-native-module/example/ios/Pods/Folly/folly/Unicode.cpp normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
  • Add pod 'react-native-test-native-module', :path => '../../react-native-test-native-module.podspec' to the Podfile

It didn't work.

  • pod 'react-native-test-native-module', :path => '../../react-native-test-native-module.podspec', :modular_headers => true

It didn't work.

@brodycj brodycj self-assigned this Sep 25, 2019
@brodycj brodycj added the bug Something isn't working label Sep 25, 2019
@brodycj
Copy link
Owner

brodycj commented Sep 25, 2019

It looks to me like you used the --use-cocoapods option, which only serves to add AFNetworking dependency to the podspec file and add some sample networking code to the generated module.

I would highly recommend that you try generating a new module without this option, try running the generated example, and commit the whole thing before you start any of your own updates.

@yoshifumi4423
Copy link
Author

@brodybits
Thanks for your quick response.
I followed your advice, and it worked! Thank you.

I'll close this issue.

@brodycj
Copy link
Owner

brodycj commented Sep 25, 2019

I have taken the following steps to help ensure that others do not encounter a similar issue in the future:

Thanks for reporting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants