我已经在各种设备(iOS 和 Android)上测试了我的应用程序,以前从未遇到过此问题。然而,昨天当我在 TestFlight 上部署我的应用程序时,它似乎在启动屏幕上崩溃了。
以下是日志:
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000000
Exception Codes: 0x0000000000000001, 0x0000000000000000
VM Region Info: 0 is not in any region. Bytes before following region: 4307746816
REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL
UNUSED SPACE AT START
--->
__TEXT 100c30000-100c40000 [ 64K] r-x/r-x SM=COW ...er.app/Runner
Termination Reason: SIGNAL 11 Segmentation fault: 11
Terminating Process: exc handler [637]
Triggered by Thread: 0
Thread 0 name:
Thread 0 Crashed:
0 libswiftCore.dylib 0x000000019e05a330 swift_getObjectType + 40 (SwiftObject.mm:131)
1 connectivity_plus 0x000000010180eba4 static SwiftConnectivityPlusPlugin.register(with:) + 116 (SwiftConnectivityPlusPlugin.swift:19)
2 connectivity_plus 0x000000010180ef1c @objc static SwiftConnectivityPlusPlugin.register(with:) + 56 (<compiler-generated>:0)
3 connectivity_plus 0x000000010180c048 +[ConnectivityPlusPlugin registerWithRegistrar:] + 72 (ConnectivityPlusPlugin.m:13)
4 Runner 0x0000000100c380b8 0x100c30000 + 32952
5 Runner 0x0000000100c3f588 0x100c30000 + 62856
6 Runner 0x0000000100c403c0 0x100c30000 + 66496
7 UIKitCore 0x00000001a6c9e3b8 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 320 (UIApplication.m:2401)
8 UIKitCore 0x00000001a6c9d520 -[UIApplication _callInitializationDelegatesWithActions:forCanvas:payload:fromOriginatingProcess:] + 2856 (UIApplication.m:2835)
9 UIKitCore 0x00000001a6c9c504 -[UIApplication _runWithMainScene:transitionContext:completion:] + 856 (UIApplication.m:4679)
10 UIKitCore 0x00000001a6c9c150 -[_UISceneLifecycleMultiplexer completeApplicationLaunchWithFBSScene:transitionContext:] + 132 (_UISceneLifecycleMultiplexer.m:450)
11 UIKitCore 0x00000001a6c18c78 _UIScenePerformActionsWithLifecycleActionMask + 112 (_UISceneLifecycleState.m:109)
12 UIKitCore 0x00000001a6ca014c __101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]_block_invoke + 216 (_UISceneLifecycleMultiplexer.m:566)
13 UIKitCore 0x00000001a6bc7be0 -[_UISceneLifecycleMultiplexer _performBlock:withApplicationOfDeactivationReasons:fromReasons:] + 220 (_UISceneLifecycleMultiplexer.m:515)
14 UIKitCore 0x00000001a6bc6658 -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:] + 608 (_UISceneLifecycleMultiplexer.m:565)
15 UIKitCore 0x00000001a6bc5fc0 -[_UISceneLifecycleMultiplexer uiScene:transitionedFromState:withTransitionContext:] + 248 (_UISceneLifecycleMultiplexer.m:468)
16 UIKitCore 0x00000001a6bc5e90 __186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block... + 148 (_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction.m:73)
17 UIKitCore 0x00000001a6bc5d98 +[BSAnimationSettings(UIKit) tryAnimatingWithSettings:fromCurrentState:actions:completion:] + 736 (BSAnimationSettings+UIKit.m:54)
18 UIKitCore 0x00000001a6bc5620 _UISceneSettingsDiffActionPerformChangesWithTransitionContextAndCompletion + 224 (_UISceneSettingsDiffAction.m:27)
19 UIKitCore 0x00000001a6bc52d0 -[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:] + 316 (_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction.m:58)
20 UIKitCore 0x00000001a6f490a8 __64-[UIScene scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke.225 + 612 (UIScene.m:2053)
21 UIKitCore 0x00000001a6bc4454 -[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:] + 216 (UIScene.m:1722)
22 UIKitCore 0x00000001a6bc42c4 -[UIScene scene:didUpdateWithDiff:transitionContext:completion:] + 244 (UIScene.m:2012)
23 UIKitCore 0x00000001a6cdca48 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 508 (UIApplication.m:4124)
24 UIKitCore 0x00000001a6cdc7e0 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 288 (UIApplicationSceneClientAgent.m:47)
25 FrontBoardServices 0x00000001bccf56d4 -[FBSScene _callOutQueue_didCreateWithTransitionContext:completion:] + 324 (FBSScene.m:549)
26 FrontBoardServices 0x00000001bccf5570 __92-[FBSWorkspaceScenesClient createSceneWithIdentity:parameters:transitionContext:completion:]_block_invoke.108 + 280 (FBSWorkspaceScenesClient.m:480)
27 FrontBoardServices 0x00000001bccf419c -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 168 (FBSWorkspace.m:411)
28 FrontBoardServices 0x00000001bccfff8c __92-[FBSWorkspaceScenesClient createSceneWithIdentity:parameters:transitionContext:completion:]_block_invoke + 352 (FBSWorkspaceScenesClient.m:468)
29 libdispatch.dylib 0x00000001ac855300 _dispatch_client_callout + 20 (object.m:561)
30 libdispatch.dylib 0x00000001ac858d48 _dispatch_block_invoke_direct + 284 (queue.c:496)
31 FrontBoardServices 0x00000001bccf0520 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 52 (FBSSerialQueue.m:285)
32 FrontBoardServices 0x00000001bccf04a0 -[FBSMainRunLoopSerialQueue _targetQueue_performNextIfPossible] + 240 (FBSSerialQueue.m:309)
33 FrontBoardServices 0x00000001bccf0378 -[FBSMainRunLoopSerialQueue _performNextFromRunLoopSource] + 28 (FBSSerialQueue.m:322)
34 CoreFoundation 0x00000001a489912c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28 (CFRunLoop.c:1957)
35 CoreFoundation 0x00000001a48983a8 __CFRunLoopDoSource0 + 176 (CFRunLoop.c:2001)
36 CoreFoundation 0x00000001a4896b5c __CFRunLoopDoSources0 + 244 (CFRunLoop.c:2038)
37 CoreFoundation 0x00000001a4895898 __CFRunLoopRun + 828 (CFRunLoop.c:2955)
38 CoreFoundation 0x00000001a4895478 CFRunLoopRunSpecific + 608 (CFRunLoop.c:3420)
39 GraphicsServices 0x00000001e7dee4f8 GSEventRunModal + 164 (GSEvent.c:2196)
40 UIKitCore 0x00000001a6cb962c -[UIApplication _run] + 888 (UIApplication.m:3685)
41 UIKitCore 0x00000001a6cb8c68 UIApplicationMain + 340 (UIApplication.m:5270)
42 Runner 0x0000000100c4131c 0x100c30000 + 70428
43 dyld 0x00000001c75badcc start + 2240 (dyldMain.cpp:1269)
我的扑扑酒吧:
environment:
sdk: ">=3.0.0 <4.0.0"
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
intl: ^0.18.0
bloc: ^8.1.2
flutter_bloc: ^8.1.3
flutter_local_notifications: ^16.3.0
dotted_border: ^2.1.0
flutter_hooks: ^0.20.4
json_annotation: ^4.8.1
equatable: ^2.0.5
vibration: ^1.8.4
get_it: ^7.6.7
loggy: ^2.0.3
connectivity_plus: ^5.0.2
flutter_svg: ^2.0.9
reorderables: ^0.6.0
chopper: ^7.1.0+1
flutter_spinkit: ^5.2.0
cupertino_icons: ^1.0.6
xml: ^6.5.0
url_launcher: ^6.2.3
retrofit: ^4.0.3
dio: ^5.4.0
http: ^1.2.0
flutter_map: ^6.1.0
latlong2: ^0.9.0
flutter_map_marker_cluster: ^1.3.4
flutter_map_location_marker: ^8.0.4
permission_handler: ^11.2.0
geolocator: ^10.1.0
flutter_map_cache : ^1.3.1
dio_cache_interceptor_file_store : ^1.2.3
stream_transform: ^2.1.0
background_fetch: ^1.2.2
marquee: ^2.2.3
shared_preferences: ^2.2.2
snapping_sheet: ^3.1.0
fluttertoast: ^8.2.4
uuid: ^4.3.3
package_info_plus: ^5.0.1
firebase_core: ^2.24.2
firebase_messaging: ^14.7.10
device_info_plus: ^9.1.1
flutter_html: ^3.0.0-beta.2
flutter_open_app_settings: ^0.1.4
webview_flutter: ^4.4.4
objectbox: ^2.4.0
objectbox_flutter_libs: ^2.4.0
screen_brightness: ^0.2.2+1
auto_size_text: ^3.0.0
flutter_map_tile_caching: ^9.0.0-dev.5
flutter_native_splash: ^2.3.9
dev_dependencies:
flutter_test:
sdk: flutter
bloc_test: ^9.1.5
flutter_inappwebview: ^6.0.0
pigeon: ^16.0.3
build_runner: ^2.4.8
json_serializable: ^6.7.1
retrofit_generator: ^8.0.6
objectbox_generator: ^2.4.0
flutter_gen_runner: ^5.4.0
mockito: ^5.4.4
open_file: ^3.3.2
flutter_lints: ^3.0.1
swagger_dart_code_generator: ^2.14.2
chopper_generator: ^7.1.0
dependency_validator: ^3.0.0
与其他人类似,第一次崩溃时,我修复了有问题的包。然而,在下一次部署时,它在后续包中崩溃,该包使用 .swift 源文件而不仅仅是 .m 和 .h 文件。尽管我的配置似乎是正确的,但这可能是 Firebase 问题。
您似乎遇到了与在没有正确配置的情况下访问系统级 API 相关的问题。这确实会导致崩溃,特别是在处理用户位置等敏感数据时。以下是解决此问题的分步方法:
检查 AppDelegate.swift:验证您是否配置了必要的设置,尤其是对于 Google 地图等集成。确保此处正确设置任何所需的配置。
Info.plist:该文件对于声明权限和配置至关重要。确保正确声明任何所需的权限,例如用于位置访问的 NSLocationWhenInUseUsageDescription。
GoogleService-Info.plist:对于使用 Google 服务的项目,请确保此文件存在并正确配置。它包含 Firebase 等服务的基本配置详细信息,这对于您的应用程序的功能可能是必需的。
证书:仔细检查您是否已为您正在测试的特定 TestFlight 版本添加开发证书。证书不匹配有时会导致意外行为或崩溃。
如果您已验证所有这些配置但仍然遇到问题,您可以采取以下额外步骤:
生成新的 IPA:运行 flutter build ipa 为您的应用创建新的 IPA(iOS 应用商店包)。然后,将此 IPA 上传到 Diawi 等测试服务以进行进一步测试。这有时可以帮助确定问题是否特定于构建或配置。 通过执行这些步骤,您应该能够系统地识别并解决导致应用程序崩溃的任何与配置相关的问题。如果问题仍然存在,请随时提供更多详细信息或具体错误消息以获得进一步帮助。
希望这有帮助!如果您还有任何疑问,请告诉我。
感谢您的反馈!我尝试在没有 Firebase 的情况下部署应用程序,但遇到了同样的问题。事实证明,该问题源于从 Xcode 部署应用程序而不是使用 Flutter shell 命令。当我将 IPA 推送到 TestFlight 后,它成功了!我希望这些信息对其他人有帮助!