Xcode 无法使用所选设备运行
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13257944/
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 cannot run using the selected device
提问by linuxer
I am receiving the following error when I try to run my Xcode iOS project:
当我尝试运行我的 Xcode iOS 项目时收到以下错误:
Xcode cannot run using the selected device. Choose a destination with a supported architecture in order to run on this device.
I have had this error for a while now. I was able to get around it by using an actual device instead of a simulator, but now that doesn't work either. I haven't changed a single setting in the project since creating it, all that I have changed is the code itself. This has also happened before and the only way I fixed it was to create a new project and start from scratch and now it is happening again from that. I am so frustrated! I have no idea what to do. What info do I need to provide to help diagnose this? I am using the facebook sdk 3.1 if that means anything.
我已经有一段时间了这个错误。我能够通过使用实际设备而不是模拟器来绕过它,但现在这也不起作用。自从创建项目以来,我没有更改项目中的任何设置,我更改的只是代码本身。以前也发生过这种情况,我修复它的唯一方法是创建一个新项目并从头开始,现在又发生了。我很沮丧!我不知道该怎么做。我需要提供哪些信息来帮助诊断?如果这意味着什么,我正在使用 facebook sdk 3.1。
Thanks
谢谢
采纳答案by Nirav Bhatt
- Clean up your project using Clean, Clean folders, Delete derived data.
- Delete all schemes from 'manage schemes'. Recreate them, and build using any of them that contains a version of iPhone simulator (the one that worked earlier).
- 使用清理、清理文件夹、删除派生数据清理您的项目。
- 从“管理方案”中删除所有方案。重新创建它们,并使用其中任何一个包含 iPhone 模拟器版本(之前运行的那个)进行构建。
If that doesn't work, try this:
如果这不起作用,请尝试以下操作:
- Clean up your project using Clean, Clean folders, Delete derived data.
- Using your favourite editor, try clearing all the profile strings from your project.pbxproj file (the one that you see when you open your xcode project using 'Show Package Contents' command).
- 使用清理、清理文件夹、删除派生数据清理您的项目。
- 使用您最喜欢的编辑器,尝试清除 project.pbxproj 文件(使用“显示包内容”命令打开 xcode 项目时看到的文件)中的所有配置文件字符串。
See below image - you must delete all lines containing 'Provisioning Profile' till the ; character.
见下图 - 您必须删除所有包含“配置文件”的行,直到 ; 特点。
- Then restart xcode. Select the profile using automatic profile selector and build using an iphone simulator scheme.
- 然后重启xcode。使用自动配置文件选择器选择配置文件并使用 iphone 模拟器方案构建。
回答by Artur
Target -> Build Settings -> Build Options set the "Compiler for C/C++/Objective-C" - "Default compiler (Apple LLVM 5.0)" and the issue will be solved
Target -> Build Settings -> Build Options 设置“Compiler for C/C++/Objective-C”-“默认编译器(Apple LLVM 5.0)”,问题就解决了
回答by jsherk
Check that the Executable File (also known as CFBundleExecutable) in the Info.plist file is set to ${EXECUTABLE_NAME}as opposed to any hardcoded value. This will ensure that even if you change your project name or target name or scheme name, that it still works.
检查 Info.plist 文件中的可执行文件(也称为 CFBundleExecutable)是否设置为${EXECUTABLE_NAME}而不是任何硬编码值。这将确保即使您更改了项目名称或目标名称或方案名称,它仍然有效。
回答by araferna
Please Check the following: -Connect your device with another cable. -Check if the cable is properly connected. This was my problem Thanks
请检查以下内容: - 用另一根电缆连接您的设备。- 检查电缆是否正确连接。这是我的问题 谢谢
回答by jbcaveman
I had this error when trying to run a DEBUG build. I changed "Build Active Architecture" to YES for DEBUG and this error finally went away after hours of frustration. I tried about 10 different things that I read on this site and nothing else worked.
尝试运行调试版本时出现此错误。我将 DEBUG 的“Build Active Architecture”更改为 YES,经过数小时的挫折后,这个错误终于消失了。我尝试了在本网站上阅读的大约 10 种不同的东西,但没有其他任何效果。
回答by passwind
I found the error was because of unsupported compiler in building settings. Check Project Building Settings --> Build Options --> Compiler for C/C++/Objective-C. Change to "Default compiler (Apple LLVM 5.0)". Everything is OK.
我发现错误是因为构建设置中的编译器不受支持。检查项目构建设置--> 构建选项--> C/C++/Objective-C 编译器。更改为“默认编译器(Apple LLVM 5.0)”。一切都好。
回答by TheGrayVacuum
I had this error when trying to test my app. Here's what worked for me:
尝试测试我的应用程序时出现此错误。这是对我有用的:
In Targets > Build Settings, I changed the Product Name to match the Target name and this fixed it for me.
在目标 > 构建设置中,我更改了产品名称以匹配目标名称,这为我修复了它。
回答by Fabian
I had the same problem, and fixed it by opening the info.plist file in Resources and unchecked the target membership so that nothing is checked as target membership.
我遇到了同样的问题,并通过在资源中打开 info.plist 文件并取消选中目标成员资格来修复它,以便没有检查目标成员资格。
回答by Gank
I solved by rebooting mac (also have rebooted iPad)
我通过重启 mac 解决了(也重启了 iPad)
回答by andrewz
In XCode 6 I opened the Devices window (Window/Devices) and noticed my iPhone was not listed there, even though it was plugged in to the mac at that time. I unplugged it and then plugged it right back in while the Devices window was open, and it appeared in the device list and also in the scheme picker.
在 XCode 6 中,我打开了设备窗口 (Window/Devices) 并注意到我的 iPhone 没有列在那里,即使它当时已插入 mac。我拔掉它,然后在“设备”窗口打开时将其重新插入,它出现在设备列表和方案选择器中。