RN 0.57.1
RN-cli 2.0.1
xCode: 9.4.1 (9F2000) or xCode 10
After an update of RN from 0.56 to 0.57.0 (or 0.57.1) I get a lot of could not build module 'CoreFoundation'
or could not build module Foundation
or limits file not found
I followed exactly the steps from RN doc for this update.
I tried removing ios/build
folder, cleaning cache, re-installing everything but nothing worked.
▸ Building BunteMobile/OneSignalNotificationServiceExtension [Debug] ▸ Check Dependencies ▸ Compiling NotificationService.m
/Users/myuser/Desktop/projects/mobileapp/ios/../node_modules/react-native/ReactCommon/fabric/graphics/platform/ios/float.h:8:10: 'limits' file not found
#include <limits>
/Users/myuser/Desktop/projects/mobileapp/ios/../node_modules/react-native/ReactCommon/fabric/graphics/platform/ios/float.h:8:10: 'limits' file not found
#include <limits>
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:10: could not build module 'CoreFoundation'
#include <CoreFoundation/CoreFoundation.h>
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/Security.framework/Headers/SecBase.h:28:10: could not build module 'CoreFoundation'
#include <CoreFoundation/CFBase.h>
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/CFNetwork.framework/Headers/CFNetwork.h:18:10: could not build module 'CoreFoundation'
#include <CoreFoundation/CoreFoundation.h>
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/UserNotifications.framework/Headers/NSString+UserNotifications.h:8:9: could not build module 'Foundation'
#import <Foundation/Foundation.h>
If I remove the OneSignalNotificationServiceExtension instead of 7 errors I get another 15 errors in other parts of the project:
/Users/myuser/Desktop/projects/mobileapp/ios/../node_modules/react-native/ReactCommon/fabric/graphics/platform/ios/float.h:8:10: 'limits' file not found
#include <limits>
/Users/myuser/Desktop/projects/mobileapp/ios/../node_modules/react-native/ReactCommon/fabric/graphics/platform/ios/float.h:8:10: 'limits' file not found
#include <limits>
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:10: could not build module 'CoreFoundation'
#include <CoreFoundation/CoreFoundation.h>
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/Security.framework/Headers/SecBase.h:28:10: could not build module 'CoreFoundation'
#include <CoreFoundation/CFBase.h>
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/CFNetwork.framework/Headers/CFNetwork.h:18:10: could not build module 'CoreFoundation'
#include <CoreFoundation/CoreFoundation.h>
/Users/myuser/Desktop/projects/mobileapp/ios/build/Build/Products/Debug-iphonesimulator/include/React/RCTBridgeModule.h:8:9: could not build module 'Foundation'
#import <Foundation/Foundation.h>
The only workaround that I found is to downgrade RN back to 0.56...
According to the RN team answer from here https://github.com/facebook/react-native/issues/21482
changing all babel deps to 7 should fix the issue but even after an npx babel-ugrade -w
and a reinstall of node modules + cache clean I get the same errors.
but still same problems.
Should any with header search paths be updated in extensions/ios build settings after update to 0.57?
I've spent 3 days with this IOS building issue....
Note: I was able to build android after the upgrade of RN and babel.
React-native git associated ticket: https://github.com/facebook/react-native/issues/21482
To fix all these errors I had to remove React and ReactCommon from Project Header Search paths
and from OneSignalNotificationServiceExtension target header search paths
.
1) Removing from project header search paths:
The crashes were related to limits
, CoreFoundation
, Foundation
and CoreGraphics
.
I went to Project Header Search Paths
and removed the React and ReactCommon dependencies from there.
This is how my project header search paths
looks now:
2) Removing from one-signal extension: (Optional, if you don't have any extension you don't have to do this)
This is how the paths of that extension used to look when crashing:
This is how the target of that extension looks now:
Note: I haven't changed anything in the project target header search paths
.
I am not sure what changed in RN 0.57, why it was crashing now in 0.57, how this header search paths
should be in extensions, project and target. Why previously having React and ReactCommon there worked and why now it is not working anymore.
My project was created 3 years ago and had many RN updates. It is possible that at some point React and ReactCommon were needed in the project header search paths.
As I wrote in my question, this problem was signaled in RN github too, more details can be found here:
https://github.com/facebook/react-native/issues/21482#issuecomment-427815231
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With