升级到 Xcode 10 后的问题:找不到构建输入文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/52401856/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Problems after upgrading to Xcode 10: Build input file cannot be found
提问by user616076
I upgraded my Xcode SDK to version 10 last night and then find I cannot build.
我昨晚将我的 Xcode SDK 升级到版本 10,然后发现我无法构建。
I'm getting this error:
我收到此错误:
Build input file cannot be found: '/Users/call01/Library/Developer/Xcode/DerivedData/Comp-Lite-Apps-gytvmossqptokeafrddvvmnlzadk/Build/Products/Debug-iphoneos/SG11.app/SG11
找不到构建输入文件:'/Users/call01/Library/Developer/Xcode/DerivedData/Comp-Lite-Apps-gytvmossqptokeafrddvvmnlzadk/Build/Products/Debug-iphoneos/SG11.app/SG11
which did not exist before my upgrade and I'm tempted to revert back but would like to stick with version 10 if I can resolve this issue.
在我升级之前它不存在,我很想恢复,但如果我能解决这个问题,我想坚持使用版本 10。
回答by schmidt9
Try to switch back to the Legacy Build System
(File > Project Settings > Workspace Settings > Legacy Build System
)
尝试切换回Legacy Build System
( File > Project Settings > Workspace Settings > Legacy Build System
)
回答by AnthonyR
For Swift files or files that belong to the project such as :
对于 Swift 文件或属于项目的文件,例如:
Build input file cannot be found: PATH/TO/FILE/FILE.swift
Build input file cannot be found: PATH/TO/FILE/FILE.swift
This issue can happen when files or folders have been removed or moved in the project.
当在项目中删除或移动文件或文件夹时,可能会发生此问题。
To fix-it :
要解决这个问题 :
1. Go in the project-navigator, select your project
1. 进入项目导航器,选择您的项目
2. Select Build Phases
tab
2. 选择Build Phases
标签
3. In Compile Sources
section, check for the file(s) that Xcode is complaining of
3. 在Compile Sources
部分中,检查 Xcode 抱怨的文件
4. Notice that the file(s) have the wrong path, and delete them by clicking on the minus icon
4. 注意文件路径错误,点击减号删除
5. Re-add the file(s) by clicking the plus icon and search in the project.
5. 通过单击加号图标并在项目中搜索来重新添加文件。
6. Product > Clean Build Folder
6. 产品 > 清理构建文件夹
7. Build??
7. 构建??
You generally find these missing files in the Recovered References
folder of Xcode in the project tree (look for the search bar at the bottom-left of Xcode and search for your complaining file) :
您通常会Recovered References
在项目树中的 Xcode 文件夹中找到这些丢失的文件(查找 Xcode 左下角的搜索栏并搜索您的抱怨文件):
Delete them from this folder can also solved the error.
从此文件夹中删除它们也可以解决错误。
回答by Krishna Thakur
回答by Mile Dev
This worked for me in Xcode 10:
这在 Xcode 10 中对我有用:
- Click Project icon/name in your Xcode project
- Go to General tab
- Click [Choose info.plist File] under Identity section
- Select the info.Plist file
- Check Info tab to see if info.plist was loaded successfully
- Build and run
- 单击 Xcode 项目中的项目图标/名称
- 转到常规选项卡
- 单击 Identity 部分下的 [Choose info.plist File]
- 选择 info.Plist 文件
- 检查信息选项卡以查看 info.plist 是否已成功加载
- 构建并运行
回答by danielhadar
Funnily, closing Xcode and reopening it might also be enough.
有趣的是,关闭 Xcode 并重新打开它也可能就足够了。
回答by david m lee
The above solution eventually works for me; however, I need to do some more extra steps to finally make it to compile successfully. (These extra steps were required even on Xcode 9.)
上述解决方案最终对我有用;但是,我需要做一些额外的步骤才能最终使其成功编译。(即使在 Xcode 9 上也需要这些额外的步骤。)
- Xcode: File -> Workspace Settings -> Build System: Legacy Build System
- Xcode: Product -> Clean
- Rotate to compile thru different emulator types, such as "iPhone 8", "iPhone 8 Plus", etc. (They might fail or might not.)
- Eventually compile on "Generic iOS Device"
- Xcode: File -> Workspace Settings -> Build System: Legacy Build System
- Xcode:产品 -> 清洁
- 旋转以通过不同的模拟器类型进行编译,例如“iPhone 8”、“iPhone 8 Plus”等(它们可能会失败,也可能不会。)
- 最终在“通用 iOS 设备”上编译
回答by Anastasiia Staiko
I fixed this issue this way: go to your project's Build Phases (click on project icon at the top, and then click on Build Phases). Search for your file there. If it's there (it'll be grayed out), delete it. Then clean (shift + alt + command + k), and run! Hope it helps.
我通过这种方式解决了这个问题:转到项目的构建阶段(单击顶部的项目图标,然后单击构建阶段)。在那里搜索您的文件。如果它在那里(它会变灰),删除它。然后清理(shift + alt + command + k),然后运行!希望能帮助到你。
回答by Tikhonov Alexander
回答by keverly
If the error says it can't find Info.plist and it's looking in the wrong path, do the following:
如果错误说它找不到 Info.plist 并且它在错误的路径中查找,请执行以下操作:
- Select your project from the navigator, then select your target
- Select "Build Settings" and search "plist"
- There should be an option called Info.plist File. Change the location to the correct one.
- 从导航器中选择您的项目,然后选择您的目标
- 选择“构建设置”并搜索“plist”
- 应该有一个名为 Info.plist 文件的选项。将位置更改为正确的位置。
回答by Ben Gomm
None of the above worked for me, but this did:
以上都不适合我,但这样做了:
- Open project in Finder, right click on your .xcodeproj file and show package contents
- Open project.pbxproj in a text editor
- Find the reference to your missing file
- Edit
path = "path/to/file.swift"
to the actual location on disk and save the file. - Rebuild the project
- 在 Finder 中打开项目,右键单击您的 .xcodeproj 文件并显示包内容
- 在文本编辑器中打开 project.pbxproj
- 找到对丢失文件的引用
- 编辑
path = "path/to/file.swift"
到磁盘上的实际位置并保存文件。 - 重建项目