AVAudioRecorder fine on my iphone, but not the approver's
Hi Guys,
Sorry for this rather long post. The story is this,
I made an app that records audio in aac, built and ran it on iPhone OS 3.0 simulator, device 3.0 debug / release / ad-hoc and they are all working fine on my device and a few other devices owned by my friends.
So i went on to build the distribution device 3.0 and submitted it on itunesconnect. Today I got an email saying that my app got rejected because it cannot record and they sent me back a screenshot with a UIAlertView message saying "Operation could not be completed (OSStatus error 1718449215)".
The piece of code that would return such a UIAlertView is as below, where i am using sampleRate = 22050 and bitRate = 24000
- (NSError*) createAVAudioRecorder {
if ( audioRecorder != nil) {
NSLog(@"audioRecord was not nil");
[audioRecorder release];
audioRecorder = nil;
}
NSString *uid = [[UIDevice currentDevice] uniqueIdentifier];
NSString *destinationString = [[self documentsPath]
stringByAppendingPathComponent:[NSString
stringWithFormat:@"%@.aac",uid]];
NSURL *destinationURL = [NSURL fileURLWithPath: destinationString];
NSMutableDictionary *recordSettings = [[NSMutableDictionary alloc]
initWithCapacity:10];
NSNumber *formatObject = [NSNumber numberWithInt: kAudioFormatMPEG4AAC];
[recordSettings setObject:formatObject forKey: AVFormatIDKey];
float sampleRate = [samplingFreq floatValue];
NSLog(@"sampleRate = %d",sampleRate);
[recordSettings setObject: [NSNumber numberWithFloat:sampleRate]
forKey: AVSampleRateKey];
[recordSettings setObject: [NSNumber numberWithInt:1]
forKey:AVNumberOfChannelsKey];
int encoderBitrate = [bitRate intValue];
[recordSettings setObject:[NSNumber numberWithInt:encoderBitrate]
forKey:AVEncoderBitRateKey];
int bitDepthHint = 16;
[recordSettings setObject: [NSNumber numberWithInt:bitDepthHint]
forKey:AVEncoderBitDepthHintKey];
int encoderQuality = AVAudioQualityMax;
[recordSettings setObject: [NSNumber numberWithInt: encoderQuality]
forKey: AVEncoderAudioQualityKey];
NSError *recorderSetupError = nil;
audioRecorder = [[AVAudioRecorder alloc] initWithURL:destinationURL
settings:recordSettings error:&recorderSetupError];
[recordSettings release];
if (recorderSetupError) {
UIAlertView *cantRecordAlert =
[[UIAlertView alloc] initWithTitle: @"Can't record"
message: [recorderSetupError localizedDescription]
delegate: nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[cantRecordAlert show];
[cantRecordAlert release];
return recorderSetupError;
}
[audioRecorder prepareToRecord];
audioRecorder.delegate = self;
audioRecorder.meteringEnabled = YES;
NSLog (@"error: %@", recorderSetupError);
return recorderSetupError;
}
Any ideas or similar situations encountered before where your app works perfectly fine on your device but got totally unexpected errors on the approver's?
One more thing is that the approver was testing his app on iphone 3G (not 3GS) /w OS 3.1.3, which i don't have.
Thanks in advance
Spark
|