NSMutableArray - Sound

Discussion in 'iOS Programming' started by scburns123, Feb 18, 2009.

  1. macrumors newbie

    Nov 13, 2006
    I am trying to create an app that makes 3 buttons with 3 different sounds (less than 30 seconds). I can't seem to figure out the code. I am new to the iPhone SDK world (and programming world for that matter). I have tried to view the C tutorials in relation to Objective-C tutorials, but don't seem to be making any headwind.

    So please don't flame me for my lack of knowledge!!!

    So this is a snippet of the code I have so far. Where am I going wrong with it?


    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

    NSMutableArray *myArray;
    myArray = [[NSMutableArray alloc] init];
    myArray = [[[NSMutableArray alloc] initWithObjects:mad:"test.mp4", @"testb.mp4", @"testc.mp4", nil] retain];
    [myArray release];
    [pool release];

    I am guessing that I am missing a Loop portion (in reference to Playing button sounds...help).

    Thanks anyone and everyone for your help in advance!
  2. macrumors 6502a

    Oct 29, 2006
    Oh, no, not another ridiculous bodily sounds app, I hope. :rolleyes:

    Good news is if you get it right, you'll make more than the rest of us make in 5 years. People really loved 3rd grade apparently. :)

    Bad news (or good news if you like to learn!) is you've got a bit to learn still. I would suggest you go through the iPhone specific tutorials on http://developer.apple.com/iphone and pick up a book on Cocoa development in general (Kochan's book apparently is popular, and he's on this board quite a bit to answer questions)

    Then if you have specific questions on "why doesn't this work", "how do I do this", etc., I'm sure people will help.

    (As long as you promise it's not another stupid burping farting thing. :))

    Right now I'm guessing you're working from a template of a Mac (not iPhone) command line utility. And this function you posted is your main(). So that's the wrong track. You should read about how to build apps with a graphical/touch interface using UIKit (or at least learn about Mac GUI programming since it's quite similar.)

    Hope that helps.
  3. Moderator


    Staff Member

    Sep 2, 2004
    The Centennial State
    Just to let you know. You'll have a memory leak with the above code.

    P.S. In the future, please try to use the [ CODE ] [ /CODE ] tags. (Remove spaces or use the # tool in the toolbar.)

Share This Page