Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Build a Simple iPhone App (iOS7) Testing and Debugging Device Installation

No sound w/ app when installed on iPhone

I just made my basic app on XCode, with mp3 sound as well. Thought when on my iPhone I get no sound. Thoughts? Yes...volume is turned up. :)

5 Answers

Patrick Donahue
Patrick Donahue
9,523 Points

Does it play in the simulator? Can you share the code?

Yep, plays in simulator. Here is some of the code, just followed what the lesson said:

  • (void)viewDidLoad { [super viewDidLoad];

    NSString *soundPath = [[NSBundle mainBundle] pathForResource:@"crystal_ball" ofType:@"mp3"]; NSURL *soundURL = [NSURL fileURLWithPath:soundPath]; AudioServicesCreateSystemSoundID(CFBridgingRetain(soundURL), &soundEffect);

    //then..
    

pragma mark - Prediction

  • (void) makePrediction { [self.backgroundImageView startAnimating]; self.predictionLabel.text = [self.crystalBall randomPrediction]; AudioServicesPlaySystemSound(soundEffect); [UIView animateWithDuration:5.0 animations:^{ self.predictionLabel.alpha = 1.0f; }];

}

Thanks!

Patrick Donahue
Patrick Donahue
9,523 Points

Hmm try this Stack Overflow answer. The selected answer has been updated in July 2013.

Patrick Donahue
Patrick Donahue
9,523 Points

I figured it out. I copy pasted your code into my Crystal Ball project to make sure it was all the same and it is. So I put it on my device and it didn't work. So I searched and found that there is a second audio control in the settings app under sounds. Turn that up and it should work. It worked for me. Stack Overflow

Boom! That was it. Thanks Patrick! K