Xcode 4 没有启动应用程序?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5285431/
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 not launching application?
提问by Jumhyn
Today, after installing Xcode4 with the 4.3 SDK, I attempted to launch my application. However, the application will build and the iOS Simulator will pop up, but I get a message in the window in Xcode that says "Attaching to YourApp" which stays there indefinitely. How can this problem be fixed?
今天,在使用 4.3 SDK安装Xcode4后,我尝试启动我的应用程序。但是,应用程序将构建并弹出 iOS 模拟器,但我在 Xcode 的窗口中收到一条消息,显示“附加到 YourApp”,该消息无限期地停留在那里。如何解决这个问题?
采纳答案by Jonathan.
This happened for me for iPhone applications. I opened the simulator myself and switched the device to iPhone Retina Displayand from then on it worked. I tried switching back, but it didn't work again, so I have had to keep it on the Retina Display simulator, and if I need to test non-Retina Display I'll use the iPad simulator.
这发生在我的 iPhone 应用程序中。我自己打开模拟器并将设备切换到 iPhone Retina Display,然后它就可以工作了。我尝试切换回来,但它再次不起作用,所以我不得不将它保留在 Retina Display 模拟器上,如果我需要测试非 Retina Display,我将使用 iPad 模拟器。
回答by davethewave
I had the same problem, that is, when I launched my application in the simulator, Xcode was hung waiting for the simulator to start. The simulator showed a black screen - nothing at all.
我遇到了同样的问题,即当我在模拟器中启动我的应用程序时,Xcode 被挂起,等待模拟器启动。模拟器显示黑屏 - 什么也没有。
Note this is a project that ran fine on Xcode 3 and is the exact set of files used to build the application that is currently for sale at the App Store.
请注意,这是一个在 Xcode 3 上运行良好的项目,并且是用于构建当前在 App Store 上出售的应用程序的确切文件集。
Okay, so here's the underlying problem, and my solution:
好的,这是潜在的问题,以及我的解决方案:
My application name was "ultimateTimer.app", as seen in Xcode under the Products folder. However, this was NOT the name in the project file.
我的应用程序名称是“ultimateTimer.app”,在 Xcode 的 Products 文件夹下可以看到。但是,这不是项目文件中的名称。
Here's how to found out: Click on your project in Xcode (it's usually at the top, e.g. mine is called ultimateTimer.xcodeproj). Under "Build Settings" tab, look for the "Packaging" area and specifically for the "Product Name" variable. Under Product Name, I had three entries:
查找方法如下: 在 Xcode 中单击您的项目(它通常在顶部,例如我的项目称为 UltimateTimer.xcodeproj)。在“构建设置”选项卡下,查找“包装”区域,特别是“产品名称”变量。在产品名称下,我有三个条目:
- Debug
- Distribution
- Release
- 调试
- 分配
- 释放
Under Debug, it had the value "TalkUltimateTimer" which was an old name of mine. When I changed this to "ultimateTimer" to match the "ultimateTimer.app" as above, I found the Xcode attached to the simulator correctly.
在 Debug 下,它具有值“TalkUltimateTimer”,这是我的旧名称。当我将其更改为“ultimateTimer”以匹配上述“ultimateTimer.app”时,我发现Xcode正确连接到模拟器。
回答by Roosh
I skimmed the post and these seem to be the two solutions thus far:
我浏览了这篇文章,到目前为止,这些似乎是两个解决方案:
I think I figured out the problem:
我想我找到了问题所在:
I went to 'Edit Schemes', and for some reason, the scheme I was using was pointing at BumpDev.app as the executable instead of bumpdev.app. Changing this made things work. Perhaps there is an issue when converting from xc3 proj files?
我去了“编辑方案”,出于某种原因,我使用的方案指向 BumpDev.app 作为可执行文件而不是bumpdev.app。改变这一点使事情奏效。从 xc3 proj 文件转换时可能存在问题?
Anyways, the app now boots in the simulator. Yay!
无论如何,该应用程序现在可以在模拟器中启动。好极了!
And the other solution in that post is:
该帖子中的另一个解决方案是:
Did your project by any chance have a folder reference with images in it?
您的项目是否有任何包含图像的文件夹引用?
For me the problem only happens when I have a folder reference in the project. When I remove the folder reference and instead add the folder as a group, clean the project, and hit launch things work fine. In the "Copy to Bundle" phase each image is then listed individually, whereas when I had a folder reference, the whole folder was listed.
对我来说,只有在项目中有文件夹引用时才会出现问题。当我删除文件夹引用并将文件夹添加为一个组时,清理项目,然后点击启动一切正常。在“复制到捆绑包”阶段,每个图像都会单独列出,而当我有文件夹引用时,会列出整个文件夹。
This took me a really long time to figure out. It was quite frustrating, but I'm glad I have a workaround until the bug is fixed.
这花了我很长时间才弄明白。这很令人沮丧,但我很高兴在错误修复之前我有一个解决方法。
回答by Luda
Restarting the simulator worked for me
重新启动模拟器对我有用
回答by Cfr
Ensure you are starting a proper scheme.
确保你开始了一个正确的计划。
I. e. when using CocoaPods, running Pods scheme would not start emulator.
IE。使用 CocoaPods 时,运行 Pods 方案不会启动模拟器。
回答by Abdul
I had the same problem after swapping the mouse for a new one. restarting my iMac resolved the issue.
将鼠标更换为新鼠标后,我遇到了同样的问题。重新启动我的 iMac 解决了这个问题。
回答by Egil Rausner
I just upgraded to Xcode 4.3.2 and had the same issue with new projects. After poking around and comparing projects, I found out that new projects were set to the LLDB dbugger and the projects that worked were using GDB.
我刚刚升级到 Xcode 4.3.2 并且在新项目中遇到了同样的问题。在摸索和比较项目之后,我发现新项目被设置为 LLDB dbugger,而有效的项目正在使用 GDB。
After changing the debugger for the new project to GDB, it worked. I am yet to research what the differences are, but at least I can now run my new projects.
将新项目的调试器更改为 GDB 后,它起作用了。我还没有研究差异是什么,但至少我现在可以运行我的新项目。
回答by mruffa
Hey, update Xcode to 4.0.2. Problem solved :)
嘿,将 Xcode 更新到 4.0.2。问题解决了 :)
回答by nonamelive
I had the same problem, I tried every solution here, but no works. Finally, after I rebooted my computer, the problem was gone.
我遇到了同样的问题,我在这里尝试了所有解决方案,但没有奏效。最后,在我重新启动计算机后,问题消失了。