当我尝试从 vs code 或 Xcode 在 iOS 模拟器中运行我的 flutter 应用程序时,应用程序在请求权限后崩溃并显示此屏幕
日志说:
flutter: [2024-09-03 11:13:19.272311 | Catcher 2 | INFO] Setup localization lazily!
flutter: [2024-09-03 11:13:19.299009 | Catcher 2 | INFO] ============================== CATCHER 2 LOG ==============================
flutter: [2024-09-03 11:13:19.299839 | Catcher 2 | INFO] Crash occurred on 2024-09-03 11:13:19.294106
flutter: [2024-09-03 11:13:19.303913 | Catcher 2 | INFO] ---------- ERROR ----------
flutter: [2024-09-03 11:13:19.304042 | Catcher 2 | INFO] Stack Overflow
然后,如果我在 vs code 中执行 cmd+s,崩溃就会消失并且应用程序运行良好,但如果我重新加载,则会再次出现错误。
这是我的扑动医生:
[✓] Flutter (Channel stable, 3.19.0, on macOS 14.5 23F79 darwin-arm64, locale en-IT)
• Flutter version 3.19.0 on channel stable at /Users/alberto.callegari/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision bae5e49bc2 (7 months ago), 2024-02-13 17:46:18 -0800
• Engine revision 04817c99c9
• Dart version 3.3.0
• DevTools version 2.31.1
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at /Users/alberto.callegari/Library/Android/sdk
• Platform android-34, build-tools 34.0.0
• ANDROID_HOME = /Users/alberto.callegari/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 15F31d
• CocoaPods version 1.15.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2024.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)
[✓] VS Code (version 1.92.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.94.0
[✓] Connected device (5 available)
• SM A546B (mobile) • RZCW21K910J • android-arm64 • Android 14 (API 34)
• sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64 • Android 14 (API 34) (emulator)
• iPhone 15 Pro Max (mobile) • EC3C0FE0-2505-40BD-BD7C-071C416AAE08 • ios • com.apple.CoreSimulator.SimRuntime.iOS-17-4 (simulator)
• macOS (desktop) • macos • darwin-arm64 • macOS 14.5 23F79 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 128.0.6613.114
[✓] Network resources
• All expected network resources are available.
• No issues found!
我建议检查何时请求权限,并且我还建议使用 ErrorWidget,以便您可以具体识别它是什么