Skip to content
This repository was archived by the owner on Jun 16, 2023. It is now read-only.

Commit 959327e

Browse files
n1ru4lsibelius
authored andcommitted
fix: only call requestRecordPermission in debug mode (#2119)
1 parent 06ddd6f commit 959327e

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

ios/RN/RNCameraManager.m

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -386,16 +386,19 @@ + (NSDictionary *)faceDetectorConstants
386386

387387
RCT_EXPORT_METHOD(checkRecordAudioAuthorizationStatus:(RCTPromiseResolveBlock)resolve
388388
reject:(__unused RCTPromiseRejectBlock)reject) {
389-
#ifdef DEBUG
390389
if ([[NSBundle mainBundle].infoDictionary objectForKey:@"NSMicrophoneUsageDescription"] == nil) {
391390
RCTLogWarn(@"Checking audio permissions without having key 'NSMicrophoneUsageDescription' defined in your Info.plist. Audio Recording for your video files is therefore disabled. If you do not need audio on your recordings is is recommended to set the 'captureAudio' property on your component instance to 'false', otherwise you will have to add the key 'NSMicrophoneUsageDescription' to your Info.plist. If you do not your app will crash when being built in release mode. You can learn more about adding permissions here: https://stackoverflow.com/a/38498347/4202031");
392391
resolve(@(NO));
393392
return;
394-
}
393+
} else {
394+
#ifdef DEBUG
395+
[[AVAudioSession sharedInstance] requestRecordPermission:^(BOOL granted) {
396+
resolve(@(granted));
397+
}];
398+
#else
399+
resolve(@(YES));
395400
#endif
396-
[[AVAudioSession sharedInstance] requestRecordPermission:^(BOOL granted) {
397-
resolve(@(granted));
398-
}];
401+
}
399402
}
400403

401404
RCT_REMAP_METHOD(getAvailablePictureSizes,

0 commit comments

Comments
 (0)