[NSPathStore2 finishPlaying]:无法识别的选择器发送到实例
在运行我的程序时,它间歇性地崩溃:
*** 由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“*** -[NSPathStore2 finishPlaying]:无法识别的选择器发送到实例 0x286e20”
根据互联网上有关此功能的可用文档为零,因此我向杰出的 Stack Overflow 寻求帮助。
它似乎与使用 CocosDenshion 库加载/播放声音一致。我无法确定到底在哪里(如果是的话),因为当我踏过时它似乎从未发生过。
这是在安装了 3.1.3 的第一代 iPod Touch 上进行测试时的结果。该程序在 iOS 3.2 及更高版本的设备上完美运行。
Intermittently while running my program it crashes out with:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSPathStore2 finishedPlaying]: unrecognized selector sent to instance 0x286e20'
According to the internet there is zero documentation available on this function so I turn to you illustrious Stack Overflow.
It somewhat seems to coincide with the loading/playing of sounds using the CocosDenshion library. I can't be sure exactly where (if it is) because it never seems to happen while I am stepping through.
This is while testing on a 1st Gen iPod Touch with 3.1.3 installed. The program works flawlessly on devices with iOS 3.2 and above.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
很抱歉触及这个老话题,但我几周来一直在同一问题上苦苦挣扎,想分享我的经验。
我的一小部分用户遇到了格式的致命异常:
“[__NSCFNumber finishPlaying:]:无法识别的选择器发送到实例 0x1fa8ed40”
它似乎仅限于 iOS 6 设备,但由于我无法自己重现,所以无法调试。
我相信另外两个答案是错误的。两者都表明问题与 AVAudioPlayer 委托有关,这是 升级到 iPhone 3.0 操作系统后 AVAudioPlayer 完成播放崩溃的原因。但您会注意到,在这种情况下,finishedPlaying 方法被成功调用,并且异常与audioPlayerDidFinishPlaying: 方法相关。
在这个问题中,finishedPlaying: 选择器无法被识别,这意味着 AVAudioPlayer 本身不再有效,而不是它的委托。
意识到这一点后,我现在认为问题是 AVAudioPlayer 管理不正确的结果(我使用的是非 ARC 帮助器类:NTAVManager)。我已经更新了该类以使用 ARC,并希望这能解决我的问题,但正如我所说,我自己从未能够重现它,所以我在几周内无法确认。
Sorry to bump this old topic, but I have been struggling with the same issue for a couple weeks and wanted to share my experience.
A small percentage of my users are getting fatal exceptions of the format:
"[__NSCFNumber finishedPlaying:]: unrecognized selector sent to instance 0x1fa8ed40"
It seems to be limited to iOS 6 devices, but it has been impossible to debug since I can't reproduce it myself.
I believe the two other answers are barking up the wrong tree. Both suggest that the problem is related the AVAudioPlayer delegate, which is the problem discussed in The reason behind crash in AVAudioPlayer finishedPlaying after upgrade to iPhone 3.0 OS. But you'll notice that in this case the finishedPlaying method is successfully called and the exception there is related to the audioPlayerDidFinishPlaying: method.
In this problem it is the finishedPlaying: selector that is not recognized, meaning that it is the AVAudioPlayer itself who is no longer valid, rather that its delegate.
Upon this realization I now think that the problem is a result of the AVAudioPlayer being incorrectly managed (I was using a non-ARC helper class: NTAVManager). I've updated the class to use ARC and hope this will fix my problem, but as I said I have never been able to reproduce it myself so I won't be able to confirm for a few weeks.
对我有用的解决方案是:
AVAudioPlayer_Instance
是您的AVAudioPlayer
实例,应该在dealloc
之前调用它。The solution that worked for me is:
AVAudioPlayer_Instance
is your instance ofAVAudioPlayer
and this should be called beforedealloc
.看看这个: 升级后 AVAudioPlayer 完成播放崩溃的原因到 iPhone 3.0 OS
我怀疑对 AVAudioPlayer 委托的引用不再有效,并且消息正在发送到不同对象的地址(在您的情况下为 NSPathStore2 )。
Take a look at this: The reason behind crash in AVAudioPlayer finishedPlaying after upgrade to iPhone 3.0 OS
I suspect that the reference to the AVAudioPlayer delegate is no longer valid, and the message is being sent to the address of a different object (NSPathStore2 in your case).