From c2da808405e418cfb0b1f0659e6294b14c68caba Mon Sep 17 00:00:00 2001 From: Andrew Sliwinski Date: Thu, 19 May 2016 20:19:27 -0700 Subject: [PATCH] Do not throw exception when app moves to background during audio recording. Resolves GH-91 --- ios/ScratchJr/src/RecordSound.m | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ios/ScratchJr/src/RecordSound.m b/ios/ScratchJr/src/RecordSound.m index e525380..450b448 100644 --- a/ios/ScratchJr/src/RecordSound.m +++ b/ios/ScratchJr/src/RecordSound.m @@ -29,8 +29,9 @@ NSString *canRecord; + (double) getVolume{ if (recordingKilled) { recordingKilled = FALSE; - @throw [NSException exceptionWithName:@"RecordException" reason:@"app went to background" userInfo:nil]; + return 0; } + [recorder updateMeters]; const double ALPHA = 0.05; double peakPowerForChannel = pow(10, (0.05 * [recorder peakPowerForChannel:0])); @@ -44,9 +45,7 @@ NSString *canRecord; recordingKilled = TRUE; } - // Init audio with record capability - + (NSString*)startRecord{ recordingKilled = FALSE; recorder = nil;