RN-cli 2.0.1
xCode:9.4.1(9F2000)或xCode 10
在RN从0.56更新到0.57.0(或0.57.1)后,我得到了很多无法构建模块’CoreFoundation’或无法构建模块基础或限制文件未找到
我完全按照RN doc的步骤进行了此更新.
我尝试删除ios / build文件夹,清理缓存,重新安装一切,但没有任何工作.
▸ 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>
如果我删除OneSignalNotificationServiceExtension而不是7
错误我在项目的其他部分得到另外15个错误:
/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>
我找到的唯一解决方法是将RN降级回0.56 ……
根据RN团队的回答
https://github.com/facebook/react-native/issues/21482
将所有babel deps更改为7应该可以解决问题,但即使在npx babel-ugrade -w和重新安装的节点模块缓存清理后,我也会遇到相同的错误.
但仍然是同样的问题.
更新到0.57后,是否应在extension / ios构建设置中更新任何带有标题搜索路径的文件?
我在这个IOS建设问题上花了3天时间….
注意:我能够在RN和babel升级后构建android.
React-native git关联票证:
https://github.com/facebook/react-native/issues/21482
崩溃与限制,CoreFoundation,Foundation和CoreGraphics有关.
我去了Project Header Search Paths并从那里删除了React和ReactCommon依赖项.
2)从单信号分机上删除:(可选,如果你没有任何分机,你不必这样做)
这就是该扩展的目标现在的样子:
我不确定在RN 0.57中发生了什么变化,为什么它现在在0.57中崩溃,这个标题搜索路径应该如何在扩展,项目和目标中.为什么以前有React和ReactCommon工作,为什么现在它不再工作了.
我的项目是在3年前创建的,并且有许多RN更新.在某些时候,项目标题搜索路径中可能需要React和ReactCommon.
正如我在我的问题中所写,这个问题也在RN github中发出信号,
更多详情可在这找到:
https://github.com/facebook/react-native/issues/21482#issuecomment-427815231