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

Update README on how to install with CocoaPods #329

Closed
wants to merge 1 commit into from

Conversation

muhozi
Copy link

@muhozi muhozi commented Jan 29, 2019

After spending some time figuring out how this package can work in my project while using CocoaPods, I've found a working solution from the comment of the issue #125

This PR updates the guide on how to install this package if you are using CocoaPods(for iOS). This solves the issue faced by CocoaPods user when they try to run the app after installing this package, like issue #125.

Thanks to @clarsen for the comment on the issue.

@clarsen
Copy link

clarsen commented Jan 29, 2019

looks good to me. Thanks

@LRNZ09
Copy link

LRNZ09 commented Mar 1, 2019

This should be merged, it's pretty useful

@alfonsodev
Copy link

alfonsodev commented Mar 17, 2019

Thanks @muhozi !
That information is needed, it would have saved me 3hours!
I think it should also mention to add the following lines to Podfile

pod 'react-native-config', :path => '../node_modules/react-native-config'

post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.name == 'react-native-config'
      phase = target.project.new(Xcodeproj::Project::Object::PBXShellScriptBuildPhase)
      phase.shell_script = "cd ../../"\
                           " && RNC_ROOT=./node_modules/react-native-config/"\
                           " && export SYMROOT=$RNC_ROOT/ios/ReactNativeConfig"\
                           " && export BUILD_DIR=$RNC_ROOT/ios/ReactNativeConfig"\
                           " && ruby $RNC_ROOT/ios/ReactNativeConfig/BuildDotenvConfig.ruby"

      target.build_phases << phase
      target.build_phases.move(phase,0)
    end
  end
end

the above snippet was shared on #125
issue, but it doesn't work for me without $(SRCROOT)/../node_modules/react-native-config/ios/ReactNativeConfig/GeneratedInfoPlistDotEnv.h

tested with versions:

   "react-native": "0.59.1",
    "react-native-config": "^0.11.7",

@muhozi muhozi force-pushed the chore/update-readme branch 2 times, most recently from e200d38 to b49490a Compare March 18, 2019 21:29
@muhozi muhozi force-pushed the chore/update-readme branch from b49490a to d6e413d Compare March 18, 2019 21:29
@muhozi
Copy link
Author

muhozi commented Mar 18, 2019

@alfonsodev Thanks for this, I've added that in the README. Thanks to @mikelovesrobots for the snippet

I'm actually using this snippet for this package to work. I don't know how I forgot to add it in the README too 🙂.

@mikelovesrobots
Copy link

No worries! Cocoapods is awful.

@CesarDenis
Copy link

@alfonsodev I have the same setup as you, but I'm having a build error.

you can help me?

error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening CheilTracker.xcworkspace

2019-03-20 02:13:06.455 xcodebuild[80368:7754213]  DTDeviceKit: deviceType from 422ed1da6cb0fdca73a040b830d57bca41096979 was NULL
2019-03-20 02:13:06.653 xcodebuild[80368:7754213]  DTDeviceKit: deviceType from 422ed1da6cb0fdca73a040b830d57bca41096979 was NULL
** BUILD FAILED **


The following commands produced analyzer issues:
        Analyze /Volumes/Files/repositores/smy/cheil/cheil-tracker/CheilTracker/node_modules/react-native/ReactCommon/yoga/yoga/Yoga.cpp normal x86_64
        Analyze /Volumes/Files/repositores/smy/cheil/cheil-tracker/CheilTracker/node_modules/react-native/React/Base/RCTModuleMethod.mm normal x86_64
(2 commands with analyzer issues)

The following build commands failed:
        CompileC /Volumes/Files/repositores/smy/cheil/cheil-tracker/CheilTracker/ios/build/CheilTracker/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React.build/Objects-normal/x86_64/RCTJavaScriptLoader.o /Volumes/Files/repositores/smy/cheil/cheil-tracker/CheilTracker/node_modules/react-native/React/Base/RCTJavaScriptLoader.mm normal x86_64 objective-c++ com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)

@alfonsodev
Copy link

