Note that there are some explanatory texts on larger screens.

plurals
  1. POiOS, no recording sound in my iPad, in the simulator works fine
    primarykey
    data
    text
    <p>Hi I have a very strange problem in the simulator works perfect but when I charge the app to the iPad it does not work. Any idea?</p> <p>Here I create all the variables to make it work.</p> <pre><code>- (void)viewDidLoad { [super viewDidLoad]; NSArray *dirPaths; NSString *docsDir; dirPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); docsDir = [dirPaths objectAtIndex:0]; NSString *soundFilePath = [docsDir stringByAppendingPathComponent:@"sound.caf"]; NSURL *soundFileURL = [NSURL fileURLWithPath:soundFilePath]; NSDictionary *recordSettings = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt:AVAudioQualityMin], AVEncoderAudioQualityKey, [NSNumber numberWithInt:16], AVEncoderBitRateKey, [NSNumber numberWithInt: 2], AVNumberOfChannelsKey, [NSNumber numberWithFloat:44100.0], AVSampleRateKey, nil]; NSError *error = nil; audioRecorder = [[AVAudioRecorder alloc] initWithURL:soundFileURL settings:recordSettings error:&amp;error]; if (error) { NSLog(@"error: %@", [error localizedDescription]); } else { [audioRecorder prepareToRecord]; } } </code></pre> <p>I have some buttons for record, play and stop. So these are the codes for all of them.</p> <pre><code>-(void) recordAudio{ if (!audioRecorder.recording){ recordButton.enabled = NO; playButton.enabled = NO; saveButton.enabled = NO; stopButton.enabled = YES; [audioRecorder record]; } } -(void)stop{ recordButton.enabled = YES; playButton.enabled = YES; saveButton.enabled = YES; stopButton.enabled = NO; if (audioRecorder.recording){ [audioRecorder stop]; } else if (audioPlayer.playing){ [audioPlayer stop]; } } -(void) playAudio{ if (!audioRecorder.recording){ recordButton.enabled = NO; stopButton.enabled = YES; saveButton.enabled = NO; if (audioPlayer) audioPlayer=nil; NSError *error; audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:audioRecorder.url error:&amp;error]; audioPlayer.delegate = self; if (error) NSLog(@"Error: %@", [error localizedDescription]); else [audioPlayer play]; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload