fatal error: 'AppDelegate.h' file not found #import "AppDelegate.h"

fatal error: 'AppDelegate.h' file not found #import "AppDelegate.h"

描述

我的项目以前是可以运行的,但是自从我添加了一些 babel 插件后,它就无法编译。 请注意,我不知道它们是否相关,即使我删除了我添加的内容,它仍然会抛出相同的错误。

我的.babelrc

{
  "presets": [
    "react-native"
  ],
  "plugins": [
    "transform-decorators-legacy",
    "transform-async-generator-functions",
    "transform-object-rest-spread",
    "transform-class-properties",
    "transform-runtime",
    "transform-regenerator"
  ]
}

错误:

以下错误很含糊。

/Users/XXXXXX/WebstormProjects/FluxRN/ios/FluxRN/main.m:12:9: fatal error: 'AppDelegate.h' file not found

import "AppDelegate.h"

    ^~~~~~~~~~~~~~~ 1 error generated.

** BUILD FAILED **

The following build commands failed: CompileC build/Build/Intermediates.noindex/FluxRN.build/Debug-iphonesimulator/FluxRN.build/Objects-normal/x86_64/main.o FluxRN/main.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (1 failure)

即使构建失败,模拟器也会启动并出现此错误。

问题

是什么导致构建崩溃?

找不到 AppDelegate.h 令我感到困惑。当我在XCode中打开我的iOS工程时,明明是在工程的根目录下

注意:回到我之前的地方仍然会抛出同样的错误。

react-native upgrade 似乎已经解决了以下问题:

fatal error: 'AppDelegate.h' file not found #import “AppDelegate.h”

react-native 更新后生成的 iOS 中的文件夹结构不是最新的。 运行 上面的命令将解决这个问题。但是,我仍然遇到异常(来自屏幕截图),因此这可能来自另一个问题。

-#import "AppDelegate.h"
+#import "../../../ios/ReactNativeExampleProject/AppDelegate.h"

任何正在寻找另一种解决方案的人,请提供适合我的导入的特定路径