ios Xcode 无法在选定的目标上运行

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11767945/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 19:32:08  来源:igfitidea点击:

Xcode Cannot Run on the Selected Destination

iosxcode

提问by azamsharp

I was running my app this morning and now all of a sudden I am getting the following error when I try to run on the iPhone 5.1 simulator.

今天早上我正在运行我的应用程序,现在当我尝试在 iPhone 5.1 模拟器上运行时突然出现以下错误。

Cannot run on the selected destination

无法在选定的目标上运行

The destination does not support the architecture for which the selected software is built. Switch to a destination that supports that architecture in order to run the selected software.

目标不支持为所选软件构建的体系结构。切换到支持该架构的目标以运行所选软件。

I deleted the schemes but still no solution.

我删除了方案,但仍然没有解决方案。

I am using Mountain Lion. I am using xCode 4.4 (Recently upgraded to Mountain Lion and xCode 4.4)

我正在使用山狮。我正在使用 xCode 4.4(最近升级到 Mountain Lion 和 xCode 4.4)

UPDATE 1: Here is the view of my build settings:

更新 1:这是我的构建设置的视图:

enter image description here

在此处输入图片说明

UPDATE:Here is the actual error which prevents from it running.

更新:这是阻止它运行的实际错误。

enter image description here

在此处输入图片说明

回答by x4h1d

You might follow the steps:

您可以按照以下步骤操作:

  • Quit Xcode and iPhone simulator
  • Unplug your devices
  • Goto /Users/your_usr_name/Library/Developer/Xcode/DerivedData/
  • Delete all data under this folder
  • Start Xcode again and run your project
  • 退出 Xcode 和 iPhone 模拟器
  • 拔下您的设备
  • /Users/your_usr_name/Library/Developer/Xcode/DerivedData/
  • 删除此文件夹下的所有数据
  • 再次启动 Xcode 并运行您的项目

Hope this will solve your problem.

希望这能解决您的问题。

回答by Fran

I had this issue after updating from Facebook SDK 3.1 to Facebook SDK 3.1.1. My fault, I guess.

从 Facebook SDK 3.1 更新到 Facebook SDK 3.1.1 后,我遇到了这个问题。我的错,我猜。

Inside "resources" folder, now there is a totally useless but dangerous info.plist that, if imported, may break your project file. Don't know why they included it but I believe few of us made the same mistake recently.

在“资源”文件夹中,现在有一个完全无用但危险的 info.plist,如果导入,可能会破坏您的项目文件。不知道他们为什么包含它,但我相信我们中很少有人最近犯过同样的错误。

回答by demon

I found this problem with the version of Xcode 4.4. And finally I solved it this way:

我在 Xcode 4.4 的版本中发现了这个问题。最后我是这样解决的:

Find the "Info.plist" in your project, then unselect the target membership plus on the right side view of window, it works for me.

在您的项目中找到“Info.plist”,然后在窗口的右侧视图中取消选择目标成员资格加号,它对我有用。

回答by tipycalFlow

You might also want to check if the project uses a supported compiler in the project settingsthe option shown in blue

您可能还想检查项目是否在项目设置中使用了受支持的编译器蓝色显示的选项

回答by mohammad alabid

Its just duplicated Info.plist file just use 1 Info.plist file in files then restart xcode its fixed for me

它只是复制的 Info.plist 文件只在文件中使用 1 个 Info.plist 文件,然后重新启动 xcode,它已为我修复

回答by Bobjt

I have just encountered this error in Xcode 4.5.1, and the error went away after I take all non-alpha characters outof the Product Namebuild setting.

我刚刚遇到这个错误在Xcode 4.5.1,和错误走了后,我采取的所有非字母字符出的的Product Name构建设置。

回答by ptk

I believe this may be a current unlisted bug with Xcode 4.4+. I have/had the very same issue with my project. I deleted all versions of Xcode and restarted with 4.4, opened my project and had the error again.

我相信这可能是 Xcode 4.4+ 当前未列出的错误。我的项目有/遇到过同样的问题。我删除了所有版本的 Xcode 并以 4.4 重新启动,打开我的项目并再次出现错误。

I then started a new project with a template with a different name. Did not have the issue.

然后我用一个不同名称的模板开始了一个新项目。没有这个问题。

