Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 03-30-2010, 08:46 PM   #1 (permalink)
Registered Member
 
Join Date: Nov 2009
Posts: 282
sparkso is on a distinguished road
Default 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
sparkso is offline   Reply With Quote
Old 04-10-2010, 07:22 AM   #2 (permalink)
Registered Member
 
Join Date: Nov 2009
Posts: 282
sparkso is on a distinguished road
Default

Problem Solved. Realized that iPhone 3G does not have AAC hardware encoding but the iPod Touch 2G and iPhone 3GS does.
__________________
SolarSpark Apps
sparkso is offline   Reply With Quote
Old 05-10-2010, 03:54 AM   #3 (permalink)
Registered Member
 
Join Date: Apr 2010
Location: India
Posts: 11
Surendra is on a distinguished road
Default Record sound with back ground music...

Hi,

I am working on one project in which i want to record background music with the user input.
But it doesn't work. Have you face this kind of problem prevously or you know some solution for this. Please help me.

Thanks in advance.
Surendra is offline   Reply With Quote
Old 06-12-2010, 12:15 PM   #4 (permalink)
Registered Member
 
Join Date: Jun 2010
Posts: 1
davidf is on a distinguished road
Default

Quote:
Originally Posted by sparkso View Post
Problem Solved. Realized that iPhone 3G does not have AAC hardware encoding but the iPod Touch 2G and iPhone 3GS does.
How did you solve it? by changing the sampling rate?
Could you post the code you had to change?

Thank you very much in advance!
davidf is offline   Reply With Quote
Reply

Bookmarks

Tags
approve, avaudiorecorder, distribution, reject

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 320
7 members and 313 guests
checkright, chemistry, heshiming, iAppDeveloper, jbro, kapps11, SLIC
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,648
Threads: 94,112
Posts: 402,872
Top Poster: BrianSlick (7,990)
Welcome to our newest member, brandon6031
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 07:21 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0