Possible Duplicate:
AudioQueueStart fail -12985
This was asked once before but I tried implementing one of the suggested answers (nothing was accepted) and didn't get any luck.
I should mention that I've set the proper background mode in the pList.
Basically, I'm trying to play a sound in didEnterRegion. Here's my code:
- (void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region
{
NSLog(@"MapViewController - didEnterRegion");
NSLog(@"MVC - didEnterRegion - region.radius = %f", region.radius);
// code to get the url (removed for simplicity)
AVAudioSession *audioSession = [AVAudioSession sharedInstance];
[audioSession setCategory:AVAudioSessionCategoryPlayback error:nil];
[audioSession setActive: YES error: nil];
[[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
self.regionPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:&error];
NSLog(@"self.regionPlayer.url = %@",self.regionPlayer.url);
[self.regionPlayer play];
}
The url is ok since it'll play in the foreground. It also seems ok in the console log:
Sep 12 22:33:47 unknown MLTM[4995] <Warning>: MVC - didEnterRegion - region.radius = 250.000000
Sep 12 22:33:47 unknown MLTM[4995] <Warning>: url = file://localhost/var/mobile/Applications/EFD6A583-5685-4D7C-BF8E-C8CFEA9E0D03/MLTM.app/party%20mix%207.caf
Sep 12 22:33:47 unknown MLTM[4995] <Warning>: self.regionPlayer.url = file://localhost/var/mobile/Applications/EFD6A583-5685-4D7C-BF8E-C8CFEA9E0D03/MLTM.app/party%20mix%207.caf
Sep 12 22:33:48 unknown Console[4179] <Notice>: TestFlight: Team Token is recognized
Sep 12 22:33:48 unknown mediaserverd[44] <Error>: 22:33:48.087 <AudioQueueServer> AudioQueue: Error -12985 from AudioSessionSetClientPlayState(4995)
I'm assuming that that last line is the error given when trying to play audio.
Any ideas?