Advertise here

Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

swift spritekit .playSoundFileNamed crash

LegalizeItLegalizeIt Posts: 1New Users Noob
Hey everyone, I'm a c++ programmer and I'm new to swift sprite kit and iOS platform. I have a strange issue and i can't figure it out bcz I'm not familiar to Xcode's debugging. So here is my problem;

When i add play sound action to code (even to sprite kits default project as you see below ) I have a crash. I tried to
add it directly to touchesBegan like self.runAction(SKAction.playSoundFileNamed("bounce.wav", waitForCompletion: false)) too but this time it crashes when i click. I think it crashes when its declaring action. It says "libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)". Any suggestions?

import SpriteKit

class GameScene: SKScene {

var bouncesound = SKAction()

override func didMoveToView(view: SKView) {

bouncesound = SKAction.playSoundFileNamed("bounce.wav", waitForCompletion: false)

/* Setup your scene here */
let myLabel = SKLabelNode(fontNamed:"Chalkduster")
myLabel.text = "Hello, World!";
myLabel.fontSize = 65;
myLabel.position = CGPoint(x:CGRectGetMidX(self.frame), y:CGRectGetMidY(self.frame));


override func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent) {
/* Called when a touch begins */

for touch in (touches as! Set<UITouch>) {
let location = touch.locationInNode(self)

let sprite = SKSpriteNode(imageNamed:"Spaceship")

sprite.xScale = 0.5
sprite.yScale = 0.5
sprite.position = location

let action = SKAction.rotateByAngle(CGFloat(M_PI), duration:1)





override func update(currentTime: CFTimeInterval) {
/* Called before each frame is rendered */
Sign In or Register to comment.