• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1070
  • Last Modified:

unable to play audio file from document its terminates due to error

when ever i try to play audio file its terminates due to error ?



2010-08-27 09:13:40.466 VoiceRecorder[3127:207] Failed with reason: The operation couldn’t be completed. (OSStatus error -43.)

what does it mean


i m physically storing file in Iphone Document folder and copying its name my database

so when ever i play it from data base it correctly get file path

and file name from document n database


 /Users/USERNAME/Library/Application Support/iPhone Simulator/4.0.1/Applications/6221AC9F-39A2-4441-BBB8-0E4C6BF5012C/Documents/27Aug10_09_12_34.aif
Current language:  auto; currently objective-c
2010-08-27 09:13:17.050 VoiceRecorder[3127:207] 27Aug10_09_12_34.aif

need an urgent reply

here is my code



-(IBAction)playevent{
	
	VoiceRecorderAppDelegate *appDelegate=(VoiceRecorderAppDelegate*)[[UIApplication sharedApplication]delegate];
	
	NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
	NSString *documentsDir = [paths objectAtIndex:0];
	NSString *fullpath = [documentsDir stringByAppendingPathComponent:appDelegate.filenamefrompath];
	
	
	
	
	NSFileManager *fileManager = [NSFileManager defaultManager];
	
	// Check if the database has already been created in the users filesystem
	BOOL success = [fileManager fileExistsAtPath:fullpath];
	
	// If the database already exists then return without doing anything
	if(success) { NSLog(@"Yes exists"); }else{ NSLog(@"no"); }
	
	
	//return [documentsDir stringByAppendingPathComponent:appDelegate.filenamefrompath];
	NSError* err;
	NSLog(@"%@",fullpath);
	player = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:fullpath] error:&err];

	
	//NSString *filePath = [[NSBundle mainBundle] pathForResource:appDelegate.filenamefrompath ofType:@"aif"];
//	NSURL *fileURL = [[NSURL alloc] initFileURLWithPath:filePath];
//	player = [[AVAudioPlayer alloc] initWithContentsOfURL:fileURL error:nil];

	
	NSLog(@"%@",appDelegate.filenamefrompath);
	player.delegate = self;
	
	if( err ){
		//bail!
		NSLog(@"Failed with reason: %@", [err localizedDescription]);
	}
	
	
	[player play];


}

Open in new window

0
IamnotanExpert007
Asked:
IamnotanExpert007
  • 3
1 Solution
 
robertcernyCommented:
OSStatus error -43 means File Not Found
0
 
IamnotanExpert007Author Commented:
But I m get each n every thing right

loging each step i dont know why i m getting this error


will you please examine my code given above
0
 
IamnotanExpert007Author Commented:
Well Problem solved i m using date Function to give file name like hh-MM-ss so when ever i start recording its name like 15_24_20
when i save its name changed with respect to time 15_24_56 thats why it keep saying file not found


thanks
0
 
IamnotanExpert007Author Commented:
Problem Solved
0

Featured Post

[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now