简体   繁体   English

为什么 SKAction.playSoundFileNamed 会崩溃?

[英]Why is SKAction.playSoundFileNamed crashing?

NOTE:笔记:

It has been a few days and I still am having this problem.已经几天了,我仍然遇到这个问题。 One thing that would be helpful, is to know some troubleshooting ideas to try, so I can track down what is causing the crash.有帮助的一件事是了解一些故障排除的想法来尝试,这样我就可以找出导致崩溃的原因。 Any help that would lead me in the correct direction would be greatly appreciated.任何能引导我走向正确方向的帮助将不胜感激。


I'm running in Xcode 8.2.1 on the simulator, as well as on several different iOS devices.我在模拟器和几个不同的 iOS 设备上运行 Xcode 8.2.1。 I get the same problem wherever I go.无论我走到哪里,我都会遇到同样的问题。

I have imported a small mp3 file into my spritekit project, called "cat_meow_1.mp3"我已经将一个小的 mp3 文件导入到我的 spritekit 项目中,名为“cat_meow_1.mp3”

when I select the file, in Xcode, and hit the play button, it plays normally.当我在 Xcode 中选择文件并点击播放按钮时,它会正常播放。 Incidentally I have tried with various different files in various formats, with the same results.顺便说一句,我尝试过使用各种格式的各种不同文件,结果相同。

in my code, which complies okay, when I get to the line:在我的代码中,当我到达该行时:

run(SKAction.playSoundFileNamed("cat_meow_1.mp3", waitForCompletion: true))

I get a crash with the error message,我因错误消息而崩溃,

error: use of undeclared identifier '$r0'错误:使用未声明的标识符“$r0”

Any suggestions how to debug this problem, or to figure out what I did wrong?有什么建议可以调试这个问题,或者找出我做错了什么?

I also tried to preload the sound and make a class property, but got the same error.我也尝试预加载声音并创建一个类属性,但得到了同样的错误。 Here's what it looks like:这是它的样子:

错误页面截图 包含文件的页面屏幕截图,显示它位于资源包中

UPDATE:更新:

After reinstalling Xcode, I still have the same problem.重新安装Xcode后,我仍然遇到同样的问题。 With certain files, I get white noise, while with other ones I get the error here.对于某些文件,我会收到白噪声,而对于其他文件,我会在此处收到错误消息。 What else could be wrong with my system to cause this problem?我的系统还有什么问题会导致这个问题?

UPDATE 2:更新 2:

tried my experiment on a separate mac, and basically it worked just fine.在单独的 mac 上尝试了我的实验,基本上它工作得很好。 I reinstalled my OS, and got the same problem, with a little more of an error message this time, which reads:我重新安装了我的操作系统,并遇到了同样的问题,这次有更多的错误消息,内容如下:

2017-01-18 18:10:09.397565 sound attempt 2[533:124220] [DYMTLInitPlatform] platform initialization successful 2017-01-18 18:10:11.058506 sound attempt 2[533:124042] Metal GPU Frame Capture Enabled 2017-01-18 18:10:11.059146 sound attempt 2[533:124042] Metal API Validation Enabled error: use of undeclared identifier '$r0' warning: could not load any Objective-C class information. This will significantly reduce the quality of type information available.

After a couple days, I finally gave in and used Clean My Mac 3 to completely remove Xcode, as well as any and all related files... I must not have caught everything when previously I uninstalled/reinstalled it, because this time, there were none of my custom settings at all when I ran the reinstalled app.几天后,我终于屈服并使用Clean My Mac 3彻底删除了 Xcode,以及任何和所有相关文件......之前我卸载/重新安装它时,我一定没有抓住一切,因为这一次,有当我运行重新安装的应用程序时,根本就没有我的自定义设置。

It works now, thankfully, and I can get back to work.谢天谢地,它现在可以工作了,我可以回去工作了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM