From d82b4cfb758bdedab3e57b496d2d152616c71596 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=98=BF=E6=9D=83?= Date: Sat, 27 Aug 2016 18:14:59 +0800 Subject: [PATCH 1/2] exit will cause app exit, should throw error --- EZAudio/EZAudioUtilities.m | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/EZAudio/EZAudioUtilities.m b/EZAudio/EZAudioUtilities.m index 82402dad..ded2681e 100644 --- a/EZAudio/EZAudioUtilities.m +++ b/EZAudio/EZAudioUtilities.m @@ -539,7 +539,17 @@ + (void)checkResult:(OSStatus)result operation:(const char *)operation fprintf(stderr, "Error: %s (%s)\n", operation, errorString); if (__shouldExitOnCheckResultFail) { - exit(-1); + //exit(-1); + @try { + NSException *e = [NSException + exceptionWithName:@"EZAudioException" + reason:[NSString stringWithCString:errorString encoding:NSUTF8StringEncoding] + userInfo:nil]; + @throw e; + } + @catch(NSException *e) { + @throw; // rethrows e implicitly + } } } From 0524eb46972fc22dd0e7f069468e03b8ef08d1e0 Mon Sep 17 00:00:00 2001 From: hqlulu Date: Sat, 27 Aug 2016 21:14:23 +0800 Subject: [PATCH 2/2] fix --- EZAudio/EZAudioUtilities.m | 1 - 1 file changed, 1 deletion(-) diff --git a/EZAudio/EZAudioUtilities.m b/EZAudio/EZAudioUtilities.m index ded2681e..f9ecddf2 100644 --- a/EZAudio/EZAudioUtilities.m +++ b/EZAudio/EZAudioUtilities.m @@ -539,7 +539,6 @@ + (void)checkResult:(OSStatus)result operation:(const char *)operation fprintf(stderr, "Error: %s (%s)\n", operation, errorString); if (__shouldExitOnCheckResultFail) { - //exit(-1); @try { NSException *e = [NSException exceptionWithName:@"EZAudioException"