Cocos2d-Swift : Playing Sound Crashed

204 Views Asked by At

I used below code to play sound in Cocos2d-Swift, its crashed.

 OALSimpleAudio.sharedInstanceWithSources(32).playEffect("buttonUp_1.caf")

How to resolve crash in swift code(not ObjC) ?

Or

Is there any other way to play sound in cocos2d-swift using SimpleAudio engine ?

Crash LOG:

OAL Error: -[OALSimpleAudio initWithSources:]: : Could not create OpenAL device fatal error: unexpectedly found nil while unwrapping an Optional value

1

There are 1 best solutions below

0
On

For me this worked:

   OALSimpleAudio.sharedInstance().playEffect("buttonUp_1.caf")