I am seeing the following error in Xcode 7 build 6 debug console when running my app in the iOS 9 simulator:
2015-08-27 11:31:25.464 Reps[87841:2572333] 11:31:25
This works for me
var sound :SystemSoundID = 0
func Sound() {
let rightSound = NSURL(fileURLWithPath: NSBundle.mainBundle().pathForResource("sound", ofType: "wav")!)
AudioServicesCreateSystemSoundID(rightSound, &sound)
AudioServicesPlaySystemSound(self.sound);
}
I just encountered a similar problem with a different Error number while revising an old app. It was written in Objective C under iOS 4 and synthesises audio without using XIB or storyboards and it has successfully made the transition to AVFoundation under iOS9. Putting some final touches in place, I ran into this weird problem though it had a different error number. I found several reports of Error 177 and Error 181, mostly by Swift developers.
I got this report when I tapped a button to stop audio playback.
2016-06-15 14:50:16.370 SatGam[2598:148012] tapped Button 17
2016-06-15 14:50:16.384 SatGam[2598:148012] 14:50:16.383 ERROR: 181: timed out after 0.012s (1908 1909); mMajorChangePending=0
2016-06-15 14:50:16.387 SatGam[2598:148012] launch with full gradient background
2016-06-15 14:50:16.387 SatGam[2598:148012] load FamilyView
Button 17 is meant to turn off audio before switching to another ViewController which it did successfully before it went into debug. The following commented case statement describes what it was doing at the time
case 17: // stop button
[synthLock lock]; // lock synthLock
[synth stopAllNotes]; // change synth i.e. mute sound
[synthLock unlock]; // unlock synthLock
[timer invalidate]; // kill the timer
timer = nil; // and then
[timer release]; // release it
// [lastEventChangeTime release]; // this was switched off
[player release]; // release old view controller
[synth release]; // release synth
[synthLock release]; // release synth lock
[self goToFamilyView]; // go to new view controller
break;
I hadn’t released lastEventChangeTime
, a property associated with a timer used for audio playback. So I removed comments from the start of that line, re-ran my project on the simulator, hit button 17 and the problem vanished.
Based on what you've told us, the problem you describe is likely to be related to something wrong when audio play back starts or stops. Post some code with a few comments that indicate what you’ve tried and I'm sure someone with more experience in Swift will be able to help. Best of luck.
Could you post more code for this?
I had the same error and it turned out I was being stupid. I already declared
var player = AVAudioPlayer()
outside of viewDidLoad.
I was then trying let player = try AVAudioPlayer....
I got rid of the let
as I had already declared the variable.. God knows what I was thinking putting let there! All seems to work fine now :)