Successful build when running react-native run-ios
[project directory]/node_modules/react-native-code-push/ios/CodePush/CodePush.h:6:9: fatal error: 'React/RCTEventEmitter.h' file not found
#import "React/RCTEventEmitter.h" // Required when used as a Pod in a Swift project
^~~~~~~~~~~~~~~~~~~~~~~~~
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 [project name].xcworkspace
** BUILD FAILED **
Cannot reproduce using these steps as App Center needs to be installed before CodePush, which then makes CodePush want to use pods.
I can send a copy of the project to someone from Microsoft, but cannot post it in a publicly accessible location. Please give me details and I'd be happy to send the project to you to help debug.
Hi @thekevinbrown,
Thanks for reporting!
Yeah, could you please provide your dummy project with reproducing issue and reprosteps? I would like to debug it.
If you would not like to share it here, you can send it to my email: [email protected]
Thanks @alexandergoncharov, project sent.
Actually I've managed to fix this in the meantime.
The problem is that the react-native-code-push pod brings in React v11 by default. What we actually want to do is get pods to recognise the version of React Native that we have in node_modules, which is much newer than v11.
So here's the resulting podfile that fixed the build for me:
target 'MyProject' do
# Pods for MyProject
platform :ios, '9.0'
# React Native Pods
pod 'React', :path => '../node_modules/react-native', :subspecs => [
'Core',
'CxxBridge',
'DevSupport',
'RCTText',
'RCTNetwork',
'RCTWebSocket',
'RCTAnimation',
]
pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
# Additional project specific pods
pod 'AppCenter/Crashes', '~> 2.0.1'
pod 'AppCenter/Analytics', '~> 2.0.1'
pod 'AppCenterReactNativeShared', '~> 2.0.0'
pod 'CodePush', :path => '../node_modules/react-native-code-push'
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
target 'MyProjectTests' do
inherit! :search_paths
# Pods for testing
end
end
target 'MyProject-tvOS' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
# Pods for MyProject-tvOS
target 'MyProject-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
end
Once ios/Podfile looked like the above, I ran react-native link which I assume ran pod install, then the build worked.
It'd be awesome if CodePush could see that this was the case and warn the user about it, or add a link to this page from the docs: https://facebook.github.io/react-native/docs/integration-with-existing-apps#configuring-cocoapods-dependencies
I had missed it because I wasn't integrating with an existing app, but it turns out this is more a guide of how to set up Cocoapods on an RN project in general.
I have same question too, but I got this question from react-native link, my react-native version is 0.58.4, react-native-code-push version is 5.4.2,
Hi @thekevinbrown,
Sorry for the delay.
Could you please provide the title of the email as I can't find it?
Also, could you please clarify you got this issue when you used pods from setup docs from here https://github.com/microsoft/react-native-code-push/blob/master/docs/setup-ios.md#plugin-installation-ios---cocoapods?
Hi @gh7800 ,
Thanks for reporting!
Could you please provide some reprosteps or dome dummy project with reproducing issue and reprosteps? I would like to debug it.
Hi @thekevinbrown and @gh7800,
I'm going to close this issue for now as I haven't heard from you in a while, unfortunately.
Please feel free to reopen this issue if you have any questions or provide some dummy project.
Thanks,
Alexander
'React/RCTEventEmitter.h' file not found in React native /pods/Development Pods/CodePush.h
Most helpful comment
Actually I've managed to fix this in the meantime.
The problem is that the
react-native-code-pushpod brings inReactv11 by default. What we actually want to do is get pods to recognise the version of React Native that we have innode_modules, which is much newer than v11.So here's the resulting podfile that fixed the build for me:
Once
ios/Podfilelooked like the above, I ranreact-native linkwhich I assume ranpod install, then the build worked.It'd be awesome if CodePush could see that this was the case and warn the user about it, or add a link to this page from the docs: https://facebook.github.io/react-native/docs/integration-with-existing-apps#configuring-cocoapods-dependencies
I had missed it because I wasn't integrating with an existing app, but it turns out this is more a guide of how to set up Cocoapods on an RN project in general.