Fix for potential recording crash

This commit is contained in:
Selim Mustafaev 2025-10-05 16:45:06 +03:00
parent 61d7c3501f
commit b1f5f6464d
2 changed files with 8 additions and 6 deletions

View File

@ -1721,7 +1721,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = AutoCat/AutoCat.entitlements; CODE_SIGN_ENTITLEMENTS = AutoCat/AutoCat.entitlements;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 170; CURRENT_PROJECT_VERSION = 171;
DEVELOPMENT_TEAM = 46DTTB8X4S; DEVELOPMENT_TEAM = 46DTTB8X4S;
INFOPLIST_FILE = AutoCat/Info.plist; INFOPLIST_FILE = AutoCat/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = AutoCat; INFOPLIST_KEY_CFBundleDisplayName = AutoCat;
@ -1750,7 +1750,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = AutoCat/AutoCat.entitlements; CODE_SIGN_ENTITLEMENTS = AutoCat/AutoCat.entitlements;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 170; CURRENT_PROJECT_VERSION = 171;
DEVELOPMENT_TEAM = 46DTTB8X4S; DEVELOPMENT_TEAM = 46DTTB8X4S;
INFOPLIST_FILE = AutoCat/Info.plist; INFOPLIST_FILE = AutoCat/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = AutoCat; INFOPLIST_KEY_CFBundleDisplayName = AutoCat;

View File

@ -114,6 +114,12 @@ extension VehicleRecordService: VehicleRecordServiceProtocol {
throw VehicleRecordError.emptyUrl throw VehicleRecordError.emptyUrl
} }
locationTask?.cancel()
locationTask = nil
self.url = nil
let location = self.location
self.location = nil
await recordService.stopRecording() await recordService.stopRecording()
async let recognitionTask = recordService.recognizeText(from: url) async let recognitionTask = recordService.recognizeText(from: url)
@ -121,10 +127,6 @@ extension VehicleRecordService: VehicleRecordServiceProtocol {
let (text, duration) = await (recognitionTask, try? durationTask) let (text, duration) = await (recognitionTask, try? durationTask)
locationTask?.cancel()
locationTask = nil
self.url = nil
let record = AudioRecordDto( let record = AudioRecordDto(
path: url.lastPathComponent, path: url.lastPathComponent,
number: await getPlateNumber(from: text), number: await getPlateNumber(from: text),