I then renamed my old project, started a new empty project with the same name and built/ran and got the error again. This new project was nothing more than a view controller that didn't do anything. I should have gotten a blank screen but got the same error you did.

然后我重命名了我的旧项目,启动了一个同名的新空项目并构建/运行并再次出现错误。这个新项目只不过是一个没有做任何事情的视图控制器。我应该得到一个空白屏幕,但得到了和你一样的错误。

Frustrated I shut down for the day and re-ran the old project and it worked. I had not changed anything. Currently I have the error again and neither rebooting or restarting Xcode fixes it.

沮丧我关闭了一天并重新运行旧项目并且它起作用了。我没有改变任何东西。目前我再次出现错误,重新启动或重新启动 Xcode 都无法修复它。

So in summary, a project can have absolutely no changes made, sometimes it builds and runs fine, sometimes you get this error. For the record I did not get this error running Xcode 4.3.

所以总而言之,一个项目可以完全不做任何更改,有时它构建和运行良好,有时您会收到此错误。作为记录,我在运行 Xcode 4.3 时没有遇到此错误。

My issue did not show up until I upgraded to Mountain Lion and Xcode 4.4 which happened to be on the same day. Now I can not get back to a 100 percent workable configuration.

直到我在同一天升级到 Mountain Lion 和 Xcode 4.4 后,我的问题才出现。现在我无法回到 100% 可行的配置。

回答by яοвοτа?τ?яа??

Committing my files to SVN and checking out the project in a new directory fixed this for me.

将我的文件提交到 SVN 并在新目录中检出项目为我解决了这个问题。

回答by David H

Look at both the project and target build settings, at that Architectures, and see if anything has changed. When first going from Xcode 3 to 4, it use to wreck havoc in a hidden way, giving the same error, and in the end you had to add i386 to the "Valid Architectures" line. I just looked at my big project started in Xcode 4.1, and it shows nothing about i386 etc, but I have other newer projects where I get this grayed out thing in that line $(ARCHS_STANDARD_32_BIT).

在该架构中查看项目和目标构建设置,看看是否有任何更改。当第一次从 Xcode 3 升级到 4 时,它以一种隐藏的方式破坏了破坏,给出了同样的错误,最后你不得不将 i386 添加到“有效架构”行。我只是看着我在 Xcode 4.1 中启动的大项目,它没有显示任何关于 i386 等的信息,但我还有其他较新的项目,我在 $(ARCHS_STANDARD_32_BIT) 行中得到了这个灰色的东西。

EDIT: I took a relook at this with a guru friend. Neither of us can find a linkage to i386 in our projects - Xcode is using some magic. That said, I did get a hit to i386 in a binary plist within the project, which leads me to another suggestion.

编辑:我和一位大师朋友重新审视了这个。我们都无法在我们的项目中找到指向 i386 的链接——Xcode 使用了一些魔法。也就是说,我确实在项目中的二进制 plist 中遇到了 i386,这使我提出了另一个建议。

In your build settings, insure that ALL "Architectures" are $(ARCHS_STANDARD_32_BIT).

在您的构建设置中,确保所有“架构”都是 $(ARCHS_STANDARD_32_BIT)。

If that does not work, we suggest that you look at the compile and ld lines of your build when you select iPhone 5.1 Simulator in the scheme menu - to see if in fact its i386,

如果这不起作用,我们建议您在方案菜单中选择 iPhone 5.1 Simulator 时查看构建的 compile 和 ld 行 - 看看实际上它的 i386,

Another idea - move all your schemes and user settings to a save folder somewhere (with the project closed), then reopen and recreate a scheme. Now try again. There is no reference to i386 in any of my project.pbxproj files, so our suspicion is that this is somehow related to the scheme setting for the target device.

另一个想法 - 将所有方案和用户设置移动到某个地方的保存文件夹(项目关闭),然后重新打开并重新创建一个方案。现在再试一次。在我的任何 project.pbxproj 文件中都没有提到 i386,所以我们怀疑这与目标设备的方案设置有某种关系。

Good luck!

祝你好运!

回答by Gigisommo

I've solved changing in both the project and target build settings the key "Build variants" from "armv7" to "normal"

我已经解决了在项目和目标构建设置中将关键的“构建变体”从“armv7”更改为“正常”的问题