xcode iPhone 应用程序未在模拟器上启动,没有错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9547230/
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
iPhone app not starting on simulator, no errors
提问by Richard Williams
I'm having a problem where my (simple) iOS app builds fine, says running but on the simulator I just get a blank screen. In xCode, it still says "Running XXXX on iPhone 5.0 Simulator" but also give a "Thread 1: signal SIGABRT";
我遇到了一个问题,我的(简单的)iOS 应用程序构建得很好,说正在运行,但在模拟器上我只看到一个空白屏幕。在 xCode 中,它仍然显示“在 iPhone 5.0 模拟器上运行 XXXX”但也给出了“线程 1:信号 SIGABRT”;
There are no readable errors in the bottom window, just:
底部窗口中没有可读错误,只是:
argc = (int) 1
argc = (char **) 0xbffff578
argc = (int) 1
argc = (char **) 0xbffff578
It has been absolutely fine until now. I had the problem after trying to swap out a few images and their @2x versions for ones that I'd slightly tweaked.
到目前为止,它一直很好。在尝试将一些图像及其 @2x 版本换成我稍微调整过的图像后,我遇到了问题。
I've done a clean and I have cleaned the build folder. I have also emptied the DerivedData folder and tried rebooting. I've tried to add breakpoints in my AppDelegate in the didFinishLaunchingWithOptions method, but it seems to never reach them.
我已经完成了清理工作,并且已经清理了构建文件夹。我还清空了 DerivedData 文件夹并尝试重新启动。我试图在我的 AppDelegate 中的 didFinishLaunchingWithOptions 方法中添加断点,但它似乎永远不会到达它们。
Pretty much run out of things I can think of to try.
我能想到的尝试几乎用完了。
Debug Navigator:
调试导航器:
Edit:
编辑:
When I comment out:
当我注释掉时:
@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) UIWindow *window;
from @interface AppDelegate
来自@interface AppDelegate
and comment out
并注释掉
@synthesize window = _window;
@合成窗口= _window;
from @implementation AppDelegate, it loads fine albeit with a blank screen because I guess the window is not loading.
来自@implementation AppDelegate,它加载得很好,尽管是空白屏幕,因为我猜窗口没有加载。
回答by Ashar
This might help you as it helped me
这可能对你有帮助,因为它帮助了我
Xcode->Product->Edit Scheme
here you can see "Executables" set here "yourappname.app" and it will start working quite fine
在这里你可以看到“可执行文件”设置在这里“yourappname.app”,它会开始工作得很好
回答by dloomb
Extending on Ashar's answer (as it worked for me).
扩展 Ashar 的答案(因为它对我有用)。
First click into "Edit Scheme", pictured below.
首先点击进入“Edit Scheme”,如下图。
Then in the popup that appears, click Run [Your App Name] and set the Executable dropdown menu to [Your App Name].app, pictured below.
然后在出现的弹出窗口中,单击 Run [Your App Name] 并将 Executable 下拉菜单设置为 [Your App Name].app,如下图所示。
This fixed the issue for me. Hope it helps.
这为我解决了这个问题。希望能帮助到你。
回答by FrediWeber
Have you already reset the Simulator?
您是否已经重置了模拟器?
回答by Antonio MG
Why don't you make an empty project, check if it runs, and then copy your classes in your new project? It will probably work
你为什么不创建一个空项目,检查它是否运行,然后在你的新项目中复制你的类?它可能会工作
回答by Franci Penov
Line 10 is throwing an exception. It would help a lot if you can figure out what is the specific exception, which you might be able to do by examining the state at line 9.
第 10 行抛出异常。如果您能弄清楚具体的异常是什么,这将很有帮助,您可以通过检查第 9 行的状态来做到这一点。
However, seeing how early in the app startup this is happening, my guess would be that you have messed up your app resources - either you have changed the name of a required resource, or the resource is in the wrong format and the runtime doesn't know how to deal with it.
但是,看到这种情况发生在应用程序启动的早期阶段,我的猜测是您弄乱了您的应用程序资源 - 要么您更改了所需资源的名称,要么资源格式错误并且运行时没有“不知道怎么处理。
Since you mentioned you've modified some image, I'd venture to guess that the app you used to tweak it produced a different format of the image. I would try replacing the images back with the original version you know used to work, and then start swapping them with the modified one by one, until you isolated one that breaks it. At that point you can examine the difference and figure out what's wrong with it.
既然你提到你修改了一些图像,我敢猜测你用来调整它的应用程序产生了不同格式的图像。我会尝试用您知道曾经可以使用的原始版本替换图像,然后开始将它们与修改后的图像一一交换,直到您分离出一个破坏它的图像。那时,您可以检查差异并找出问题所在。
回答by Novarg
Maybe I'll say something stupid(probably), but according to you it happened after you replaced the images. Did you also delete them and use other names for images? I think that the problem might be that you used some image that is now missing.
也许我会说一些愚蠢的(可能),但据你说它发生在你更换图像之后。您是否也删除了它们并为图像使用了其他名称?我认为问题可能是您使用了一些现在丢失的图像。
It was just a random guess
这只是一个随机猜测
回答by William Jockusch
I ran into this one after upgrading to XCode 7.2. In my case, the solution was to manually delete the build folder and restart my computer. I'm sure this is not a universal solution, so YYMV.
升级到 XCode 7.2 后,我遇到了这个问题。就我而言,解决方案是手动删除构建文件夹并重新启动我的计算机。我确定这不是一个通用的解决方案,所以 YYMV。