Setup:
Versions:
react: 16.3.1
react-native: 0.55.4
aws-amplify: 0.4.1
aws-amplify-react-native: 0.2.11
amazon-cognito-auth-js: 1.2.0
amazon-cognito-identity-js: 2.0.6
Xcode: 9.3.1
CocoaPods: 1.5.2
Description:
Xcode build fails with: RCTBridgeModule.h:10:9: 'React/RCTDefines.h' file not found under the RNAWSCognito Target
Steps To Recreate:
pod init)react-native link amazon-cognito-identity-js which works successfully (i can see the updates to the Podfile)RCTBridgeModule.h:10:9: 'React/RCTDefines.h' file not found under the RNAWSCognito TargetPodfile Contents:
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
target 'POCApp' do
# Pods for POCApp
# Your 'node_modules' directory is probably in the root of your project,
# but if not, adjust the `:path` accordingly
pod 'React', :path => '../node_modules/react-native', :subspecs => [
'Core',
'CxxBridge', # Include this for RN >= 0.47
'DevSupport', # Include this to enable In-App Devmenu if RN >= 0.43
'RCTAnimation',
'RCTImage',
'RCTLinkingIOS',
'RCTText',
'RCTNetwork',
'RCTWebSocket', # needed for debugging
# Add any other subspecs you want to use in your project
]
# Explicitly include Yoga if you are using RN >= 0.42.0
pod "yoga", :path => "../node_modules/react-native/ReactCommon/yoga"
# Third party deps podspec link
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'
pod 'RNAWSCognito', :path => '../node_modules/amazon-cognito-identity-js'
target 'POCAppTests' do
inherit! :search_paths
# Pods for testing
end
target 'POCAppUITests' do
inherit! :search_paths
# Pods for testing
end
end
Things I've Tried Already
I've spent a LOT of time trying to figure out what's causing this and i'm not getting anywhere. Any help much appreciated. Thanks!
Looks like this PR might be the fix: #752
PR #752 did indeed fix the issue. App is building without issue when using the latest AWS Amplify package.
@markmckim I've tried building amplify enabled project with RN 53 & 55, and I found that if I add amplify after adding in pod libraries (e.g. VS AppCenter) it will introduce several exceptions. The PR mentioned referenced React which requires adding React as a dependency in pod file. The workaround is then reference the React within node-modules rather than from pod to resolve the ambiguous reference exception. After many trials with the Podfile, I still can't go around the error of
Module 'ProgressViewIOS' does not exist in the Haste module map
This problem can be easily replayed by simply starting a new RN project using react-native init, add a library that requires pod, and then add amplify & amplify-react-native. We created multiple sandbox projects to debug this using withAuthenticator for login page and the sample app.js with Pinpoint so just want to bring this to your attention.
So far the only working solution is do add Amplify before adding any library that require pod, which is find for new projects but made old project migrations extremely painful.
I will be happy to share more details as this exception requires multiple workarounds and took us several days to find the root cause amid problems caused by prematurely upgrading to XCode 10...
Hmmm that's interesting. Something in the pod install must be messing up the Xcode proj from the sounds of it. Thankfully amplify was the first thing I added, however even when i do a pod install from a fresh clone of the repo, i don't see this issue.
Yeah I can verify that as well, which is why it was very difficult to pinpoint what exactly caused this issue. We are guessing it's how react-native link works with cocoapods and there's several unresolved issues on a couple other libraries that also added a dependency on react in their pod files.
After we figured out we have a good sense of the issue we did the real project upgrade using the podfile that includes a reference to React but got the duplicate symbol exception. We end up just deleting the RNAWSCognito pod dependency (generated by the rn link that's required for projects built using rn init) from the podfile, clean cache, rebuilt, and everything works including react-native link... it might also have to do with us upgrading from 0.3 to the latest amplify, but at this point we are just happy to move forward.
We are now in the process of adding back the ble-plx library which requires carthage so we will see how it goes =]
Good luck!