Avaudioplayer Osstatus Error
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site osstatus error 29759 About Us Learn more about Stack Overflow the company Business Learn more about avaudioplayer the operation couldn t be completed hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss error domain=nsosstatuserrordomain code=2003334207 "(null)" Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up OSStatus error 2003334207
Osstatus 2003334207
when using AVAudioPlayer up vote 3 down vote favorite 1 I am trying to play an MP3 file (works when played via VLC/iTunes) when a button is pressed. Here is my code: var audioPlayer: AVAudioPlayer! @IBAction func playEpisode(sender: AnyObject) { println("now playing") let indexPath = NSIndexPath(forRow: sender.tag, inSection: 0) let data: CDEpisode = fetchedResultsController.objectAtIndexPath(indexPath!) as! CDEpisode var err: NSError? let url = NSURL(string: data.localPath) println("The nsosstatuserrordomain error codes url is \(url)") audioPlayer = AVAudioPlayer(contentsOfURL: url, error: &err) if audioPlayer == nil { if let e = err { println(e.localizedDescription) } } audioPlayer.delegate = self audioPlayer.prepareToPlay() audioPlayer.play() } Here is the log: now playing The url is Optional(file:///var/mobile/Containers/Data/Application/4747A71E-A63F-4EFC-B2DF-8B361361080B/Documents/serial-s01-e12.mp3) The operation couldn’t be completed. (OSStatus error 2003334207.) fatal error: unexpectedly found nil while unwrapping an Optional value The EXC_BREAKPOINT happens on the audioPlayer.delegate = self. Other threads on StackoOverflow do not help. Any ideas? Thanks Edit: I have tried passing a localURL to contentsOfURL (instead of a CDEpisode object) and it still fails. ios swift avaudioplayer share|improve this question edited Mar 17 '15 at 11:22 asked Mar 16 '15 at 23:13 user2747220 165318 I looked up the Error code, and 2003334207 gives the localizedDescription "The Operation Couldn't be Completed". In my app I was trying to access a file that didn't exist. –Unome Jan 19 at 20:20 add a comment| 3 Answers 3 active oldest votes up vote 2 down vote accepted It looks like your trying to unwrap a variable that has a nil value. You should safely unwrap your variables to prevent this. if let data: CDEpisode = fetchedResultsController.objectAtIn
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies osstatus error 1954115647 of this site About Us Learn more about Stack Overflow the company
Error Domain=nsosstatuserrordomain Code=1954115647 "(null)"
Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users
Error Domain=nsosstatuserrordomain Code=1685348671 "(null)"
Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a http://stackoverflow.com/questions/29088594/osstatus-error-2003334207-when-using-avaudioplayer minute: Sign up AVAudioPlayer gives error on mp3 files up vote 0 down vote favorite I am Downloading a .mp3 file and storing it in my document folder Using AVAudioPlayer I am playing the audio file. I am getting the file path into NSData (audioData) and linking it to AudioPlayer NSError* error = nil; self.audioPlayer = [[AVAudioPlayer alloc]initWithData:audioData error:&error]; if (error) { http://stackoverflow.com/questions/23904200/avaudioplayer-gives-error-on-mp3-files NSLog(@"Error with initWithData: %@", [error localizedDescription]); } which prints "The operation couldn’t be completed. (OSStatus error 2003334207.)" I wanted to check if the downloaded file is a valid file or not, I have played it with VLC and it plays well. If I log the NSData, it is.. Printing description of audioData: <00000018 66747970 33677034 00000000 69736f6d 33677034 00000275 6d6f6f76 0000006c 6d766864 00000000 538580d9 538580d9 000003e8 00000884 00010000 01000000 00000000 00000000 00010000 00000000 00000000 00000000 00010000 00000000 00000000 00000000 40000000 00000000 00000000 00000000 00000000 00000000 00000000 00000002 00000201 7472616b 0000005c 746b6864 00000007 538580d9 538580d9 00000001 00000000 00000884 00000000 00000000 00000000 01000000 00010000 00000000 00000000 00000000 00010000 00000000 00000000 00000000 40000000 00000000 00000000 0000019d 6d646961 00000020 6d646864 00000000 538580d9 538580d9 00001f40 00004420 00000000 0000002c 68646c72 00000000 00000000 736f756e 00000000 00000000 00000000 536f756e 6448616e 646c6500 00000149 6d696e66 00000010 736d6864 00000000 00000000 00000024 64696e66 0000001c 64726566 00000000 00000001 0000000c 75726c20 00000001 0000010d 7374626c 00000045 73747364 00000000 00000001 00000035 73616d72 00000000 00000001 00000000 00000000 00010010 00000000 1f400000 00000011 64616d72 20202000 0083ff00 01000000 20737474 73000000 00000000 02000000 01000000 a0000000 6c000000 a0000000 14737473 7a000000 00000000 20000000 6d000000 34737473 630
click one of these buttons! Sign In Register Categories What's New? Activity Best Of... AVAudioPlayer Error?! http://iphonedevsdk.com/forum/iphone-sdk-development/93870-avaudioplayer-error.html adamwaite Posts: 30Registered Users November 2011 edited November 2011 in iOS SDK Development Hello, I get an error trying to play a clip using AVAudioPlayer. The error gives me: The operation couldnt be completed. (OSStatus error -50.) I have no idea. The frameworks are all there etc... Is it something to do with the osstatus error URL? Here's my code: NSString *soundFilePath = [[NSBundle mainBundle] pathForResource:@grunt ofType:@aiff]; NSURL *fileURL = [NSURL URLWithString:soundFilePath]; NSError *error; audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:fileURL error:&error]; if(!error){ audioPlayer.delegate = self; [audioPlayer play]; }else{ NSLog(@Error loading clip: %@", [error localizedDescription]); } Thanks in advance! Post edited by adamwaite on November 2011My Apps:
dREaM Alarm
Shuffalarm
dREaM Alarm
Shuffalarm