Setting up cocoa pods with a react native project

蹲街弑〆低调 提交于 2019-12-11 02:46:35

问题


I've set up a fresh react native project, and instantiated a cocoa pod .xcworkspace doing:

cd ios
pod init 
pod install

I've then added a pod that I want to use (in this case being Buddybuild, although it doesn't really matter which pod i add, as the behavior is similar)

After I run pod install and include the header #import <BuddyBuildSDK/BuddyBuildSDK.h> in my AppDelegate.m , it is always returning me a /Users/nik/dev/myproject/ios/myproject/AppDelegate.m:14:9: 'BuddyBuildSDK/BuddyBuildSDK.h' file not found

I've battled with this all day and I have no idea why. The headers are all there in the Pods/headers/Public folder. They're being included in the header search paths in build settings as well as you can see here:

I'd highly appreciate help on this as I'm very stuck.

EDIT Also here's my Podfile:


回答1:


Turns out the issue was an xcode thing. After much Googling the issue that solved it was making sure that my projects configurations were properly set. So going to Project -> Info -> Configurations And choosing the right Pods-projectName.debug and Pods-projectName.release configurations.




回答2:


For RN 0.58.6 I noticed you don't need any react or react-native pods.

If you create a brand new project using react-native init (for 0.58.6) you will notice there is no need for a pod file.

My pod file looks like this:

platform :ios, '9.0'
project 'MyRNProject.xcodeproj'
install! 'cocoapods', :deterministic_uuids => false

target 'MyRNProject' do
  # Comment this line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  # Add pods that you need here

  target 'MyRNProject' do
    inherit! :search_paths
    # Pods for testing
  end

end

In Project target Linked framework or libraries I have:

  • framework deps (CoreFoundation.framework, SystemConfiguration.framework Pods_MyRNProject.framework etc)

  • RCT and RN deps

  • other libs that I use



来源:https://stackoverflow.com/questions/43475061/setting-up-cocoa-pods-with-a-react-native-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!