无法在模拟器中运行应用 [英] Unable to run app in simulator

查看:411
本文介绍了无法在模拟器中运行应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

今天,当我尝试在模拟器中运行我的应用程序时,它只是告诉我

Today, when I try to run my app in simulator, it simply tells me

Unable to run app in Simulator
An error was encountered while running
(Domain = NSPOSIXErrorDomain, Code = 22)

错误对话框如下所示:

我尝试了很多事情:

  • 重新启动Xcode
  • 重新启动模拟器
  • 重新启动
  • 重置模拟器的内容和设置

以上均不可行.我查看了日志,发现这些记录与该问题有关

None of above works. And I looked into log, I found these are those records has something to do with this issue

2014/10/15 9:09:40.964 com.apple.CoreSimulator.CoreSimulatorService [979]:错误域= com.apple.CoreSimulator.SimError代码= 146无法在当前状态下查找:关机" UserInfo = 0x7f96c861d000 {NSLocalizedDescription =无法在当前状态下查找:关机}

2014/10/15 9:09:40.964 com.apple.CoreSimulator.CoreSimulatorService[979]: Error Domain=com.apple.CoreSimulator.SimError Code=146 "Unable to lookup in current state: Shutdown" UserInfo=0x7f96c861d000 {NSLocalizedDescription=Unable to lookup in current state: Shutdown}

2014/10/15 9:09:40.964 Xcode [1983]:[MT] iPhoneSimulator:无法连接到"com.apple.instruments.deviceservice.lockdown"; (错误域= com.apple.CoreSimulator.SimError代码= 146无法在当前状态下查找:关机" UserInfo = 0x7fcf6fc24190 {NSLocalizedDescription =无法在当前状态下查找:关机})

2014/10/15 9:09:40.964 Xcode[1983]: [MT] iPhoneSimulator: Unable to connect to "com.apple.instruments.deviceservice.lockdown" (Error Domain=com.apple.CoreSimulator.SimError Code=146 "Unable to lookup in current state: Shutdown" UserInfo=0x7fcf6fc24190 {NSLocalizedDescription=Unable to lookup in current state: Shutdown})

2014/10/15 9:09:40.980 com.apple.CoreSimulator.CoreSimulatorService [979]:错误域= com.apple.CoreSimulator.SimError代码= 146无法在当前状态下查找:关机" UserInfo = 0x7f96c861d000 {NSLocalizedDescription =无法在当前状态下查找:关机}

2014/10/15 9:09:40.980 com.apple.CoreSimulator.CoreSimulatorService[979]: Error Domain=com.apple.CoreSimulator.SimError Code=146 "Unable to lookup in current state: Shutdown" UserInfo=0x7f96c861d000 {NSLocalizedDescription=Unable to lookup in current state: Shutdown}

2014/10/15 9:09:42.351 launchd_sim [2047]:声明失败:13F34:libxpc.dylib + 29453 [75E30F22-514B-3A20-B82C-EDA43AF5C35C]:0x8d

2014/10/15 9:09:42.351 launchd_sim[2047]: assertion failed: 13F34: libxpc.dylib + 29453 [75E30F22-514B-3A20-B82C-EDA43AF5C35C]: 0x8d

2014/10/15 9:09:42.362 com.apple.CoreSimulator.CoreSimulatorService [979]:无法注册服务com.apple.coreservices.lsuseractivity.simulatorsupport:无法查找com.apple.coreservices.lsuseractivity.simulatorsupport :0x44e

2014/10/15 9:09:42.362 com.apple.CoreSimulator.CoreSimulatorService[979]: Could not register service com.apple.coreservices.lsuseractivity.simulatorsupport: Failed to lookup com.apple.coreservices.lsuseractivity.simulatorsupport: 0x44e

我还发现其他一些人在这里也遇到了同样的问题: https://gist.github.com/bdeshong/2dd90add09b7287a9a85

I also found some other people had the same issue here : https://gist.github.com/bdeshong/2dd90add09b7287a9a85

谷歌搜索后没有找到解决办法的运气.

No luck to find solution after Googling around.

这是我的环境信息

  • OSX 10.9.5
  • Xcode 6.0.1
  • iOS模拟器8.0(550.1)

有什么想法吗?

推荐答案

我找到了根本原因,并且也找到了解决方案.我要做的第一件事是确保它与Xcode有关,而不是与项目本身有关的问题.我试图创建一个新项目,并且效果很好.因此,我认为这是由我的项目中的某些原因引起的.

I found the root causes, and I also found the solution. First thing I've done is to ensure this has something to do with Xcode rather than a problem relative to the project itself. I tried to create a new project, and it works perfectly fine. So I assume that is caused by something in my project.

我实际上在项目中添加了一个resources参考文件夹.所以我认为这个问题与它有关.但是,即使我从项目中删除了该文件夹,问题仍然存在.最后,事实证明resources文件夹可以存在

I actually added a resources reference folder to my project. So I think the problem has something to do with it. However, even I removed the folder from project, the problem is still there. In the end, it turns out, the resources folder could live in

  • 内置应用程序文件夹
  • 模拟器中的应用文件夹

由于Xcode可以简单地复制和覆盖目标App Bundle文件夹,因此resources文件夹可能仍存在于App bundle文件夹中.因此,删除resources文件夹后,您需要

Since Xcode may simply copy and overwrite target App bundle folder, so the resources folder may still there in the App bundle folder. So after removing the resources folder, you need to

  • 确保构建已清理
  • 确保模拟器中的应用已删除

由于该应用程序无法正确启动的原因,这是因为它显示resources实际上是

And for the reason the App cannot be launched correctly, that's because it appears resources is actually a reserved folder name in the bundle structure. By adding a folder named resources into the bundle, somehow ruined the normal structure. To solve the problem, I changed the name from resources to app_data, or whatever it is, that all work.

这篇关于无法在模拟器中运行应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