Flutter应用本地运行正常但TestFlight构建因swift_getObjectType崩溃
Flutter TestFlight启动崩溃排查与解决
问题描述
安卓端部署正常,Xcode实体iPhone和模拟器运行无问题,但TestFlight安装后无法启动,崩溃日志如下:
------------------------------------- 翻译后的报告(完整报告见下方) ------------------------------------- 事件标识符: 1C0A2576-B529-41E6-9CB3-02D939119209 Beta标识符: ECFBB799-6DDF-47B3-8FEA-70B5086F67B4 硬件型号: iPhone14,3 进程: Runner [639] 路径: /private/var/containers/Bundle/Application/4997CA6E-ED75-4639-AAD4-393BB5E4CF64/Runner.app/Runner 标识符: com.streetstreams.brorno 版本: 8.9 (89) AppStore工具版本: 15A240a 应用变体: 1:iPhone14,3:17 Beta测试: YES 代码类型: ARM-64 (原生) 进程角色: 前台 父进程: launchd [1] 进程组: com.streetstreams.brorno [866] 日期/时间: 2023-09-29 21:34:45.0428 +0000 启动时间: 2023-09-29 21:34:44.8921 +0000 系统版本: iPhone OS 17.0 (21A329) 发布类型: 用户版 基带版本: 3.06.01 报告版本: 104 异常类型: EXC_BAD_ACCESS (SIGSEGV) 异常子类型: KERN_INVALID_ADDRESS 地址 0x0000000000000000 异常代码: 0x0000000000000001, 0x0000000000000000 虚拟内存区域信息: 0 不在任何区域。 前一个区域末尾地址: 4362600448 区域类型 起始 - 结束 [ 大小] 权限/最大权限 共享模式 区域详情 起始处未使用空间 ---> __TEXT 104080000-104084000 [ 16K] r-x/r-x SM=COW ...er.app/Runner 终止原因: SIGNAL 11 段错误: 11 终止进程: 异常处理程序 [639] 触发线程: 0 线程0名称: 调度队列: com.apple.main-thread 线程0崩溃: 0 libswiftCore.dylib 0x1948ac3ec swift_getObjectType + 40 1 audioplayers_darwin 0x108d6cb90 static SwiftAudioplayersDarwinPlugin.register(with:) + 60 2 audioplayers_darwin 0x108d6ce20 @objc static SwiftAudioplayersDarwinPlugin.register(with:) + 56 3 audioplayers_darwin 0x108d665f0 +[AudioplayersDarwinPlugin registerWithRegistrar:] + 72 4 Runner 0x104086d6c +[GeneratedPluginRegistrant registerWithRegistry:] + 116 5 Runner 0x104087728 AppDelegate.application(_:didFinishLaunchingWithOptions:) + 212 6 Runner 0x104087bc8 @objc AppDelegate.application(_:didFinishLaunchingWithOptions:) + 196 7 UIKitCore 0x19d43c1d8 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 320 8 UIKitCore 0x19d43b340 -[UIApplication _callInitializationDelegatesWithActions:forCanvas:payload:fromOriginatingProcess:] + 2856 9 UIKitCore 0x19d43a324 -[UIApplication _runWithMainScene:transitionContext:completion:] + 856 10 UIKitCore 0x19d439f70 -[_UISceneLifecycleMultiplexer completeApplicationLaunchWithFBSScene:transitionContext:] + 132 11 UIKitCore 0x19d3b69dc _UIScenePerformActionsWithLifecycleActionMask + 112 12 UIKitCore 0x19d43df00 __101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]_block_invoke + 216 13 UIKitCore 0x19d362e40 -[_UISceneLifecycleMultiplexer _performBlock:withApplicationOfDeactivationReasons:fromReasons:] + 332 14 UIKitCore 0x19d361848 -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:] + 608 15 UIKitCore 0x19d3611b0 -[_UISceneLifecycleMultiplexer uiScene:transitionedFromState:withTransitionContext:] + 248 16 UIKitCore 0x19d361080 __186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block_invoke + 148 17 UIKitCore 0x19d360f88 +[BSAnimationSettings(UIKit) tryAnimatingWithSettings:fromCurrentState:actions:completion:] + 736 18 UIKitCore 0x19d360810 _UISceneSettingsDiffActionPerformChangesWithTransitionContextAndCompletion + 224 19 UIKitCore 0x19d3604c0 -[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:] + 316 20 UIKitCore 0x19d6df8d0 __64-[UIScene scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke.225 + 612 21 UIKitCore 0x19d35f644 -[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:] + 216 22 UIKitCore 0x19d35f4b4 -[UIScene scene:didUpdateWithDiff:transitionContext:completion:] + 244 23 UIKitCore 0x19d47a428 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 508 24 UIKitCore 0x19d47a1c0 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 288 25 FrontBoardServices 0x1b3124aa8 -[FBSScene _callOutQueue_didCreateWithTransitionContext:completion:] + 324 26 FrontBoardServices 0x1b3124944 __92-[FBSWorkspaceScenesClient createSceneWithIdentity:parameters:transitionContext:completion:]_block_invoke.108 + 280 27 FrontBoardServices 0x1b31235a8 -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 168 28 FrontBoardServices 0x1b312f360 __92-[FBSWorkspaceScenesClient createSceneWithIdentity:parameters:transitionContext:completion:]_block_invoke + 352 29 libdispatch.dylib 0x1a2f43300 _dispatch_client_callout + 20 30 libdispatch.dylib 0x1a2f46d48 _dispatch_block_invoke_direct + 284 31 FrontBoardServices 0x1b311f9ec __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 52 32 FrontBoardServices 0x1b311f96c -[FBSMainRunLoopSerialQueue _targetQueue_performNextIfPossible] + 240 33 FrontBoardServices 0x1b311f844 -[FBSMainRunLoopSerialQueue _performNextFromRunLoopSource] + 28 34 CoreFoundation 0x19b04cacc __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28 35 CoreFoundation 0x19b04bd48 __CFRunLoopDoSource0 + 176 36 CoreFoundation 0x19b04a55c __CFRunLoopDoSources0 + 340 37 CoreFoundation 0x19b049238 __CFRunLoopRun + 828 38 CoreFoundation 0x19b048e18 CFRunLoopRunSpecific + 608 39 GraphicsServices 0x1ddb055ec GSEventRunModal + 164 40 UIKitCore 0x19d457350 -[UIApplication _run] + 888 41 UIKitCore 0x19d45698c UIApplicationMain + 340 42 Runner 0x104087d40 main + 64 43 dyld 0x1bd82bd44 start + 2104
崩溃根源在于audioplayers_darwin插件注册时触发空指针访问,推测是插件版本与iOS 17或TestFlight编译环境不兼容导致。
解决方案
- 升级audioplayers插件:更新到最新稳定版修复兼容性问题
flutter pub upgrade audioplayers - 清理重建iOS项目:
flutter clean flutter pub get cd ios pod install --repo-update - 配置Xcode Swift版本:打开Xcode,进入Runner target的Build Settings,将
Swift Language Version设置为Swift 5.9及以上(对应Xcode 15) - 关闭Bitcode:在Xcode Build Settings中搜索
Enable Bitcode,设置为No,避免旧插件因Bitcode触发异常 - 验证Release编译:切换到Release配置在真机运行测试,确认无崩溃后再上传TestFlight
内容的提问来源于stack exchange,提问作者Agbeko Dzamesi
相关产品推荐
相关产品推荐

