XCode 将不再在设备/模拟器上运行我的应用程序
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/27063348/
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
XCode won't run my application on a device/simulator anymore
提问by SlimShady
I am kind of stuck with my XCode problem. First of all: I have a project that contains 5 different targets. Now something went wrong (I can't remember changing anything related to project settings).
我有点被我的 XCode 问题困住了。首先:我有一个包含 5 个不同目标的项目。现在出了点问题(我不记得更改与项目设置相关的任何内容)。
If I want to run any target on device or simulator the build succeeds but then nothing happens. Neither the app is started in simulator nor on a device. So I checked the Scheme (-> "Edit scheme") and I could not select my app in the Executable menu. I think I can remember that the .app file was selected there before (as it is if i create any new project). Does anyone know why I can't select anything there?
如果我想在设备或模拟器上运行任何目标,构建会成功,但没有任何反应。该应用程序既不是在模拟器中也不是在设备上启动。因此,我检查了方案(->“编辑方案”),但无法在“可执行文件”菜单中选择我的应用程序。我想我记得之前在那里选择了 .app 文件(就像我创建任何新项目一样)。有谁知道为什么我不能在那里选择任何东西?
What I am curious about, is the fact that choosing "Other" in the Executable menu brings me to my DerivedData directory that indeed contains the *.app file resulting from the build. That leads me to my next problem.
我很好奇的是,在 Executable 菜单中选择“Other”会将我带到我的 DerivedData 目录,该目录确实包含由构建产生的 *.app 文件。这让我想到了下一个问题。
If I select this *.app file explicitly and try to run the app XCode gives me the error " does not have an architecture that can execute." But I checked my settings many times and I am definitly using $(ARCHS_STANDARD) in every target.
如果我明确选择这个 *.app 文件并尝试运行应用程序,XCode 会给我错误“没有可以执行的架构”。但是我多次检查了我的设置,并且我肯定在每个目标中都使用了 $(ARCHS_STANDARD)。
I am a little bit lost here ... does anyone has a hint, what could have messed up my project and how to fix it?
我在这里有点迷茫......有没有人有提示,什么可能弄乱了我的项目以及如何解决它?
回答by JamesDill
Might not work, but I've found a lot of bugs in xcode which simply require quitting it, and reopening.
可能不起作用,但我在 xcode 中发现了很多错误,只需退出并重新打开即可。
You could also try clearing out the DerivedData directory. Do a full clean build (hold down option key when selecting clean build).
您也可以尝试清除 DerivedData 目录。执行完全干净的构建(选择干净构建时按住选项键)。
And lastly, reset the simulator via the menu iOS Simulator > Reset Content and Settings.
最后,通过菜单 iOS Simulator > Reset Content and Settings 重置模拟器。
回答by Tim
I got this when I changed the name of my App on one development machine and then tried to work on it a few months later on another machine. I fixed it by deleting the old scheme and Autocreating the new scheme. The settings are under Product - Scheme - Manage Schemes.
当我在一台开发机器上更改我的应用程序的名称,然后几个月后尝试在另一台机器上处理它时,我得到了这个。我通过删除旧方案并自动创建新方案来修复它。设置在产品 - 方案 - 管理方案下。
回答by SlimShady
OK I solved the problem by myself. I was on the right track before. I did compare the project.pbxproj file again using FileMerge. I merged all lines related to an *.app file from the working version into my corrupt project file. After that my project was fixed. The *.app files showed up under the "Product" group in XCode and I could run the application on simulator/devices again. It seems that I forgot something while I was merging the files via copy & paste. ;)
好的,我自己解决了这个问题。我以前走在正确的轨道上。我确实使用 FileMerge 再次比较了 project.pbxproj 文件。我将工作版本中与 *.app 文件相关的所有行合并到我损坏的项目文件中。之后我的项目就修好了。*.app 文件显示在 XCode 的“产品”组下,我可以再次在模拟器/设备上运行应用程序。在通过复制和粘贴合并文件时,我似乎忘记了一些东西。;)
回答by iOSPadawan
Rather than cleaning out the DerivedData directory from Xcode, have you tried the "old fashioned" way from Finder? Try quitting Xcode, nuking ~/Library/Developer/Xcode/DerivedData/ModuleCache
from Finder, and restarting Xcode.
您是否尝试过 Finder 中的“老式”方式,而不是从 Xcode 中清除 DerivedData 目录?尝试退出 Xcode,~/Library/Developer/Xcode/DerivedData/ModuleCache
从 Finder 中删除,然后重新启动 Xcode。