我的应用通过XCode报告了一些崩溃。源是以下函数:
class SoundManager
{
static var players=[AVAudioPlayer]()
class func stop(id: String)
{
for i in (0..<players.count).reverse()
{
if players[i].url?.lastPathComponent==id+".m4a"
{
players[i].stop()
players.removeAtIndex(i)
}
}
}
日志的最后部分可能不同:
0 (null) in objc_retain ()
1 (null) in static SoundManager.stop(String) -> ()
0 (null) in objc_msgSend ()
1 (null) in static SoundManager.stop(String) -> () ()
0 (null) in objc_class::nameForLogging() ()
1 (null) in cache_t::bad_cache(objc_object*, objc_selector*, objc_class*) ()
2 (null) in cache_t::bad_cache(objc_object*, objc_selector*, objc_class*) ()
3 (null) in objc_msgSend_corrupt_cache_error ()
4 (null) in static SoundManager.stop(String) -> () ()
0 (null) in OSAtomicCompareAndSwap32Barrier ()
1 (null) in realizeClass(objc_class*) ()
2 (null) in lookUpImpOrForward ()
3 (null) in _class_lookupMethodAndLoadCache3 ()
4 (null) in _objc_msgSend_uncached ()
5 (null) in static SoundManager.stop(String) -> () ()
0 (null) in lookUpImpOrForward ()
1 (null) in _class_lookupMethodAndLoadCache3 ()
2 (null) in _objc_msgSend_uncached ()
3 (null) in static SoundManager.stop(String) -> () ()
0 (null) in __exceptionPreprocess ()
1 (null) in objc_exception_throw ()
2 (null) in -[NSObject(NSObject) doesNotRecognizeSelector:] ()
3 (null) in ___forwarding___ ()
4 (null) in _CF_forwarding_prep_0 ()
5 (null) in static SoundManager.stop(String) -> () ()
0 (null) in -[AVAudioPlayer url] ()
1 (null) in static SoundManager.stop(String) -> ()
我只能获得一次并且没有成功再现。你能建议吗?