gpt4 book ai didi

ios - 找不到 React-native 0.57 ios 限制文件无法构建模块 CoreFoundation

转载 作者:可可西里 更新时间:2023-11-01 03:10:42 25 4
gpt4 key购买 nike

RN 0.57.1​​

RN-cli 2.0.1

xCode:9.4.1 (9F2000)xCode 10

将 RN 从 0.56 更新到 0.57.0(或 0.57.1​​)后,我得到了很多 could not build module 'CoreFoundation'could not build module Foundationlimits file not found

我完全按照 RN 文档中的步骤进行了这次更新。

我尝试删除 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 dep 更改为 7 应该可以解决问题,但即使在 npx babel-ugrade -w 之后也是如此并重新安装节点模块+缓存清理我得到了同样的错误。

还是一样的问题。

更新到 0.57 后,是否应该在扩展/ios build设置中更新任何带有标题搜索路径的内容?

我已经花了 3 天时间解决这个 IOS 构建问题....

注意:我升级了RN和babel之后就可以build android了。

React-native git 关联票证: https://github.com/facebook/react-native/issues/21482

最佳答案

为了修复所有这些错误,我必须从 Project Header Search pathsOneSignalNotificationServiceExtension 目标 header 搜索中删除 ReactReactCommon路径

1) 从项目标题搜索路径中删除:

崩溃与 limitsCoreFoundationFoundationCoreGraphics 有关。

我转到 Project Header Search Paths 并从那里删除了 React 和 ReactCommon 依赖项。

这就是我的 project header search paths 现在的样子: enter image description here

2) 从单信号扩展中删除:(可选,如果您没有任何扩展,则不必执行此操作)

这是该扩展的路径在崩溃时的样子: enter image description here

这是该扩展的目标现在的样子:

enter image description here

注意:我没有更改项目目标 header 搜索路径中的任何内容。

我不确定 RN 0.57 中发生了什么变化,为什么它现在在 0.57 中崩溃,这个 header search paths 应该如何在扩展、项目和目标中。为什么以前有 React 和 ReactCommon 在那里工作,为什么现在它不再工作了。

我的项目是 3 年前创建的,有很多 RN 更新。项目 header 搜索路径中可能在某些时候需要 React 和 ReactCommon。

正如我在问题中所写,这个问题也在 RN github 中发出了信号,可以在此处找到更多详细信息:

https://github.com/facebook/react-native/issues/21482#issuecomment-427815231

关于ios - 找不到 React-native 0.57 ios 限制文件无法构建模块 CoreFoundation,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52649586/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com