@CesarDenis I haven't seen that error before, maybe you could create a separate issue with this error and all the data related to your Xcode version and react-native version and someone can help.

@CesarDenis
Copy link

Tks @alfonsodev, I opened a new issue #340

@asutula
Copy link

asutula commented Mar 25, 2019

It's generally recommended that you do check your Pods directory into source control, eliminating the need to pod install after checking out the code and before building. This solution, unfortunately, only generates the generated header file when pod install is run.

@alvelig
Copy link

alvelig commented Apr 7, 2019

Add this script to scheme pre-actions:

Product - Scheme - Edit Scheme -> Unfold Build -> Pre-actions

RNC_ROOT=$(realpath $SRCROOT/../node_modules/react-native-config/)
export SYMROOT=$RNC_ROOT/ios/ReactNativeConfig
export BUILD_DIR=$RNC_ROOT/ios/ReactNativeConfig
ruby $RNC_ROOT/ios/ReactNativeConfig/BuildDotenvConfig.ruby

Maybe someone knows a way to automatically put it into the scheme

@ammichael
Copy link

Why this isn't merged? Could've spared me hours of debugging

maxkomarychev added a commit to maxkomarychev/react-native-config that referenced this pull request May 16, 2019
* ruby scripts were refactored
* environment values are now exposed to Info.plist via xcconfig file
* environment values became available in Build Settings
* cocoapods integration fixed - no need to add custom code to Podfile!
(as suggested in this PR:
lugg#329)
maxkomarychev added a commit to maxkomarychev/react-native-config that referenced this pull request May 16, 2019
* ruby scripts were refactored
* environment values are now exposed to Info.plist via xcconfig file
* environment values became available in Build Settings
* cocoapods integration fixed - no need to add custom code to Podfile!
(as suggested in this PR:
lugg#329)
maxkomarychev added a commit to maxkomarychev/react-native-config that referenced this pull request May 17, 2019
* ruby scripts were refactored
* environment values are now exposed to Info.plist via xcconfig file
* environment values became available in Build Settings
* cocoapods integration fixed - no need to add custom code to Podfile!
(as suggested in this PR:
lugg#329)
maxkomarychev added a commit to maxkomarychev/react-native-config that referenced this pull request May 17, 2019
* ruby scripts were refactored
* environment values are now exposed to Info.plist via xcconfig file
* environment values became available in Build Settings
* cocoapods integration fixed - no need to add custom code to Podfile!
(as suggested in this PR: lugg#329)
@maxkomarychev
Copy link
Contributor

Hi all,

I changed the way this library integrates into ios project and now all issues with cocoapods should be fixed. PR is here: #349 please give it a try.


**Cocoapods**

If you are using **CocoaPods** in your project, set to `$(SRCROOT)/../node_modules/react-native-config/ios/ReactNativeConfig/GeneratedInfoPlistDotEnv.h`
Copy link

@digitaldavenyc digitaldavenyc May 30, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this mean exactly? Where are you "setting" the .h file?

@isaax2
Copy link

isaax2 commented Jul 4, 2019

It works!!! even with the new React Native 0.60.0

@muhozi
Copy link
Author

muhozi commented Jul 5, 2019

Closing this. The issue was fixed in #349

@muhozi muhozi closed this Jul 5, 2019
@muhozi muhozi deleted the chore/update-readme branch July 5, 2019 13:44
venus-heaven pushed a commit to venus-heaven/config-React-native that referenced this pull request Mar 11, 2024
* ruby scripts were refactored
* environment values are now exposed to Info.plist via xcconfig file
* environment values became available in Build Settings
* cocoapods integration fixed - no need to add custom code to Podfile!
(as suggested in this PR: lugg/react-native-config#329)
dev-arrow added a commit to dev-arrow/react-native-config that referenced this pull request Nov 25, 2024
* ruby scripts were refactored
* environment values are now exposed to Info.plist via xcconfig file
* environment values became available in Build Settings
* cocoapods integration fixed - no need to add custom code to Podfile!
(as suggested in this PR: lugg/react-native-config#329)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.