iPhone 6s、iPhone 8 plus和iPhone XR请求音频许可时崩溃



在iOS 14.8.1和15.3.1的iPhone 6s, iPhone 8 plus和iPhone XR中,当点击音频按钮时,应用程序会崩溃。此时,它正在请求许可。我遵循了同样的文档,并在剩下的iOS和Android设备上运行良好。特定设备崩溃。这是崩溃日志。

Incident Identifier: F071C05E-F3FC-4DE5-8901-1B3D6E7D3CEA
Hardware Model: iPhone10,2
Process: Runner [1527]
Path: /private/var/containers/Bundle/Application/97DA3EBA-C4B5-4CE1-9240-2DE88A83F645/Runner.app/Runner
Identifier: com.myapp.app
Version: 100 (1.0)
AppStoreTools: 13E500
AppVariant: 1:iPhone10,2:14
Beta: YES
Code Type: ARM-64 (Native)
Role: Foreground
Parent Process: launchd [1]
Coalition: com.myapp.app [818]
Date/Time: 2022-04-15 13:39:09.4154 +0530
Launch Time: 2022-04-15 13:38:30.5858 +0530
OS Version: iPhone OS 14.8.1 (18H107)
Release Type: User
Baseband Version: 6.71.01
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Triggered by Thread: 0
Last Exception Backtrace:
0 CoreFoundation 0x18ec88928 __exceptionPreprocess + 216 (NSException.m:199)
1 libobjc.A.dylib 0x1a2a27480 objc_exception_throw + 56 (objc-exception.mm:565)
2 CoreFoundation 0x18eb96380 +[NSException raise:format:arguments:] + 96 (NSException.m:146)
3 Foundation 0x18feceef8 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 128 (NSException.m:231)
4 Flutter 0x10463c138 -[FlutterStandardMethodCodec encodeErrorEnvelope:] + 196
5 Flutter 0x1046390d0 __45-[FlutterMethodChannel setMethodCallHandler:]block_invoke_2 + 136
6 flutter_audio_recorder2 0x103bdf3e8 $syXlSgIeyBy_ypSgIegn_TR + 160 (:0)
7 flutter_audio_recorder2 0x103bdf3e8 specialized SwiftFlutterAudioRecorder2Plugin.handle(:result:) + 7176 (SwiftFlutterAudioRecorder2Plugin.swift:93)
8 flutter_audio_recorder2 0x103bdc400 $s23flutter_audio_recorder232SwiftFlutterAudioRecorder2PluginC6handle_6resultySo0E10MethodCallC_yypSgctF015$syXlSgIeyBy_ypO7Iegn_TRyXlSgIeyBy_Tf1ncn_n + 16 (:0)
9 flutter_audio_recorder2 0x103bdc400 @objc SwiftFlutterAudioRecorder2Plugin.handle(_:result:) + 84
10 Flutter 0x104639038 __45-[FlutterMethodChannel setMethodCallHandler:]_block_invoke + 116
11 Flutter 0x10416dd08 flutter::PlatformViewIOS::HandlePlatformMessage(std::__1::unique_ptr<flutter::PlatformMessage, std::__1::default_deleteflutter::PlatformMessage >) + 516
12 Flutter 0x1044ffcc4 std::__1::__function::__func<fml::internal::CopyableLambda<flutter::Shell::OnEngineHandlePlatformMessage(std::__1::unique_ptr<flutter::PlatformMessage, std::__1::default_delete<flutter::PlatformMes... + 92
13 Flutter 0x104427c10 fml::MessageLoopImpl::FlushTasks(fml::FlushType) + 1668
14 Flutter 0x10442b1dc fml::MessageLoopDarwin::OnTimerFire(__CFRunLoopTimer*, fml::MessageLoopDarwin*) + 32
15 CoreFoundation 0x18ec087a8 CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION + 28 (CFRunLoop.c:1807)
16 CoreFoundation 0x18ec083a8 __CFRunLoopDoTimer + 1016 (CFRunLoop.c:2415)
17 CoreFoundation 0x18ec0787c __CFRunLoopDoTimers + 324 (CFRunLoop.c:2575)
18 CoreFoundation 0x18ec01bb4 __CFRunLoopRun + 1948 (CFRunLoop.c:3090)
19 CoreFoundation 0x18ec00ed0 CFRunLoopRunSpecific + 572 (CFRunLoop.c:3242)
20 GraphicsServices 0x1a534c570 GSEventRunModal + 160 (GSEvent.c:2259)
21 UIKitCore 0x19152e2d0 -[UIApplication _run] + 1052 (UIApplication.m:3269)
22 UIKitCore 0x19153384c UIApplicationMain + 164 (UIApplication.m:4740)
23 Runner 0x1029f4f38 main + 64 (AppDelegate.swift:7)
24 libdyld.dylib 0x18e8df140 start + 4

我使用的是flutter_audio_recorder2: ^0.0.2和稳定版本的flutter(2.10.3)。

我也在询问NSMicrophoneUsageDescription权限并添加了info。plist文件。

请给我一些建议。

我明白了。我们使用的是。wav音频格式,iPhone 8+、iPhone XR等设备不支持。在将音频格式更改为。aac后,崩溃问题解决了。下面是一行代码:

FlutterAudioRecorder2 _recorder =FlutterAudioRecorder2 (customPath audioFormat: AudioFormat.AAC);//wav在iphone 8 plus和iphone X中不支持