React Native iOS 构建在 AppCenter 失败
我们的 React Native iOS 项目与 AppCenter 构建运行良好。但是,当我们推送某些更改时,尽管它在本地仍然运行良好,但 AppCenter 的构建失败并显示一条奇怪的消息。
fatal error: module 'yoga' in AST file '/Users/runner/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/13415P9B5780C/yoga-3FGLCEI7OHU77.pcm' (imported by AST file '/Users/runner/Library/Developer/Xcode/DerivedData/...-fyxzontolgdinkbrtgzjhrtkdanv/Build/Intermediates.noindex/ArchiveIntermediates/.../PrecompiledHeaders/...-Bridging-Header-swift_35RXECGWIBVYJ-clang_13415P9B5780C.pch') is not defined in any loaded module map file; maybe you need to load '/Users/runner/work/1/s/.../ios/Pods/Headers/Public/yoga/Yoga.modulemap'?
花了很长时间后,我们发现原因是在我们的本机 iOS 模块中,我们向 Objective C 类添加了类别(扩展名)到 Swift 类也会导致同样的错误)。
另外,如果我们添加一个类方法,我们也会得到同样的错误。
有没有办法解决这些奇怪的限制?
Our React Native iOS project has been working well with AppCenter build. But when we pushed certain changes, although it still works well locally, the build at AppCenter failed with a weird message
fatal error: module 'yoga' in AST file '/Users/runner/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/13415P9B5780C/yoga-3FGLCEI7OHU77.pcm' (imported by AST file '/Users/runner/Library/Developer/Xcode/DerivedData/...-fyxzontolgdinkbrtgzjhrtkdanv/Build/Intermediates.noindex/ArchiveIntermediates/.../PrecompiledHeaders/...-Bridging-Header-swift_35RXECGWIBVYJ-clang_13415P9B5780C.pch') is not defined in any loaded module map file; maybe you need to load '/Users/runner/work/1/s/.../ios/Pods/Headers/Public/yoga/Yoga.modulemap'?
After spending a long time we figured out the reason was that in our native iOS module we added categories to an Objective C class (extensions to a Swift class also will cause the same error).
Also, if we added a class method we got the same error.
Is there a way to fix these weird limitations?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
最后,我们能够找出原因。当我们在本机模块中使用扩展(对类或协议)或静态变量或类函数时,AppCenter 构建将失败并出现上述奇怪的错误。当我们删除它们时,AppCenter 构建就通过了。虽然已经查明原因,但原因尚不清楚。它可能是 AppCenter 构建脚本中的命令行参数吗?我们不知道。无论如何,尝试
从本机模块中
Finally, we were able to spot the cause. When we use an extension (to either a class or a protocol) or a static var or a class function in the native module, the AppCenter build would fail with the above weird error. When we removed them, AppCenter build passed. Although the cause is spotted, the reason is not clear yet. Could it be command-line arguments in AppCenter's build script? We don't know. Anyways, try to remove
from the native module to avoid AppCenter build failure.