应用程序在模拟器和测试设备上运行,但从应用程序商店下载后崩溃

发布于 2024-12-11 04:35:15 字数 1990 浏览 0 评论 0原文

我有一个应用程序,我刚刚更新并上传了它,在模拟器中以及在设备上测试时一切都运行良好。然而,当从appstor 下载时,它会在特定情况下崩溃。

我在这里开始了一个寻找问题的线程: 我的应用程序下载后崩溃来自appstore现在我需要解决这个问题

问题似乎如下:

10  CoreFoundation  0x3614f4c4 +[NSException raise:format:] + 28
11  Foundation      0x34514e28 -[NSURL(NSURL) initFileURLWithPath:isDirectory:] + 68

但是,挑战是我在程序中没有使用“initFileURLWithPath”,所以我不知道要寻找什么。我正在查看所有的初始化等,但没有发现任何看起来有问题的东西。

我对之前版本的改变是:

  • 新的背景图形,通过 xcode 添加了
  • 一个新的快速游戏功能,其中包括一个新按钮和一些新功能。我已经全部检查过了。

这里真正的问题是如何找到它,因为只有从应用程序商店下载时才会出现问题。顺便说一句,我知道当我在测验应用程序中按下“错误”按钮时它会崩溃。这很好,但我仍然不知道出了什么问题。

任何人都可以给我一些提示,如何继续解决这个奇怪的问题,并解释为什么某些东西在测试设备上完美运行,但在应用程序商店中却不起作用?顺便说一句,我应该如何测试这个?

预先感谢:-)

================================================ ========================

我想我已经找到问题了。当崩溃发生时,我检查了该模块并发现了一些有趣的东西。然后我在现场设备上测试,打开声音,问题就消失了。打开声音导致崩溃。

代码是:

if (sound == YES) {
    //==== PLAY THE LOOSING SOUND ====//
    // Form a URL to the sound file, which in init using the Path
    NSBundle *mainBundle = [NSBundle mainBundle];
    NSString *filePath = [mainBundle pathForResource:@"wrong2" ofType:@"wav"];
    NSURL *aFileURL = [NSURL fileURLWithPath:filePath isDirectory:NO];

    // Create a sound ID, 
    SystemSoundID myID;
    // Register the sound
    AudioServicesCreateSystemSoundID((CFURLRef)aFileURL, &myID) ;
    // Play the sound!
    AudioServicesPlaySystemSound(myID);
}

代码行是:

NSString *filePath = [mainBundle pathForResource:@"wrong2" ofType:@"wav"];

我不明白的是,“wrong2.wav”存在于资源文件夹中,但仍然是一个问题?

=================================================== ==

我刚刚发现“wrong2.wav”文件没有出现在正确的目录中,但在 xcode4 中看起来仍然是正确的。我已将该文件的新版本复制到正确的目录,删除了 xcode 中的文件,然后再次将其重新复制到 xcode 中。

只是不知道如何测试。

=====问题解决======= 问题是我从另一个目录而不是应用程序所在的目录导入了 wav 文件。

I hav an app that i just did an update on and uploaded, everything worked great in the simulator and when testing on the device. However, when downloading from appstor it crashes in a specific situation.

I started a thread on finding the problem here: My app crash after downloading it from appstore now i need to solve this problem

The problem seems to be the following:

10  CoreFoundation  0x3614f4c4 +[NSException raise:format:] + 28
11  Foundation      0x34514e28 -[NSURL(NSURL) initFileURLWithPath:isDirectory:] + 68

However, the challenge is that i do not use "initFileURLWithPath" in my program so i do not know what to look for. I am looking at all the inits etc. but do not find anything that looks as a problem.

The things i changed from the previous version is:

  • New background graphics, added via xcode
  • A new quick game feature, which consist of a new button and a few new functions. I have checked them all.

The real issue here is how to find this as it is only when downloading from appstore it is a problem. BTW, i know that it crashes when i press the "wrong" button in my quizapp. That is good but i can still not figure out what is wrong.

Anyone that can give me some hints how to proceed with this weird problem and also explain how come something works perfectly on test device but not from appstore? BTW, how should i test this?

Thanks in advance :-)

====================================================================

