I use AVAudioPlayer to play the recorded sound that is saved in the Iphone document directory. When I first record the sound and then play it works fine (the device is connected to the system, and the application runs through Xcode).
But when I stop running the application through Xcode and running the application again through Xcode, I get Error Error Domain=NSOSStatusErrorDomain Code=2003334207 "The operation couldn't be completed. (OSStatus error 2003334207.)"
File location: file:///var/mobile/Containers/Data/Application/410AB24E-5FB0-4401-AC59-3C03D676E951/Documents/26-06-2015--13:10:47.m4a
My code is:
fileLocation = @"file:///var/mobile/Containers/Data/Application/410AB24E-5FB0-4401-AC59-3C03D676E951/Documents/26-06-2015--13:10:47.m4a" NSURL *fileUrl = [NSURL URLWithString:fileLocation]; player = [[AVAudioPlayer alloc] initWithContentsOfURL:fileUrl error:&error]; [player setDelegate:self]; NSURL *fileUrl = [NSURL URLWithString:fileName]; player = [[AVAudioPlayer alloc] initWithContentsOfURL:fileUrl error:&error]; [player setDelegate:self];
I am using Xcode 6 and running the application on iOS 8
PS: I read so many documents related to this problem, as well as several questions in the statckoverflow file itself, but I did not find the answer.
ios xcode6 avaudioplayer
Atul khanduri
source share