Audio question for sprite kit

Discussion in 'iOS Programming' started by mstartea11, Jan 25, 2015.

  1. mstartea11 macrumors newbie

    Joined:
    Jan 25, 2015
    #1
    I'm currently making a little game, and I am having an issue with sound.

    I've tried converting the file "pew.mp3" to pew.aif and pew.caf without much luck.

    I have dragged it into the "support" section of the game (the same way i've add hundreds of images) and the sound effect does not work.
    Code:
      [self runAction:[SKAction playSoundFileNamed:@"pew.aif" waitForCompletion:NO]];
    
    is what I am using. When I use the .aif or .caf the error i get is "'NSInvalidArgumentException', reason: 'Resource pew.aif cannot be found in the main bundle'"

    I guess my question is do you have to use .caf or .aif? Or can you just use .mp3?

    Any ideas?
     
  2. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #2
    The first step is to confirm that the file is really being added to the bundle. Make sure it's really there, in the right place, with the right name.

    Confirming its presence in the Xcode project is only half an answer. If it's in the project but not in the built bundle, then that's the problem that needs solving, not the file's sound format.
     

Share This Page