升级到 Xcode 5.0 后,Xcode 无法使用所选设备运行
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18990774/
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 after upgrade to Xcode 5.0
提问by JeffB6688
I upgraded to xcode 5.0 today. I then pressed play to run my project in the iOS simulator. This initially worked. Then I decided that I wanted to run the profiler. When I did that, I got the message:
我今天升级到 xcode 5.0。然后我按下 play 在 iOS 模拟器中运行我的项目。这最初奏效了。然后我决定运行分析器。当我这样做时,我收到了消息:
Xcode cannot run using the selected device.
Choose a destination with a supported architecture in order to run on this device.
I looked at a couple past posts on this problem and decided to do a Clean and Build. Now I can no longer run in the profiler or the simulator. I consistently get the message:
我查看了过去关于此问题的几篇帖子,并决定进行清理和构建。现在我无法再在分析器或模拟器中运行。我始终收到消息:
Xcode cannot run using the selected device.
Choose a destination with a supported architecture in order to run on this device.
How can I resolve this?
我该如何解决这个问题?
Here are various settings:
以下是各种设置:
My Deployment Target is 6.1
我的部署目标是 6.1
I have also tried changing the deployment target to 7.0, but that did not work either
我也尝试将部署目标更改为 7.0,但这也不起作用
回答by JeffB6688
It appears that the problem is not related to the architecture in the build settings as the error might suggest. Rather, I found that the problem seems to be related to the Build Options Compiler for C/C++/Objective C. I was using a gcc compiler (com.apple.compilers.llvmgcc42) and Xcode 5 has marked this as unsupported.
似乎该问题与构建设置中的体系结构无关,因为错误可能暗示了这一点。相反,我发现问题似乎与 C/C++/Objective C 的构建选项编译器有关。我使用的是 gcc 编译器 (com.apple.compilers.llvmgcc42),而 Xcode 5 已将此标记为不受支持。
If I change the compiler to apple's default Apple LLVM 5.0, the project builds and it can now run in the simulator. The downside is that I have a lot of compiler warnings from code related to cocos2D v1.0 source code. But, at least I have a way forward.
如果我将编译器更改为 Apple 的默认 Apple LLVM 5.0,则项目将构建并且现在可以在模拟器中运行。缺点是我有很多来自与 cocos2D v1.0 源代码相关的代码的编译器警告。但是,至少我有前进的道路。
回答by Chris Alan
Please follow below step
请按照以下步骤
1>Go to Project Build setting
1>转到项目构建设置
2>Change compiler for c/c++/objective c as Default compiler(Apple LLVM 5.0) (see in below image)
2> 将 c/c++/objective c 的编译器更改为默认编译器(Apple LLVM 5.0)(见下图)
回答by rjobidon
I had to change compiler for Default compiler (Apple LLVM 5.0) at two places:
我不得不在两个地方更改默认编译器(Apple LLVM 5.0)的编译器:
- Build Settings > Build Options > Compiler for C/C++/Objective-C (change to LLVM)
- Build Rules > Files *.mc using GCC (change to LLVM)
- 构建设置 > 构建选项 > C/C++/Objective-C 编译器(更改为 LLVM)
- 使用 GCC 构建规则 > 文件 *.mc(更改为 LLVM)
Hard to find because code compiles even if Build Rules point to an undefined compiler.
很难找到,因为即使构建规则指向未定义的编译器,代码也会编译。
回答by Jason Moore
After inspecting all the build settings for 15 minutes, this worked for me (Xcode 5.0.2):
检查所有构建设置 15 分钟后,这对我有用(Xcode 5.0.2):
Quit and restart Xcode
退出并重新启动 Xcode
回答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 A.Badger
This issue often occurs after duplicating targets on older projects.
在旧项目上复制目标后,通常会出现此问题。
Set the following in your Info.plist for the target:
在您的 Info.plist 中为目标设置以下内容:
Bundle Name = ${PRODUCT_NAME}
Bundle Display Name = ${PRODUCT_NAME}
Executable file = ${EXECUTABLE_NAME}
Build and run with these settings, after a successful build they can be changed to anything you want.
使用这些设置构建和运行,成功构建后,它们可以更改为您想要的任何内容。
回答by Khang Azun
This works for me: "Quit and restart Xcode". I recently updated something and the testing device on Xcode said: 'iDevice' not iPhone or iPod. So I restarted then my iPhone came back to the target list.
这对我有用:“退出并重新启动 Xcode”。我最近更新了一些东西,Xcode 上的测试设备说:“iDevice”而不是 iPhone 或 iPod。所以我重新启动然后我的 iPhone 回到目标列表。
回答by ediheld
I had this error when I changed the value of the "Bundle name"-key in the Target Properties. Changing it back to "%{PRODUCT_NAME}" solved the problem for me.
当我更改目标属性中“捆绑包名称”键的值时出现此错误。将其改回“%{PRODUCT_NAME}”为我解决了这个问题。