strongSelf per CR

// FREEBIE
pull/1/head
Michael Kirk 8 years ago
parent c56ff7532c
commit 16032b9c61

@ -3108,13 +3108,20 @@ typedef enum : NSUInteger {
- (void)requestRecordingVoiceMemo - (void)requestRecordingVoiceMemo
{ {
OWSAssert([NSThread isMainThread]); OWSAssert([NSThread isMainThread]);
__weak typeof(self) weakSelf = self;
[[AVAudioSession sharedInstance] requestRecordPermission:^(BOOL granted) { [[AVAudioSession sharedInstance] requestRecordPermission:^(BOOL granted) {
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
__strong typeof(self) strongSelf = weakSelf;
if (!strongSelf) {
return;
}
if (granted) { if (granted) {
[self startRecordingVoiceMemo]; [strongSelf startRecordingVoiceMemo];
} else { } else {
DDLogInfo(@"%@ we do not have recording permission.", self.tag); DDLogInfo(@"%@ we do not have recording permission.", self.tag);
[self cancelVoiceMemo]; [strongSelf cancelVoiceMemo];
[OWSAlerts showNoMicrophonePermissionAlert]; [OWSAlerts showNoMicrophonePermissionAlert];
} }
}); });

Loading…
Cancel
Save