Unknown type name 'import'
未关闭
还没有人认领这个 Issue。
Issue: Author Provided Repro
Needs: Attention
- 主要语言
- C++
- 星标
- 127k
- 派生
- 25.3k
- 平均合并
- 1 天 23 小时
- 30 天内合并 PR
- 4
描述
Description
After switching to AppDelegate.swift xcode started giving this error
Steps to reproduce
- Update rn version from 0.76 to 0.77/0.78
- Update AppDelegate.mm file to AppDelegate.swift
- Delete main.m and AppDelegate.h
- build via xcode
React Native Version
0.78.0
Affected Platforms
Build - MacOS
Output of npx @react-native-community/cli info
System:
OS: macOS 15.2
CPU: (8) arm64 Apple M1
Memory: 89.20 MB / 8.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 18.18.0
path: ~/.nvm/versions/node/v18.18.0/bin/node
Yarn:
version: 1.22.22
path: /usr/local/bin/yarn
npm:
version: 9.8.1
path: ~/.nvm/versions/node/v18.18.0/bin/npm
Watchman:
version: 4.7.0
path: /usr/local/bin/watchman
Managers:
CocoaPods:
version: 1.16.2
path: /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 24.2
- iOS 18.2
- macOS 15.2
- tvOS 18.2
- visionOS 2.2
- watchOS 11.2
Android SDK: Not Found
IDEs:
Android Studio: 2020.3 AI-203.7717.56.2031.7583922
Xcode:
version: 16.2/16C5032a
path: /usr/bin/xcodebuild
Languages:
Java:
version: 11.0.1
path: /usr/bin/javac
Ruby:
version: 2.6.10
path: /usr/bin/ruby
npmPackages:
"@react-native-community/cli":
installed: 15.0.1
wanted: 15.0.1
react:
installed: 19.0.0
wanted: 19.0.0
react-native:
installed: 0.78.0
wanted: 0.78.0
react-native-macos: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: false
iOS:
hermesEnabled: true
newArchEnabled: false
Stacktrace or Logs
AppDelegate.swift:1:1: error: unknown type name 'import'
1 | import UIKit
AppDelegate.swift:1:13: error: expected ';' after top level declarator
1 | import UIKit
Reproducer
Screenshots and Videos
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从链接的复现用例和 AppDelegate.swift 迁移开始,然后将其与已删除的 AppDelegate.mm、main.m 和 AppDelegate.h 文件进行比较。通过 Xcode 构建项目,并追踪 Swift 文件为何被解析为另一种源代码类型;完成标准是 React Native 0.78 项目能够在没有报告中的错误的情况下构建。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- ios, react-native, swift
- 领域
- build-system, mobile
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 28/100