Xcode 4.5 不在模拟器或设备上运行/加载应用程序
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12610090/
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 4.5 doesn't run / load app on simulators or device
提问by delliottg
I'm running Xcode 4.5 on OS X Lion 10.7.5 on a Mid 2007 Mac Mini. I've run into this problem before where the simulators as well as actual devices don't run the app when I build. I'm writing a couple of different applications using Phonegap 2.1, HTML, JS, Jquery Mobile. I've reinstalled Xcode 2-3x after following the instructions from OSX Dailyand SO How to fully remove Xcode 4. This worked for a while, but then my 300gb SSD drive died & I had to reinstall the OEM 120 GB hard drive & reinstall Xcode & Phonegap (both had revved versions since the drive had been uninstalled). Now I'm unable to get Xcode to start the simulators or download to my iPhone 4 again. I completely uninstalled Xcode again yesterday & reinstalled. The first time I tried to build, it took a long time downloading the 5.1 simulators (* see edit below), but finally "finished", but still didn't run them. Tried downloading to my phone, again nothing.
我在 2007 年中 Mac Mini 上的 OS X Lion 10.7.5 上运行 Xcode 4.5。在我构建时模拟器和实际设备不运行应用程序之前,我遇到过这个问题。我正在使用 Phonegap 2.1、HTML、JS、Jquery Mobile 编写几个不同的应用程序。按照OSX Daily和SO 如何完全删除 Xcode 4的说明,我重新安装了 Xcode 2-3x. 这工作了一段时间,但后来我的 300gb SSD 驱动器没电了,我不得不重新安装 OEM 120 GB 硬盘驱动器并重新安装 Xcode 和 Phonegap(自从驱动器被卸载后,两者都有改进的版本)。现在我无法让 Xcode 启动模拟器或再次下载到我的 iPhone 4。我昨天再次完全卸载了Xcode并重新安装。我第一次尝试构建时,花了很长时间下载 5.1 模拟器(* 见下面的编辑),但最终“完成”,但仍然没有运行它们。尝试下载到我的手机,还是没有。
Since this is the third or fourth time that this has happened, I'm wondering what I'm doing wrong. Obviously I'm missing something because I don't see this problem being screamed about on the various support forums like here, Google, or Apple, only bits & pieces here and there.
由于这是第三次或第四次发生这种情况,我想知道我做错了什么。显然我遗漏了一些东西,因为我没有看到这个问题在像这里、谷歌或苹果这样的各种支持论坛上大喊大叫,只是到处都是零碎的。
As a test, I created a bare bones PhoneGap app that has nothing in it but whatever PG creates, and it doesn't run the simulators or download to my phone. This same method used to work just to test the system, but no longer. It builds fine, and darkens the square "running" button for a few seconds, and then the button lightens again like you've stopped the app, and that's it. No error messages, no build faults, nothing.
作为测试,我创建了一个简单的 PhoneGap 应用程序,除了 PG 创建的任何内容外,它没有任何内容,并且它不运行模拟器或下载到我的手机。这种相同的方法过去仅用于测试系统,但不再适用。它构建良好,使方形“运行”按钮变暗几秒钟,然后按钮再次变亮,就像您停止了应用程序一样,就是这样。没有错误消息,没有构建错误,什么都没有。
Intel is replacing my SSD drive, so I'm going to have to go through this all over again when it gets here, unless I can get a working copy running on the hard drive, then clone it with Carbon Copy Cloner so I can just copy that onto the new drive.
英特尔正在更换我的 SSD 驱动器,所以当它到达这里时我将不得不再次经历这一切,除非我可以在硬盘驱动器上运行工作副本,然后使用 Carbon Copy Cloner 克隆它,这样我就可以将其复制到新驱动器上。
Any help would be greatly appreciated, I'd really like to not have to deal with this on an ongoing basis.
任何帮助将不胜感激,我真的不想一直处理这个问题。
*Edit: I originally deleted this question because I thought I'd done something stupid, I realized I'd downloaded the documentationfor the simulators, but not the actual simulators. I've since downloaded the 5.1 simulators and I'm still experiencing the same problems.
*编辑:我最初删除了这个问题,因为我认为我做了一些愚蠢的事情,我意识到我已经下载了模拟器的文档,但没有下载实际的模拟器。我已经下载了 5.1 模拟器,但仍然遇到同样的问题。
采纳答案by delliottg
So, I'm not sure this is the actual answer, but I seem to have found a procedural sequence that works.
所以,我不确定这是实际的答案,但我似乎找到了一个有效的程序序列。
First: I completely deleted Xcode (again), reinstalled it from scratch (again), and updated all the simulators except 4.3 as well as the command line tools (Xcode > Preferences > Download > Components > All simulators except 4.3 & the command line tools) again.
第一:我完全删除了 Xcode(再次),从头开始(再次)重新安装它,并更新了除 4.3 之外的所有模拟器以及命令行工具(Xcode > Preferences > Download > Components > All Simulators except 4.3 & the command line tools ) 再次。
Second: I also reinstalled PhoneGap 2.1, but I'm not sure this was necessary, it was more of a scorched earth campaign. The problem in Xcode seemed to stem from the Scheme, I kept getting Schemes named "CordovaLib" instead of my project names. If you click on "CordovaLib" on the Scheme/Simulator buttons (the top left hand side is where the available schemes & simulartors are listed, right next to the build & stop buttons), and change the scheme to the project name that helps.
第二:我还重新安装了 PhoneGap 2.1,但我不确定这是否有必要,这更像是一场焦土运动。Xcode 中的问题似乎源于 Scheme,我一直将 Schemes 命名为“CordovaLib”而不是我的项目名称。如果您单击“方案/模拟器”按钮上的“CordovaLib”(左上角是列出可用方案和模拟器的位置,就在构建和停止按钮旁边),并将方案更改为有帮助的项目名称。
Third: You need to make sure that the location for your app is set to "unique". Do this at Xcode > Preferences > Locations > Locations (not Source Trees) > Derived Data > Advanced > Build Location == Unique > Done.
第三:您需要确保您的应用程序的位置设置为“唯一”。在 Xcode > Preferences > Locations > Locations (not Source Trees) > Derived Data > Advanced > Build Location == Unique > Done 中执行此操作。
It seems to help to open the projects in Xcode instead of launching them from Finder, but I'm not convinced that's true, it just seemedto work better, but I could be imagining it.
在 Xcode 中打开项目而不是从 Finder 启动它们似乎有帮助,但我不相信这是真的,它似乎工作得更好,但我可以想象它。
If I do this on projects I used to have problems on, I can now download them to the simulators & my phone.
如果我在过去遇到问题的项目上这样做,我现在可以将它们下载到模拟器和我的手机。
This didn't get any responses, but maybe someone else will find it useful.
这没有得到任何回应,但也许其他人会发现它有用。
回答by Ronbo
I had a similar situation happen when I was trying to run my first HelloWorld
app for Phone Gap iOS.
当我尝试HelloWorld
为 Phone Gap iOS运行我的第一个应用程序时,我遇到了类似的情况。
It turned out for me the executable was missing from Edit schema dialog
. Very odd since it ran fine a few times and then it stopped working until I found this dialog.
结果对我来说,可执行文件从Edit schema dialog
. 很奇怪,因为它运行良好几次然后停止工作,直到我找到这个对话框。
You can find this dialog in Product -> Edit Scheme --> Info --> Executable
(make sure it is not empty).
您可以在Product -> Edit Scheme --> Info --> Executable
(确保它不为空)中找到此对话框。
Although, you found your solution this is a quick check that may help others.
虽然,您找到了您的解决方案,但这是一个快速检查,可以帮助其他人。
回答by Vaibhav Saran
before follow please read my edited comments below
在关注之前,请阅读下面我编辑过的评论
- Quit XCode
- Quit Simulator
go to all the path in the image and delete all these folders
Open simulator and in iOS Simulator menu
Reset content and settings
. Reset it
- 退出 XCode
- 退出模拟器
转到图像中的所有路径并删除所有这些文件夹
打开模拟器并在 iOS Simulator 菜单中
Reset content and settings
。重置它
Start XCode and you should not worry now.
启动 XCode,你现在不用担心了。
EDIT
编辑
I again got issue few days after the error so I tried the steps above but nothing happened :(, 2nd time i reinstalled the xcode after deleting everything related to xcode and simulator and made a new project. For a clean project application run well but again copying all files from older project in same manner, again faced the same issue. So how i fixed that?
错误发生几天后,我再次遇到问题,所以我尝试了上述步骤,但没有任何反应:(,第二次我在删除与 xcode 和模拟器相关的所有内容并创建了一个新项目后重新安装了 xcode。对于一个干净的项目应用程序运行良好,但再次以相同的方式从旧项目复制所有文件,再次面临同样的问题。那么我是如何解决的?
You might still need to follow the steps above, not sure these works or not. But i tried to find that the issue starts at the time when i was copying files from old project.
您可能仍需要按照上述步骤操作,不确定这些是否有效。但是我试图发现问题是在我从旧项目复制文件时开始的。
While adding files to the new project a dialog box appears to ask location of existing files and if you see folders
option with 2 radio buttons
then by default Create group of any added folder (if needed)
is selected. Everything went well until i did not touch these options.
将文件添加到新项目时,会出现一个对话框,询问现有文件的位置,如果您看到folders
带有 2 的选项,radio buttons
则默认Create group of any added folder (if needed)
选择。一切都很顺利,直到我没有触及这些选项。
Green:Default, Red:user selected
绿色:默认, 红色:用户选择
But problem started appearing again when for a Resources
folder I used the 2nd radio button
that says, Create folder references for any added folder
. When I removed this folder reference and cleaned project, application ran well. Adding same folder with Create group of any added folder (if needed)
option worked also well. Whenever I chose 1st radio button, application showed same issue.
但是当Resources
我使用一个文件夹时,问题又开始出现了2nd radio button
,Create folder references for any added folder
. 当我删除此文件夹引用并清理项目时,应用程序运行良好。添加带有Create group of any added folder (if needed)
选项的相同文件夹也很有效。每当我选择第一个单选按钮时,应用程序都会出现同样的问题。
and
和
I believe you understand difference between these 2 optionsi.e. folder colors to yellow
and folder colors to blue
! Hope this helps all other people also but it is really frustrating and i request apple to fix this bug ASAP :( :(
我相信您了解这两个选项之间的区别,即文件夹颜色到yellow
和文件夹颜色到blue
!希望这也能帮助所有其他人,但这真的很令人沮丧,我要求苹果尽快修复这个错误 :( :(
回答by Matthew Little
I had to delete the schema and recreate;
我不得不删除架构并重新创建;
- Product >> Schema >> Edit Schema.
- Then Manage Schemes.
- Then hit "-" to delete schema and
- Autocreate Schemes Now.
- 产品>>架构>>编辑架构。
- 然后管理方案。
- 然后点击“-”删除模式和
- 立即自动创建方案。
Then, in Simulator, I reset settings. Then it worked.
然后,在模拟器中,我重置设置。然后它起作用了。
回答by SomethingOn
I resolved the problem by changing the active schema to HelloWorld instead of CordovaLib.
我通过将活动模式更改为 HelloWorld 而不是 CordovaLib 解决了该问题。
Product->Scheme->HelloWorld - make sure the checkmark is beside this item instead of CordovaLib.
Product->Scheme->HelloWorld - 确保该项目旁边有复选标记,而不是 CordovaLib。
回答by pastullo
I had to go to Product > Schema > Edit Schema
我必须去产品 > 架构 > 编辑架构
Then in the Run dialog, the Executable dropdown was on None. I changed it to the .app file and it worked!
然后在“运行”对话框中,“可执行文件”下拉菜单为“无”。我将其更改为 .app 文件并且它起作用了!