I think i have found the problem. As i new when the crash occurred i checked that module and found something interesting. I then tested, on a live device, turning of the sound and the problem was gone. Turning on the sound resulted in a crash.

The code is:

if (sound == YES) {
    //==== PLAY THE LOOSING SOUND ====//
    // Form a URL to the sound file, which in init using the Path
    NSBundle *mainBundle = [NSBundle mainBundle];
    NSString *filePath = [mainBundle pathForResource:@"wrong2" ofType:@"wav"];
    NSURL *aFileURL = [NSURL fileURLWithPath:filePath isDirectory:NO];

    // Create a sound ID, 
    SystemSoundID myID;
    // Register the sound
    AudioServicesCreateSystemSoundID((CFURLRef)aFileURL, &myID) ;
    // Play the sound!
    AudioServicesPlaySystemSound(myID);
}

The code line is:

NSString *filePath = [mainBundle pathForResource:@"wrong2" ofType:@"wav"];

What i do not understand is that the "wrong2.wav" exists in the resource folder but is still a problem?

====================================================

I just found that the "wrong2.wav" file was not present in the correct directory but still looked like it was correct in xcode4. I have copied a new version of the file to the correct directory, deleted the file in xcode and recopied it into xcode again.

Just do not know how to test.

=====Problem solved=======
The problem was that i had imported the wav file from another directory rather than the one where the app was present in.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

沫雨熙 2024-12-18 04:35:16

我可以告诉你,我在图形和未初始化值方面也有类似的经历。最后我发现在发布模式下编译,但是使用我的开发证书可以让我在我的设备上重现问题,并让我调试它。我很快就发现了错误。看似不同的库或优化用于发布模式编译。我知道要养成只在发布模式下编译时才进行测试的习惯,然后再提交到应用程序商店。

但是,我不知道针对您的具体错误有何建议。

I can tell you I had similar experiences with graphics and uninitialised values. In the end I found that compiling in release mode, but using my development certificate allowed me to reproduce the problem on my device, and let me debug it. I soon found the error. Seemingly different libraries or optimisations are used for release mode compilation. I know make a habit of testing only when compiled under release mode, before submitting to the appstore.

I don't know what to suggest for your specific error however.

夜深人未静 2024-12-18 04:35:15

您可能没有直接调用 [initFileURLWithPath:] 但您是否使用其他方法调用在应用程序中的任何位置加载文件可能会调用该方法(例如 [UIImage imageNamed:])?如果是这种情况,请浏览您编译的 Release IPA(右键单击,浏览包)并验证您认为应该存在的所有文件实际上是否存在。

如果您要将文件下载到要打开的设备上,请验证它们是否确实是从服务器下载的(也许 sim 和您的设备正在缓存某些内容)。


要记住的一件事是 Xcode 中的文件夹/组不一定反映硬盘驱动器上项目的文件夹结构。在 Xcode 中将项目复制到组中不会将其复制到该文件夹​​。

另外,在编译过程中,整个文件夹层次结构会被展平,因此在 MainBundle 中,所有内容都位于根目录中(没有文件夹),因此在开发时请记住这一点。

至于测试,您是否尝试过从设备中完全删除该应用程序(并重置模拟器)并重新添加它?部署时,Xcode 喜欢走捷径并缓存很多东西,因此时不时地清理一下是一件好事。

You may not be directly calling [initFileURLWithPath:] but are you loading files anywhere in your app using other method calls might be calling that ([UIImage imageNamed:] for example)? If that is the case, explore your compiled Release IPA (Right-Click, Explore package) and verify all the files you think should be there actually are.

If you are downloading files onto the device to be opened, verify that they are actually being downloaded from the server (perhaps the sim & your device are caching something).


One thing to keep in mind is that folders/groups in Xcode doesn't necessary reflect the folder structure of the project on your hard drive. Copy a an item into a Group in Xcode doesn't copy it to that folder.

Also, during the compile the entire folder hierarchy gets flattened, so in the MainBundle everything in the root (no folders), so keep that in mind when developing.

As for testing, have you tried completely removing the app from your device (and resetting the simulator) and re-adding it? When deploying, Xcode likes to take shortcuts and caches a lot of things so cleaning it out every now and then is a good thing.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文