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 trialKeith Shadle
1,290 PointsNo 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
9,523 PointsDoes it play in the simulator? Can you share the code?
Keith Shadle
1,290 PointsYep, 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
9,523 PointsHmm try this Stack Overflow answer. The selected answer has been updated in July 2013.
Patrick Donahue
9,523 PointsI 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
Keith Shadle
1,290 PointsBoom! That was it. Thanks Patrick! K
Patrick Donahue
9,523 PointsNo problem!